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 get.pow.cx | 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 http://myapp.dev.
It’s possible Pow may see improved, or automatic, Foreman compatibility. Watch this pull request for updates.
Written by Dan Croak.