---
title: Foreman as Process Manager
teaser:
tags: unix
author: Dan Croak
published_on: 2013-01-09
---

Web application
[development/production parity](http://www.12factor.net/dev-prod-parity)
can be improved by defining process types in a manifest named
[`Procfile`](https://devcenter.heroku.com/articles/process-model)
such as this one for a Rails app:

```bash
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](http://blog.daviddollar.org/2011/05/06/introducing-foreman.html)
manages output streams, responds to crashed processes, and handles
user-initiated restarts and shutdowns.

Configure Foreman to always use the same port:

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

Start Foreman processes:

```bash
foreman start
```

It will manage the [Puma](http://puma.io/) and
[Delayed Job](https://github.com/collectiveidea/delayed_job) processes,
with the `web` process running on port `7000`.
