mirror of
https://github.com/RealOrangeOne/notes.git
synced 2024-11-18 07:39:02 +00:00
Add note about scheduler-only Heroku apps
This commit is contained in:
parent
f3eeefc77c
commit
f3c16ba645
1 changed files with 15 additions and 0 deletions
15
docs/notes/infrastructure/heroku-scheduler-only-apps.md
Normal file
15
docs/notes/infrastructure/heroku-scheduler-only-apps.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
title: Scheduler-only Heroku apps
|
||||||
|
tags:
|
||||||
|
- Heroku
|
||||||
|
---
|
||||||
|
|
||||||
|
If everything you run is already in Heroku, it can be useful to run even simple scheduled tasks there too, to save integrating and running services on another hosting provider.
|
||||||
|
|
||||||
|
Heroku's scheduler only has a few intervals (every 10 minutes, hourly at X, daily at X), but if these work for you (or you can make use of them), then it's very cost-effective and simple.
|
||||||
|
|
||||||
|
Whilst Heroku is clearly designed for web apps, there's no reason you _need_ a `web` dyno. So long as there's something Heroku _could_ run, you can scale the `web` dyno to 0 and it'll never get run. [`sleep infinity`](https://theorangeone.net/posts/efficient-sleeping/) is a good command to use as a placeholder. For common-runtime apps, add this to the `Procfile`. For docker-based apps, set it as the `CMD`.
|
||||||
|
|
||||||
|
Then, deploy your codebase (which might just be a collection of `bash` scripts), add Heroku's [Scheduler](https://elements.heroku.com/addons/scheduler), and use it like you normally would. Heroku only charges for the scheduler based on the dynos it runs (rather than a flat fee for using it), so a job which only runs for an hour a month costs just ~$0.010.
|
||||||
|
|
||||||
|
It's recommended to turn on [Maintenance Mode](https://devcenter.heroku.com/articles/maintenance-mode) for the app, just in case something does discover the URL, as it results in a nicer error (for you and them).
|
Loading…
Reference in a new issue