How to use supervisord on Heroku How to use supervisord on Heroku heroku heroku

How to use supervisord on Heroku


It is technically possible to have a Heroku dyno run some kind of parent supervisor process, that spawns and automatically restarts child processes. I have done this myself with forever-monitor. My Procfile had a line for a worker process type that ran a parent process that spawned and managed child processes.

So yes, this can be done, technically.

However, you need to carefully consider whether this is good for your use-case. An advantage of this approach is that it may enable you to reduce dyno costs (since you will be running child processes on a single dyno instead of on separate dynos). But this is really "working around" Heroku best practices (and the 12 Factor App methodology behind it).

If at all possible, it is probably better if you can allow Heroku to schedule your long running python scripts as separate worker process types, each on its own dyno(s). If you can afford to do that (cost-wise), then Heroku will automatically restart each of your scripts after failure or restart (see Restarting). If that is all you need, then you don't need to run your own "Supervisor" at all - let Heroku take care of that for you (it does it very well).