I’m getting the error
App 2280 stderr: [ 2014-08-04 18:45:00.6935 2301/0x9a59598(Worker 1) utils.rb:72 ]: *** Exception RuntimeError in Rack application object (Missing secret_key_base for 'production' environment, set this value in config/secrets.yml) (process 2301, thread 0x9a59598(Worker 1)):
But I’m sure I’d run export SECRET_KEY_BASE=xxx
and ruby -e 'p ENV["SECRET_KEY_BASE"]'
. Have went through a page of Google search results. Not sure what else I’m missing.
Setup is as per title.
Side question. Is there anyway we can find back questions we’d asked? I found a solution to my pass problem but I have no idea how to get the question back.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
Rails default /config/secrets.yml looks like this:
It is OK to keep test and development secret key base in your (possibly public) codebase, however, the secret key on production should be set up within server environment. We are running Ubuntu 14.04, here is how we set up our SECRET_KEY_BASE environmental variable: ssh into your production server and run
sudo nano /etc/environment
. This will open the environment file in nano text editor. You need to add two lines at the bottom of this file:Where <rake secret> is the output you get when running
rake secret
in console (it will be a string of random characters just like # random string for development and test secret_key_base). Source /etc/environment or restart the server and test by runningecho $SECRET_KEY_BASE
.Make sure you are in development /testing.
Put this in virtual host configuration:
Worry about Secrets once you go production mode
Try adding it to
config/secrets.yml
:That’s not supported at the moment, however, it should be soon :) You can search for it until then (using the search bar at the very top of this page).