René Rodriguez Clavijo


3,240 Experience
25 Lessons Completed
1 Question Solved


Posted in 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: #localhost
  port: 5432
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

  <<: *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.
  <<: *default
  database: oficinas-pruebas

  <<: *default
  username: <%= Rails.application.credentials.db_produccion[:nombre_usuario] %>
  password: <%= Rails.application.credentials.db_produccion[:password] %>
  database: oficinas-produccion
logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.