Cassiano Franco
Cassiano Franco

Reputation: 410

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!

Upvotes: 3

Views: 2820

Answers (1)

Cassiano Franco
Cassiano Franco

Reputation: 410

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

Upvotes: 2

Related Questions