Process Model

If we define Unix processes in a manifest named Procfile, we can use tools to manage those processes.

Examples

Rails app:

web: ./bin/rails server
webpacker: ./bin/webpack-dev-server
worker: QUEUES=mailers ./bin/rake jobs:work

Rails API with React frontend:

client: cd client && npm start
server: cd server && bundle exec puma -C config/puma.rb

Sinatra app:

web: cd canary && bundle exec ruby web.rb

Go API with React frontend:

client: cd client && npm start
server: cd serverd && go install && serverd

Development

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

foreman start

Production

Heroku uses the Procfile to specify the app's dynos.

Foreman can also export the Procfile's process definitions to other formats such as systemd:

foreman export systemd .