Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Fix "Missing secret_key_base for 'production' environment" Deploying With Capistrano Rails 5.2

I have to deploy a Rails API to AWS EC2.

I'm following this tutorial: https://gorails.com/deploy/ubuntu/18.04#ruby

But I'm getting stuck on:

01 $HOME/.rbenv/bin/rbenv exec rake db:migrate
01 rake aborted!
01 ArgumentError: Missing secret_key_base for 'production' environment, set this string with rails credentials:edit

when cap production deploy

How should I generate the key?

Where should I put it?

What I do I have to config to this get working?

Need details that I not finding anywhere.

Thanks in advance!

like image 879
Cassiano Franco Avatar asked Feb 01 '26 13:02

Cassiano Franco


1 Answers

Solved by rails new app

Copying master.key and credentials.yml.enc to my app

Commiting to repo

Added this line to config/deploy.rb:

set :linked_files, %w{config/master.key}

copy manualy the key to my ec2 on path/to/app/shared/config/master.key

And this problem was solved

like image 160
Cassiano Franco Avatar answered Feb 04 '26 03:02

Cassiano Franco



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!