mstdn-ebooks icon indicating copy to clipboard operation
mstdn-ebooks copied to clipboard

Add 1-button Heroku/Now.sh deployment

Open nuklearfiziks opened this issue 7 years ago • 7 comments

Hiiiiii!

Was reading through the ebooks bot guide and it sort of dawned on me that it'd be really simple to set up a button on the repo to deploy it to Now.sh or Heroku (probably the former because it supports Docker).

Docs:

I've only really ever had luck with the latter but I haven't tried Docker on Now.sh yet, might work better.

Happy to PR if it helps! 💚

-Andi

nuklearfiziks avatar Dec 05 '18 01:12 nuklearfiziks

that is a fantastic idea and i'm going to work on that immediately thank you so much

Lynnesbian avatar Dec 05 '18 02:12 Lynnesbian

thank you, this seems perfect. i'm reading up on the app.json format and i'll have this finished soon.

Lynnesbian avatar Dec 05 '18 02:12 Lynnesbian

Let me know if you need any help! 💚I work with Heroku a lot and there are a few small gotchas to keep in mind:

a. All storage is ephemeral, so any long-running/expensive processes will need to store data somewhere not on disk (Postgres; Redis; whatever); this might help when people have a text corpora of many thousand toots. b. The primary web dyno on Heroku needs to listen on whatever the $PORT env var is, or else Heroku will assume it's a crashing webserver and kill the process. A way around this is to deploy the code to the web dyno, then scale it to 0 so it's not running continuously (this also saves dyno hours and makes things more affordable). The Heroku Scheduler can then be setup to "run" the dyno at a set interval (every 10 minutes/hourly/daily; it's unfortunately not more granular than that). Scheduler can be provisioned through app.json AFAIK, but setting up a job might require using the control panel (it's pretty straight-forward through; users may need to add a credit card to their account to use add-ons).

c. Or alternately just listen on $PORT and tell that sub-process to ping itself every 30 minutes or something.

If you need a reference implementation, this is how I did it in NodeJS. It's also possible Now.sh doesn't have the annoying $PORT limitation and it'd be easier to use that but I haven't researched it yet.

nuklearfiziks avatar Dec 05 '18 02:12 nuklearfiziks

um, yeah, i've been working on this and i've realised that i have absolutely 0 idea what i'm doing :L would you like to open a PR, or would it be easier for me to give your write access to the git repo? thanks SO MUCH for your help :purple_heart:

Lynnesbian avatar Dec 05 '18 02:12 Lynnesbian

Don't worry, I'll PR it!! Give me an hour okay? 😘 💚

nuklearfiziks avatar Dec 05 '18 02:12 nuklearfiziks

kk! 0u0

Lynnesbian avatar Dec 05 '18 02:12 Lynnesbian

See #9

nuklearfiziks avatar Dec 05 '18 04:12 nuklearfiziks