Rails 4.1 AWS Beanstalk cannot find secret key base

你。 提交于 2019-12-21 05:42:56

问题


I am trying to upload my rails project on AWS Beanstalk.

I've already run eb init, eb start and configured the database settings to point to RDS. After I pushed using git aws.push and waited for AWS server to be started, the link provided says:

 "502 Bad Gateway nginx"

In the logs

-------------------------------------
/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)):

In my secrets.yml

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

回答1:


I did the following and solved the problem, but it feels kind of forced, like I missed a step somewhere.

  1. Go to elastic beanstalk -> application -> configuration -> software configuration

  2. Click on the gear button

  3. Enter a new environment variable

    SECRET_KEY_BASE   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    
  4. Save and wait for AWS server to restart



来源:https://stackoverflow.com/questions/23935113/rails-4-1-aws-beanstalk-cannot-find-secret-key-base

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!