Written by Sean Behan on Tue Oct 15th 2013

Foreman is a process management gem for ruby applications. It is used in combination with a Procfile for configuration instructions.

A typical Procfile looks something like this

[name] : [script to execute]

Example Rack application Procfile

web: bundle exec rackup config.ru -p $PORT

If you're working with multiple Rack apps and they do not all live in the same directory the above won't work. Instead, you will have to use a new bash shell for each separate app.

# Procfile
app1:   sh -c 'cd path/to/app1 && bundle exec rackup config.ru -p $PORT'
app2:   sh -c 'cd path/to/app2 && bundle exec rackup config.ru -p $PORT'
app3:   sh -c 'cd path/to/app3 && bundle exec rackup config.ru -p $PORT'

Now all you have to do is run

foreman start
from the directory where the Procfile is located.


Tagged with..
#Sinatra #Ruby #Rack #Foreman #Rubygems #Shell #Bash #Application Development

Just finishing up brewing up some fresh ground comments...