Foreman as Process Manager

Dan Croak

Web application development/production parity can be improved by defining process types in a manifest named Procfile such as this one for a Rails app:

web: bundle exec puma -p $PORT -C ./config/puma.rb
worker: bundle exec rake jobs:work

In production, Heroku’s Cedar stack reads process types from that file.

In development, Foreman manages output streams, responds to crashed processes, and handles user-initiated restarts and shutdowns.

Configure Foreman to always use the same port:

cd /path/to/myapp
echo 'port: 7000" > .foreman

Start Foreman processes:

foreman start

It will manage the Puma and Delayed Job processes, with the web process running on port 7000.