-
Using Foreman to manage your (development only) services
Often developing Rails apps I need several things running at the same time. Rails server, beanstalkd, background processor etc.
This is not a new problem, and the Foreman gem handles this very well.
Most of my deployments are on Heroku. Heroku gives me easy scaling for early stage startups, letting my customers defer the harder deployment problems until they really have to. Heroku gives my clients the simplest thing that could possibly work at the early stage.
For Heroku normally you specify services you want to run in the
Procfile. Heroku will fire up these services when you deploy your app.There are some services that Heroku runs for us, that you do not need to specify in the
Procfile. For example, many of my clients require searching, and I use WebSolr’s Heroku addon for that. I do not have to specify that in theProcfile, because WebSolr happens “in the cloud”, on Websolr’s servers.But I want to use Foreman to bring up everything I need for my development server. Which does include a local Solr server
To solve this problem, I created a
Procfile_developmentfile. Just run Foreman like so:bundle exec foreman start -f Procfile_developmentI suggest you create a shell alias for this command. Something like
fore_devThis way I can have a
.Procfilefor production, and have another file to specify all the services I need for development.