librelist archives

« back to archive

Nesta's draft functionality can break on heroku

Nesta's draft functionality can break on heroku

From:
Graham Ashton
Date:
2012-02-13 @ 15:18
I managed to publish an unfinished article to my feed this morning, 
because effectif.com is deployed on Heroku's cedar stack. How 
embarassing...

I'd marked the article as draft in the metadata, with:

  Flags: draft

In production Nesta will always hide draft pages. It checks whether it's 
running in production by querying the RACK_ENV environment variable, which
isn't setup properly on Heroku's cedar stack (it always thinks you're in 
development).

If you're deployed on an earlier stack (e.g. bamboo) RACK_ENV is 
configured correctly (I checked), and you don't need to do anything.

On cedar you can work around it by creating a Procfile in your project's 
root directory, that sets RACK_ENV properly. Here's mine:

$ cat Procfile
web: bundle exec thin start -R config.ru -e $RACK_ENV -p $PORT

You'll need to add thin to your Gemfile and re-run bundle if you're not 
already using thin (which isn't a bad idea anyway, to be honest).

There's a stackoverflow post about it here:


http://stackoverflow.com/questions/6975667/heroku-rack-env-says-development-on-thin-but-staging-on-unicorn

--
Graham Ashton
Founder, The Agile Planner
http://theagileplanner.com | @agileplanner | @grahamashton