So on Ubuntu server I am getting this in my logs:
#<RuntimeError: Missing `secret_key_base` for 'production'
environment, set this value in `config/secrets.yml`>
/home/deploy/apps/project/shared/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:510:in `validate_secret_key_config!'
/home/deploy/apps/project/shared/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:247:in `env_config'```
My Browser:
An unhandled lowlevel error occurred. The application logs may have details.
My secrets.yml (in deploy/apps/project/current/config & deploy/apps/project/shared/config):
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
deploy.rb
...
namespace :deploy do
desc 'Rails Secrets'
task :secret do
on roles(:app) do
execute "export SECRET_KEY_BASE=`bundle exec rake secret`"
end
end
before :finishing, :secret
...
end
I have also tried manually adding the SECRET_KEY_BASE
in /etc/profile
. It is present when I type this command: printenv
(because I manually added it), but when logging out of root
it is not present anymore in printenv
.
The ENV variable is not present in the printenv
command. After I carry out a deployment (cap production deploy:initial
).
How do I resolve this error?