Skip to content

LangInteger/one-shot-plantuml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

One Shot PlantUML

Source code of one-shot-plantuml. Inspired by real-world-plantuml, the insane developer (it's me) wants to build a tool for PlantUML believers to get PlantUML masterpiece (or shit) newly created on Github.

Thanks to:

Deploy

  • clone the repo git clone [email protected]:LangInteger/one-shot-plantuml.git
  • walk into the directory cd one-shot-plantuml
  • make sure heroku cli is installed and logined
  • create your app heroku create your-app-name
  • add buildpacks as infrastructure
    • node.js as application entry heroku buildpacks:set heroku/nodejs
    • puppeteer-heroku-buildpack add extra dependencies for puppeteer heroku buildpacks:add --index 1 https://github.com/jontewks/puppeteer-heroku-buildpack
  • deploy to remote git push heroku main
  • add env variables GITHUB_USERNAME and GITHUB_PASSWORD on your application settings dashboard
  • check application logs heroku logs --tail
  • make some changes and deploy again
    • git add .
    • git commit -m "xxx"
    • git push heroku main

For local test, use heroku local web.

Architecture & Usage

Architecture, if cannot see, please check your network

Demo1, if cannot see, please check your network

Demo2, if cannot see, please check your network

Troubleshooting

1 Github API Support is Limited

This project use puppeteer to imitate operations on browsers and thus get puml files from Github.

The most convinient way to contact with contents on github is using the Github API. But for some reason, there is no open api to get newly created files by their extensions( the usage of /search/code without specifying a user, an organisation or a repository is impossible).

This reddit post make me think using ghaechive maybe another proper way, but havn't give it a try yet.

2 Github Verification Code Feature is Noisy

Github released the Device Verification feature and enabled it for all accounts that not have two-factor authentication (2FA) enabled. So even with puppeteer to imitate login, we must interact with the verification process.

Many have posted article that suggests Disable / Remove Device Verification, but not got accepted yet and it seems that this feature will continue to work for a thousand years.

3 Heroku Dynos tend to Hibernate

Refer to Heroku Doc:

  • If an app has a free web dyno, and that dyno receives no web traffic in a 30-minute period, it will sleep

When sleep, the main process and browser process will both be terminated. Since Github relies on cookies to identify devices, it will ask for device verification the next time login recoverd from sleep, which is a disaster.

Luckily there are some ways to stop dynos from hibernate easily, according to this SO thread. This project is using github actions to make regular access to one-shot-plantuml every 20 minutes(but not guaranteed), and thus make the dyno keep active all the time.

4 App Responds with No web processes running

Some friends made feedback to me to complain this. With heroku buildpacks set properly, the problem should not happen. So I think it is a heroku bug, and can be resolved by running the buildpacks set process again with following commands:

heroku buildpacks:clear
heroku buildpacks:set heroku/nodejs
heroku buildpacks:add --index 1 https://github.com/jontewks/puppeteer-heroku-buildpack
git commit --allow-empty -m "Adjust buildpacks on Heroku"
git push heroku main

Theses do not have any difference to commands in the Deploy part, but it just makes the project work.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published