0

I am using a Procfile for some of my dynos on Heroku, but I have different commands for both my local development and the Heroku production environment.

But given that I have one Procfile, how do I add a conditional to the check to see if the local rails environment is production or development?

Is that even possible?

marcamillion
  • 32,933
  • 55
  • 189
  • 380

1 Answers1

1

You have a couple of options here.

  1. Use a different Procfile for development. If you had say Procfile.development then you can specify to use it with heroku local -f Procfile.development.

  2. Alternatively, switch to using config vars for your resque setting.

eg, with a Procfile as:

resque: env TERM_CHILD=1 RESQUE_TERM_TIMEOUT=7 QUEUE=\* bundle exec rake resque:work

change it to:

resque: env TERM_CHILD=$TERM_CHILD RESQUE_TERM_TIMEOUT=$TERM_TIMEOUT QUEUE=\* bundle exec rake resque:work

and then set TERM_CHILD and TERM_TIMEOUT config vars.

Locally you'd set them in your .env or on Heroku via:

 heroku config:set TERM_CHILD=1 TERM_TIMEOUT=7
John Beynon
  • 37,398
  • 8
  • 88
  • 97
  • I actually don't use `heroku local`. How would I specify to use `Procfile.development` if I am using just my regular `rails s` and foreman, etc.? – marcamillion Feb 25 '16 at 05:54
  • `heroku local` is just a wrapper onto `forego` - a Go implementation of foreman, just do `foreman start -f Procfile.development` and it will work. – John Beynon Feb 25 '16 at 08:19