Process Model

Define Unix processes in a manifest named Procfile and use tools to manage those processes.

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

In development, tools like Foreman or Overmind interleave output streams, respond to crashed processes, and handle user-initiated restarts and shutdowns.

foreman start

In production, Heroku automatically uses the Procfile to specify the app’s dynos. Foreman can export the Procfile’s process definitions to other formats such as systemd:

foreman export systemd .