How do I run multiple processes on a dyno?


I want to run more than a single command in a dyno.


The quickest way is to list the commands to run, each followed by an &, with a wait -n in the end, in the Procfile, e.g.:

web: trap '' SIGTERM; puma -C config/puma.rb & sidekiq & wait -n; kill -SIGTERM -$$; wait

This runs all the command in the background. wait -n exits when at least one of the commands exits and triggers the dyno to restart. trap and kill are to make sure every processes exits cleanly when being terminated by the platform. Please watch the app metrics so that the commands don't exhaust memory and CPU.

This method is not recommended for production applications. We recommend separate process types to allow process isolation, scaling, and monitoring.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support