Docker for Rails Developers: Notes for Rails 6.1, Ruby 2.7.2

  • p. 146 With Rails 6, there’s a new way to handle secrets. Instead of defining SECRET_KEY_BASE, you’ll need to define RAILS_MASTER_KEY.
    1. Run bin/rails credentials:edit and save the result. This will create the value of an encryption key in config/master.key and an encrypted secrets file in config/credentials.yml.enc.
    2. Copy the value of the encryption key in config/master.key to the RAILS_MASTER_KEY environment variable in .env/production/web. (SECRET_KEY_BASE is obsolete–don’t define it.)
3 Likes