如何在AWS上生成丢失的secret_key_base

问题描述 投票:0回答:1

我正在尝试使用AWS EB CLI在生产中启动Rails 6.0.2.1和Ruby 2.6.5应用程序,但是,我仍然遇到此问题。我尝试了Google搜索结果的前两页中存在的所有解决方案,但均无济于事。

这些是我的错误日志:

ruby-2.0.0-p648
  ruby-2.1.10
  ruby-2.2.10
  ruby-2.3.8
  ruby-2.4.9
  ruby-2.5.7
  ruby-2.6.5
  ruby-current ]]
  +++ RUBIES+=("$dir"/*)
  +++ for dir in '"$PREFIX/opt/rubies"' '"$HOME/.rubies"'
  +++ [[ -d /.rubies ]]
  +++ unset dir
  +++ cat /etc/elasticbeanstalk/.ruby_version
  ++ chruby 2.6.5
  ++ case "$1" in
  ++ local dir match
  ++ for dir in '"${RUBIES[@]}"'
  ++ dir=/opt/rubies/ruby-1.9.3-p551
  ++ case "${dir##*/}" in
  ++ for dir in '"${RUBIES[@]}"'
  ++ dir=/opt/rubies/ruby-2.0.0-p648
  ++ case "${dir##*/}" in
  ++ for dir in '"${RUBIES[@]}"'
  ++ dir=/opt/rubies/ruby-2.1.10
  ++ case "${dir##*/}" in
  ++ for dir in '"${RUBIES[@]}"'
  ++ dir=/opt/rubies/ruby-2.2.10
  ++ case "${dir##*/}" in
  ++ for dir in '"${RUBIES[@]}"'
  ++ dir=/opt/rubies/ruby-2.3.8
  ++ case "${dir##*/}" in
  ++ for dir in '"${RUBIES[@]}"'
  ++ dir=/opt/rubies/ruby-2.4.9
  ++ case "${dir##*/}" in
  ++ for dir in '"${RUBIES[@]}"'
  ++ dir=/opt/rubies/ruby-2.5.7
  ++ case "${dir##*/}" in
  ++ for dir in '"${RUBIES[@]}"'
  ++ dir=/opt/rubies/ruby-2.6.5
  ++ case "${dir##*/}" in
  ++ match=/opt/rubies/ruby-2.6.5
  ++ for dir in '"${RUBIES[@]}"'
  ++ dir=/opt/rubies/ruby-current
  ++ case "${dir##*/}" in
  ++ [[ -z /opt/rubies/ruby-2.6.5 ]]
  ++ shift
  ++ chruby_use /opt/rubies/ruby-2.6.5 ''
  ++ [[ ! -x /opt/rubies/ruby-2.6.5/bin/ruby ]]
  ++ [[ -n '' ]]
  ++ export RUBY_ROOT=/opt/rubies/ruby-2.6.5
  ++ RUBY_ROOT=/opt/rubies/ruby-2.6.5
  ++ export RUBYOPT=
  ++ RUBYOPT=
  ++ export PATH=/opt/rubies/ruby-2.6.5/bin:/opt/elasticbeanstalk/lib/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
  ++ PATH=/opt/rubies/ruby-2.6.5/bin:/opt/elasticbeanstalk/lib/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
  +++ /opt/rubies/ruby-2.6.5/bin/ruby -
  ++ eval 'export RUBY_ENGINE=ruby;
  export RUBY_VERSION=2.6.5;
  export GEM_ROOT="/opt/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0";'
  +++ export RUBY_ENGINE=ruby
  +++ RUBY_ENGINE=ruby
  +++ export RUBY_VERSION=2.6.5
  +++ RUBY_VERSION=2.6.5
  +++ export GEM_ROOT=/opt/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0
  +++ GEM_ROOT=/opt/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0
  ++ ((  0 != 0  ))
  + cd /var/app/ondeck
  + su -s /bin/bash -c 'bundle exec /opt/elasticbeanstalk/support/scripts/check-for-rake-task.rb assets:precompile' webapp
  `/home/webapp` is not a directory.
  Bundler will use `/tmp/bundler20200229-17441-1xumk3r17441' as your home directory temporarily.
  + '[' false == true ']'
  + su -s /bin/bash -c 'bundle exec rake assets:precompile' webapp
  `/home/webapp` is not a directory.
  Bundler will use `/tmp/bundler20200229-17445-s2fu1t17445' as your home directory temporarily.
  rake aborted!
  ArgumentError: Missing `secret_key_base` for 'production' environment, set this string with `rails credentials:edit`
  /var/app/ondeck/config/environment.rb:5:in `<main>'
  /opt/rubies/ruby-2.6.5/bin/bundle:23:in `load'
  /opt/rubies/ruby-2.6.5/bin/bundle:23:in `<main>'
  Tasks: TOP => environment
  (See full trace by running task with --trace) (Executor::NonZeroExitStatus)


[2020-02-29T14:56:22.022Z] INFO  [3700]  - [Application update app-61df-200229_165115@2/AppDeployStage0/AppDeployPreHook/11_asset_compilation.sh] : Activity failed.
[2020-02-29T14:56:22.022Z] INFO  [3700]  - [Application update app-61df-200229_165115@2/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2020-02-29T14:56:22.022Z] INFO  [3700]  - [Application update app-61df-200229_165115@2/AppDeployStage0] : Activity failed.
[2020-02-29T14:56:22.023Z] INFO  [3700]  - [Application update app-61df-200229_165115@2] : Completed activity. Result:
  Application update - Command CMD-AppDeploy failed

我尝试设置master.key,尝试通过ENV设置secret_base_key,但均无效。

尽管使用master.key推送了我的环境,但它从未在我的SSH环境中持续存在。

[我也无法在我的SSH环境中运行rails credentials:edit,然后在本地运行它,然后将其部署到生产中,则无济于事,更改不会在SSH服务器中持久存在,尽管所有设置正确,也不会生成master.key。] >

我已经坚持了四天,并且好奇是否应该转移到另一个平台,也许是Heroku或Google?

我正在尝试使用AWS EB CLI在生产中启动Rails 6.0.2.1和Ruby 2.6.5应用程序,但是,我仍然遇到此问题。我已经尝试了前两个中存在的每个解决方案...

ruby-on-rails ruby linux amazon-web-services amazon-elastic-beanstalk
1个回答
0
投票

有两种不同的方法可以设置SECRET_KEY_BASE配置变量。

© www.soinside.com 2019 - 2024. All rights reserved.