我正在尝试使用mina deploy在ec2实例上部署Rails 5.2.0 App,当它尝试迁移数据库时,它会因以下错误日志而中止。

    -----> Migrating database
       WARNING: Use strings for Figaro configuration. 2 was converted to "2".
       WARNING: Use strings for Figaro configuration. 5 was converted to "5".
       I, [2018-07-07T15:15:56.316810 #15933]  INFO -- sentry: ** [Raven] Raven 2.7.4 ready to catch errors
       I, [2018-07-07T15:15:56.579121 #15933]  INFO -- sentry: ** [Raven] Raven 2.7.4 ready to catch errors
       [Simple Form] Simple Form is not configured in the application and will use the default values. Use `rails generate simple_form:install` to generate the Simple Form configuration.
       rake aborted!
       ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:183:in `_decrypt'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:79:in `decrypt'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:42:in `read'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:21:in `read'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:33:in `config'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:38:in `options'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/core_ext/module/delegation.rb:271:in `method_missing'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:433:in `secret_key_base'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:176:in `key_generator'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/globalid-0.4.1/lib/global_id/railtie.rb:26:in `block (2 levels) in <class:Railtie>'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:51:in `each'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application/finisher.rb:75:in `block in <module:Finisher>'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
       /var/www/myApp.com/tmp/build-153097655127872/config/environment.rb:5:in `<main>'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:337:in `require_environment!'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:520:in `block in run_tasks_blocks'
       /var/www/myApp.com/tmp/build-153097655127872/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:74:in `load'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:28:in `run'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli.rb:424:in `exec'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli.rb:27:in `dispatch'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli.rb:18:in `start'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/exe/bundle:30:in `block in <top (required)>'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/exe/bundle:22:in `<top (required)>'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/bin/bundle:23:in `load'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/bin/bundle:23:in `<main>'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `eval'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `<main>'

       Caused by:
       ArgumentError: invalid base64
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:185:in `block in _decrypt'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:185:in `map'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:185:in `_decrypt'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:79:in `decrypt'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:42:in `read'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:21:in `read'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:33:in `config'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:38:in `options'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/core_ext/module/delegation.rb:271:in `method_missing'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:433:in `secret_key_base'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:176:in `key_generator'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/globalid-0.4.1/lib/global_id/railtie.rb:26:in `block (2 levels) in <class:Railtie>'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:51:in `each'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application/finisher.rb:75:in `block in <module:Finisher>'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
       /var/www/myApp.com/tmp/build-153097655127872/config/environment.rb:5:in `<main>'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:337:in `require_environment!'
       /var/www/myApp.com/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:520:in `block in run_tasks_blocks'
       /var/www/myApp.com/tmp/build-153097655127872/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:74:in `load'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:28:in `run'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli.rb:424:in `exec'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli.rb:27:in `dispatch'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/cli.rb:18:in `start'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/exe/bundle:30:in `block in <top (required)>'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/exe/bundle:22:in `<top (required)>'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/bin/bundle:23:in `load'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/bin/bundle:23:in `<main>'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `eval'
       /home/ubuntu/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `<main>'
       Tasks: TOP => db:migrate => db:load_config => environment
       (See full trace by running task with --trace)
 !     ERROR: Deploy failed.
-----> Cleaning up build
       Unlinking current
       OK

我的Rails应用程序中有有效的config/credentials.yml.encmaster.key 因为,我在本地计算机上尝试了RAILS_ENV='production' rails命令,即rails db:create,rails db:migrate等。

我已经在我的ubuntu服务器上的/ app_name / shared / config /上添加了master.key文件。 但是仍然遇到这个问题。

#1楼 票数:0

您需要将SECRET_KEY_BASE = 'Your_SECRET_KEY_BASE'添加到环境中!

我遇到了同样的问题。 相信我,按照https://blog.xuite.net/yhunglee/blog/585116240-Problems+of+deploying+rails+5.2.0+to+production可以解决此问题。

  ask by Akshay Borade translate from so

未解决问题?本站智能推荐:

8回复

Rails:ActiveSupport::MessageEncryptor::InvalidMessage

请帮助我,我已经完成了 Rails 教程的 11 章,将我的应用程序部署到 heroku(在本地运行良好)并且它一直崩溃。 我正在使用 rails 5.2.2 在执行命令 $heroku run rails console 后,我收到了这个: 此外,我已阅读本主题在本地生产中运行 rails 服
1回复

升级到 Rails 5.2.0,但没有创建 storage.yml

我按照本教程将现有应用程序升级到 rails 5.2.0。 在我的 gem 文件中包含 rails 5.2.0 并在本地安装之后,以及在 bundle update 和 bundle install and running 之后 然后rake db:migrate 我在我的应用程序中没有看到
1回复

Rails 5.2.0.rc1 + Webpacker 3.3.0无法找到dev_server配置

使用Docker和Docker Compose,升级到webpacker 3.3.0后,我无法启动并运行webpacker服务。 docker-compose up之后的输出为: 我已经运行了webpacker:install它进行了更改,但输出是相同的。 我还运行了rails ne
1回复

Rails从错误的位置自动加载文件

我看到很多 Rails 5.2.0应用程序中的错误。 我不明白的部分是,为什么它会出现在app/lib/ ,因为它被定义为在application.rb这样加载: 因此,我希望它可以从/lib (有问题的模块所在的位置)加载。 那么,为什么要在/app目录中查找它,以及如何更
1回复

获取Blob的网址时image / png的未知格式错误

我收到此错误: 当我尝试访问Blob的网址时。 我已将图像文件(.png)上传到活动存储中,并且可以在数据库和本地文件系统中看到它。 “ product.image.attached?” 返回true。 但是,当我尝试访问它(显示在页面上)时,出现上述错误。 我努力了:
1回复

升级到 rails 6 时出现依赖错误

我正在尝试按照以下说明从 rails 5.2 升级到 rails 6: https://blog.rubynetti.it/i/how-to-upgrade-to-rails-6-from-rails-5-2-1 当我运行bundle update ,我收到以下错误并且不知道如何修复它们。 我
1回复

在Rails中向种子文件添加JSON类型

我的迁移工作正常: 该记录已在users表中创建为JSON。 我遇到的问题是种子文件。 从种子文件: 运行rake时,出现以下错误: 我也尝试过: 同样的错误。 有任何想法吗?
1回复

Heroku-18 堆栈升级后无法部署我的 rails 项目

部署时出现此错误。 之后将 rails 升级到 5.2 并将 ruby​​ 升级到 2.5.1,同时升级 heroku 堆栈时我遇到了相同的错误。 请问有人对此有答案吗?