How do I share my master.key with capistrano deployment
After following the guide Deploy Ruby on Rails on ubuntu 18.04 I still have several problems with the app. Shows me the same error when rails can't find master.key and I'm not sure how .rb-envs works or how to share my master.key with deployment.
This is the error:
DEBUG [30e1aa26] NoMethodError: undefined method `[]' for nil:NilClass
DEBUG [30e1aa26] /home/ubuntu/oficinas/releases/20210907184538/config/database.yml:16:in `<main>'
and this is my database.yml
default: &default
adapter: postgresql
host: 127.0.0.1 #localhost
port: 5432
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
username: <%= Rails.application.credentials.db[:nombre_usuario] %>
password: <%= Rails.application.credentials.db[:password] %>
database: oficinas-desarrollo
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: oficinas-pruebas
production:
<<: *default
username: <%= Rails.application.credentials.db_produccion[:nombre_usuario] %>
password: <%= Rails.application.credentials.db_produccion[:password] %>
database: oficinas-produccion
In app-name/shared/config/ you can add your master.key
Then in Capistrano's deploy.rb add:
append :linked_files, "config/master.key"