librelist archives

« back to archive

Nesta's draft functionality can break on heroku

Nesta's draft functionality can break on heroku

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

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 

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 -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:

Graham Ashton
Founder, The Agile Planner | @agileplanner | @grahamashton