Rails6アプリケーションをECSを利用してAWSにデプロイしようとしたところ
Dockerが立ち上がらず色々と問題解決を試みていますが上手くいきません。
ローカル環境では立ち上がります。
環境は
ruby '2.7.1'
Rails '6.0.3.4'
mysql '5.7'
となっており、ECRにストレージしているコンテナはRailsとNginxの2つのコンテナ構成としており、pumaとnginxをsocket通信させています。
デプロイはCircleCIのorbs: aws-ecr, aws-ecsを利用して、
aws-ecr/build-and-push-imageとaws-ecs/deploy-service-updateのjobを
railsとnginxそれぞれ計4job実行しています。
コンテナ立ち上げ失敗後のECSに設定したタスクのログに
ActiveSupport::MessageEncryptor::InvalidMessage:
のメッセージが見受けられたため同様のケースの問題解決方法を調べていたところ、credentials.yml.encとmaster.keyが合っていない場合に同様のエラーが生じる事が判明したため次の手順は試してみましたが、同様のエラーが出力され上手くいきませんでした。
① config/credentials.yml.enc, config/credentials/production.key, config/credentials/production.yml.encを削除
② bin/rails credentials:editでcredentials.yml.encの内容(secret_key_base)を更新
③ bin/rails credentials:edit --environment production でproduction.yml.encの内容(S3を利用しているためS3の登録情報access_key_idやsecret_access_key)を更新
お気づきになられた点や同様の問題の解決方法がご存知の方がいらっしゃいましたらご教示いただけませんでしょうか。
どうぞ宜しくお願いいたします。
Railsデプロイに関するタスクログ
2020-12-21 21:50:44ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/message_encryptor.rb:183:in `_decrypt' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/encrypted_file.rb:80:in `decrypt' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/encrypted_file.rb:43:in `read' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/encrypted_configuration.rb:21:in `read' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/encrypted_configuration.rb:33:in `config' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/encrypted_configuration.rb:38:in `options' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/delegation.rb:303:in `method_missing' 2020-12-21 21:50:44(erb):12:in `<main>' 2020-12-21 21:50:44/usr/local/lib/ruby/2.7.0/erb.rb:905:in `eval' 2020-12-21 21:50:44/usr/local/lib/ruby/2.7.0/erb.rb:905:in `result' 2020-12-21 21:50:44/usr/local/bundle/gems/activestorage-6.0.3.4/lib/active_storage/engine.rb:111:in `block (2 levels) in <class:Engine>' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:71:in `class_eval' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:51:in `each' 2020-12-21 21:50:44/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks' 2020-12-21 21:50:44/usr/local/bundle/gems/activestorage-6.0.3.4/app/models/active_storage/blob.rb:291:in `<main>' 2020-12-21 21:50:44/usr/local/bundle/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' 2020-12-21 21:50:44/usr/local/bundle/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' 2020-12-21 21:50:44/usr/local/bundle/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 2020-12-21 21:50:44/usr/local/bundle/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' 2020-12-21 21:50:44/usr/local/bundle/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' 2020-12-21 21:50:44/usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:26:in `require' 2020-12-21 21:50:44/usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:409:in `const_get' 2020-12-21 21:50:44/usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:409:in `block (2 levels) in eager_load' 2020-12-21 21:50:44/usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:733:in `block in ls' 2020-12-21 21:50:44/usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:725:in `foreach' 2020-12-21 21:50:44/usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:725:in `ls' 2020-12-21 21:50:44/usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:404:in `block in eager_load' 2020-12-21 21:50:44/usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:393:in `synchronize' 2020-12-21 21:50:44/usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:393:in `eager_load' 2020-12-21 21:50:44/usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:508:in `each' 2020-12-21 21:50:44/usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/loader.rb:508:in `eager_load_all' 2020-12-21 21:50:44/usr/local/bundle/gems/railties-6.0.3.4/lib/rails/application/finisher.rb:122:in `block in <module:Finisher>' 2020-12-21 21:50:44/usr/local/bundle/gems/railties-6.0.3.4/lib/rails/initializable.rb:32:in `instance_exec' 2020-12-21 21:50:44/usr/local/bundle/gems/railties-6.0.3.4/lib/rails/initializable.rb:32:in `run' 2020-12-21 21:50:44/usr/local/bundle/gems/railties-6.0.3.4/lib/rails/initializable.rb:61:in `block in run_initializers' 2020-12-21 21:50:44/usr/local/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each' 2020-12-21 21:50:44/usr/local/lib/ruby/2.7.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' 2020-12-21 21:50:44/usr/local/lib/ruby/2.7.0/tsort.rb:431:in `each_strongly_connected_component_from' 2020-12-21 21:50:44/usr/local/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component' 2020-12-21 21:50:44/usr/local/lib/ruby/2.7.0/tsort.rb:347:in `each' 2020-12-21 21:50:44/usr/local/lib/ruby/2.7.0/tsort.rb:347:in `call' 2020-12-21 21:50:44/usr/local/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component' 2020-12-21 21:50:44/usr/local/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each' 2020-12-21 21:50:44/usr/local/lib/ruby/2.7.0/tsort.rb:205:in `tsort_each' 2020-12-21 21:50:44/usr/local/bundle/gems/railties-6.0.3.4/lib/rails/initializable.rb:60:in `run_initializers' 2020-12-21 21:50:44/usr/local/bundle/gems/railties-6.0.3.4/lib/rails/application.rb:363:in `initialize!' 2020-12-21 21:50:44/app/config/environment.rb:5:in `<top (required)>' 2020-12-21 21:50:44config.ru:3:in `require_relative' 2020-12-21 21:50:44config.ru:3:in `block in <main>' 2020-12-21 21:50:44/usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval' 2020-12-21 21:50:44/usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string' 2020-12-21 21:50:44/usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file' 2020-12-21 21:50:44/usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file' 2020-12-21 21:50:44/usr/local/bundle/gems/puma-4.3.7/lib/puma/configuration.rb:321:in `load_rackup' 2020-12-21 21:50:44/usr/local/bundle/gems/puma-4.3.7/lib/puma/configuration.rb:246:in `app' 2020-12-21 21:50:44/usr/local/bundle/gems/puma-4.3.7/lib/puma/runner.rb:155:in `load_and_bind' 2020-12-21 21:50:44/usr/local/bundle/gems/puma-4.3.7/lib/puma/single.rb:98:in `run' 2020-12-21 21:50:44/usr/local/bundle/gems/puma-4.3.7/lib/puma/launcher.rb:172:in `run' 2020-12-21 21:50:44/usr/local/bundle/gems/puma-4.3.7/lib/puma/cli.rb:80:in `run' 2020-12-21 21:50:44/usr/local/bundle/gems/puma-4.3.7/bin/puma:10:in `<top (required)>' 2020-12-21 21:50:44/usr/local/bundle/bin/puma:23:in `load' 2020-12-21 21:50:44/usr/local/bundle/bin/puma:23:in `<top (required)>' 2020-12-21 21:50:44! Unable to load application: ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage 2020-12-21 21:50:44bundler: failed to load command: puma (/usr/local/bundle/bin/puma) 2020-12-21 21:49:44Puma starting in single mode... 2020-12-21 21:49:44* Version 4.3.7 (ruby 2.7.1-p83), codename: Mysterious Traveller 2020-12-21 21:49:44* Min threads: 5, max threads: 5 2020-12-21 21:49:44* Environment: production
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。