I'm writing a little issue tracking application, and as it's a new app I'm using the new shiny Rails 4.1.0. However, whilst the application runs fine locally using Webrick I've been unable to get it working when deployed onto a live (staging) environment running Passenger and Nginx (using the Ubuntu package available via the Phusion Passenger site).
When deployed and configured, Nginx reports a 502 Bad Gateway exception. Digging throught the Nginx error log (in /var/log/nginx), the error becomes clear:
Exception RuntimeError in Rack application object (Missing secret_key_base for 'production' environment, set this value in
Opening secrets.yml shows that there is no value for production:
# Do not keep production secrets in the repository,
# instead read values from the environment.
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
You can either set an environment variable, or directly configure a value here (you can run
to generate a key). Just make sure that if you do the latter, you've added secrets/yml to your .gitignore!