I see all answers for this solution but no worked for me.
1 - My configuration deploy is equal this tutorial by DigitalOcean (Capistrano 3, Nginx, and Puma), with deploy success, i have error in my web:
An unhandled lowlevel error occurred. The application logs may have details.
In log:
Rack app error: #< RuntimeError: Missing
secret_token
andsecret_key_base
for 'production' environment, set these values inconfig/secrets.yml
>
2 - In my droplet or VPN, I created variable with a key (rake secret
) in file ./bashrc
export SECRET_KEY_BASE=XXXXXX
The file /config/secrets.yml
is default
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
With this env variable, i checked than this worked (echo $SECRET_KEY_BASE
or printenv | grep SECRET_KEY_BASE
)
3 - After Puma and Nginx is restarted and this error not is solved, i not know what is best way to check or debug this error.
Does this tutorial does not work with this solution?
This is the proper way of handing capistrano env of rails using dotenv-rails gem. The method to use capistrano and env rails in explained in Using Environment Variables in Rails, Heroku, Capistrano