【问题标题】:Rails 4.1 AWS Beanstalk cannot find secret key baseRails 4.1 AWS Beanstalk 找不到密钥库
【发布时间】:2014-07-19 01:31:24
【问题描述】:

我正在尝试在 AWS Beanstalk 上上传我的 rails 项目。

我已经运行了 eb init、eb start 并将数据库设置配置为指向 RDS。 在我使用 git aws.push 推送并等待 AWS 服务器启动后,提供的链接显示:

 "502 Bad Gateway nginx"

在日志中

-------------------------------------
/var/app/support/logs/passenger.log
-------------------------------------

App 6861 stderr: [ 2014-05-29 13:26:59.1308 6893/0x00000001e50050(Worker 1) utils.rb:68 ]: 
*** Exception RuntimeError in Rack application object (Missing `secret_key_base` for 
'production' environment, set this value in `config/secrets.yml`) (process 6893, thread 
0x00000001e50050(Worker 1)):

在我的 secrets.yml 中

# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

【问题讨论】:

    标签: amazon-web-services passenger amazon-elastic-beanstalk ruby-2.0 ruby-on-rails-4.1


    【解决方案1】:

    我做了以下并解决了问题,但感觉有点强迫,就像我在某个地方错过了一步。

    1. 进入 elastic beanstalk -> 应用程序 -> 配置 -> 软件配置

    2. 点击齿轮按钮

    3. 输入一个新的环境变量

      SECRET_KEY_BASE   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      
    4. 保存并等待 AWS 服务器重启

    【讨论】:

    • 也可以在命令行:eb setenv SECRET_KEY_BASE=foo
    • 创建环境时可能:eb create &lt;env name&gt; --envvars SECRET_KEY_BASE=foo
    猜你喜欢
    • 2014-08-25
    • 2019-05-10
    • 1970-01-01
    • 2017-12-25
    • 2020-01-17
    • 2016-12-11
    • 2015-05-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多