Last Updated: September 09, 2019
·
3.394K
· miguelperez

Separating Procfile for development and production env

It is common to use a service like Foreman for managing services that run on your server.

Heroku lets you manage services with a Procfile.

The thing is that is usually a practice to have one such file for development and production.

Procfile

redis:  redis-server restart
resque: env bundle exec rake jobs:work
elasticsearch: elasticsearch -f
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
resque_scheduler: bundle exec rake resque:scheduler

Some of those services are not needed in heroku, and those will end up appearing as workers not used.

We are now doing this instead:

Procfile.dev

redis:  redis-server restart
resque: env bundle exec rake jobs:work
elasticsearch: elasticsearch -f
foreman: foreman start -f Procfile

Procfile

web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
resque_scheduler: bundle exec rake resque:scheduler

This way on heroku we will only see the workers that we use.

I got the idea from this post: http://stackoverflow.com/questions/11592798/use-different-procfile-in-development-and-production