LoginSignup
0
2

More than 3 years have passed since last update.

Capistranoでsecret_key_baseのエラー

Posted at

環境

  • Rails 5.2.1
  • Ruby 2.6.1
  • Capistrano3

問題

capistranoでデプロイをしようとした際に、デプロイしたアプリケーションにsecret_key_baseが設定されていないためエラーが発生する

解決法

config/deploy.rb


set :linked_files, fetch(:linked_files, []).push('config/credentials.yml.enc')
set :linked_files, fetch(:linked_files, []).push('config/master.key')

namespace :deploy do
  # サーバーにファイルをアップロードする
  task upload_file: [:set_rails_env] do
    on roles(:app) do |host|
      upload!('config/master.key', "#{shared_path}/config/master.key")
      upload!('config/credentials.yml.enc', "#{shared_path}/config/credentials.yml.enc")
      execute 'echo "credentials.yml.enc upload!!"'
    end
  end
end

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2