Spe*_* K. 3 ruby-on-rails heroku
我正在将 Heroku 与 Rails 6 和 Postgres 一起使用。我试图用来heroku open启动应用程序,但构建失败,这显示在日志中:
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
DEPRECATION WARNING: Including LoggerSilence is deprecated and will be removed in Rails 6.1. Please use `ActiveSupport::LoggerSilence` instead (called from <top (required)> at /tmp/build_9537ba0878cb8933c15686548eb3ccb5/config/application.rb:7)
Missing encryption key to decrypt file with. Ask your team for your master key and write it to /tmp/build_9537ba0878cb8933c15686548eb3ccb5/config/master.key or put it in the ENV['RAILS_MASTER_KEY'].
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app.
! Push failed
Run Code Online (Sandbox Code Playgroud)
我试图运行这两个链接中提到的一些命令,但似乎都不起作用:
https://github.com/rails/rails/issues/32947
向您的团队询问您的主密钥并将其放入 heroku 部署的 ENV["RAILS_MASTER_KEY"] 中
我还想知道这些工作流程是否特定于环境。
您需要将 rails 主密钥作为环境变量添加到heroku.
config/master.key文件中的主密钥复制到您的计算机中将主密钥添加heroku为环境变量
heroku config:set RAILS_MASTER_KEY=your-master-key
Run Code Online (Sandbox Code Playgroud)