3

我正在尝试在 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)):

在我的秘密.yml

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

1 回答 1

11

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

  1. 转到弹性beantalk->应用程序->配置->软件配置

  2. 点击齿轮按钮

  3. 输入新的环境变量

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

于 2014-05-29T13:56:01.227 回答