I have a Rails (4.2.1) app that I am deploying to a VPS via Capistrano. I have set the environment variable SECRET_KEY_BASE on the server (in the /etc/environment file). When I run "env" on the server I am able to view the SECRET_KEY_BASE record...
SECRET_KEY_BASE=fa091be2d168da5f943a0a83f9b2...
I have other variables saved in this file as well, such as database username, password, etc. All of these variables are visible when I run "env" on the server.
I have my secrets.yml file set up with the default setting of:
production:
secret_key_base: <%= ENV['SECRET_KEY_BASE'] %>
Again, I am using environment variables elsewhere... such as my database.yml file:
default: &default
adapter: postgresql
encoding: unicode
pool: 5
username: <%= ENV['PSQL_DATABASE_USERNAME'] %>
password: <%= ENV['PSQL_DATABASE_PASSWORD'] %>
When I cap deploy the application, I receive a message stating "Incomplete response received from application". Per review of SO and other sites, I tried to run 'rake secret' on the box and restart the app. Doing this fixed my issue. Oddly enough, all of my database connections and all other references to my ENV variables are working, but for some reason secret_key_base will not accept my ENV variable. As soon as I cap deploy again, my secret key base is wiped out and I'm stuck having to manually SSH the server and 'rake secret' again.
Can anyone help me identify what I'm missing here? I'm racking my brain and scouring the web and can't seem to find my solution.