【问题标题】:Amazon Elastic Beanstalk .config for node 64bit & env用于节点 64 位和环境的 Amazon Elastic Beanstalk .config
【发布时间】:2013-08-16 04:02:14
【问题描述】:

这是我的EB配置文件.ebextensions/app.config的摘录:

option_settings:
  - option_name: AWS_SECRET_KEY
    value: xxxxxxxxxx
  - option_name: AWS_ACCESS_KEY_ID
    value: xxxxxxxxxx
  - option_name: APP_ENV
    value: development
  - namespace: aws:elasticbeanstalk:container:nodejs
    option_name: ProxyServer
    value: nginx
  - namespace: aws:elasticbeanstalk:container:nodejs
    option_name: GzipCompression
    value: true
  - namespace: aws:elasticbeanstalk:container:nodejs
    option_name: NodeVersion
    value: 0.8.10
  - namespace: aws:elasticbeanstalk:container:nodejs
    option_name: NodeCommand
    value: npm start

commands:
  test_command: 
    command: echo $APPLICATION_ENV > /home/ec2-user/test.txt
    cwd: /home/ec2-user
    ignoreErrors: true

然后我做正常的事情:

$ git commit -am "wrote config file"
$ eb init
...
$ eb start
...
would you like to use the most recent commit [y/n] 
$ y

然后在部署完成并处于绿色状态后,查看我发现的eb 生成的.elasticbeansalk/optionsettings.myapp-env 文件:

[aws:elasticbeanstalk:application:environment]
PARAM1=
PARAM2=
PARAM3=
PARAM4=
PARAM5=

[aws:elasticbeanstalk:container:nodejs]
GzipCompression=false
NodeCommand=
NodeVersion=0.8.24
ProxyServer=nginx

我的环境变量未设置,NodeCommand 指令未设置,NodeVersion 已被忽略。什么给了,EB?它怎么能忽略某些指令而不是其他指令?关于我做错了什么有什么想法吗?


编辑

根据this post,保存环境变量的JSON保存在这里:

/opt/elasticbeanstalk/deploy/configuration/containerconfiguration

这意味着我可以解析这个字段的变量,但这很令人沮丧,因为它应该由配置文件处理(否则为什么要有一个?)。我的配置文件肯定还是有问题,否则EB在这方面似乎完全崩溃了……

【问题讨论】:

  • 我也遇到了同样的问题 :( 你找到解决方案了吗?

标签: node.js amazon-web-services amazon-elastic-beanstalk


【解决方案1】:

我也遇到过这个问题。我相信有两种方法可以解决它。

  1. 运行“eb update”,这应该会更新您的环境并希望获取变量。

  2. 创建一个新环境并将您的代码部署到该环境中。一切正常后,将 dns 指向新环境并删除旧环境。

我还在某处(我相信是 aws 论坛)读到,如果您在弹性 beanstalk gui 界面中更新 env,这些值将优先于您放入源代码中的任何内容。

【讨论】:

    猜你喜欢
    • 2015-07-30
    • 2013-08-15
    • 2015-07-13
    • 2020-10-29
    • 2014-08-20
    • 2021-03-21
    • 2015-07-20
    • 2019-09-16
    • 2016-07-30
    相关资源
    最近更新 更多