Written by thoughtbot

Foreman as process manager, Pow as DNS server and HTTP proxy

Web app 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 rails server thin -p $PORT -e $RACK_ENV

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.

One downside to Foreman is typing http://localhost:3000, http://localhost:3100, etc. into the web browser, incrementing the port number for each app, forgetting which port is which app.

Pow solves this elegantly and is easy to install and maintain.

Pow has a DNS server, capable of port proxying to Rack apps.

Install and run Pow:

curl | sh

Configure Foreman to always use the same port:

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

Relate the port to Pow:

echo 7000 > ~/.pow/`basename $PWD`

Use Foreman normally:

foreman start

Reap the benefits of well-named DNS like

Pow may see improved, or automatic, Foreman compatibility. Watch this pull request for updates.