Amazon Elastic Beanstalk .config for node 64bit&env
这里是我的EBconfiguration文件.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
我的环境variables没有设置,没有设置NodeCommand
指令, NodeVersion
被忽略。 EB给了什么? 如何忽略某些指令而不是其他指令? 任何想法,我做错了什么?
编辑
根据这篇文章 ,持有环境variables的JSON被保存在这里:
/opt/elasticbeanstalk/deploy/configuration/containerconfiguration
这意味着我可以为variablesparsing这个场景,但这是令人沮丧的,因为它应该被configuration文件照顾(否则为什么有一个?)。 我的configuration文件仍然有一个问题,否则EB在这方面似乎完全破碎…
我也遇到了这个问题。 我相信有两种方法可以解决这个问题。
-
运行“eb更新”这应该更新你的环境,并希望抓住variables。
-
创build一个新的env并将您的代码部署到该环境中。 一旦一切顺利,就把dns指向新的env并删除旧的。
另外我读了一个地方(aws论坛,我相信),如果你更新弹性beanstalk gui接口中的env,那些值将优先于你放在源代码中的任何东西。
- 如何在Elastic Beanstalk上使用私有的npmregistry?
- 无法findpackage.json。 Node.js可能有问题开始。 validationpackage.json是否有效,或将代码放在名为server.js或app.js的文件中
- 通过AWS SDK部署EB
- AWS – 通过npm install来安装bower组件
- AWS Elastic Beanstalk:加载本地模块会导致错误
- 在node.js中将http转发到https使用EBS和ELB环境表示应用程序
- parsing服务器云代码afterSave不工作在Elastic Beanstalk上
- 无法在EB CLI中设置CodeCommit
- 多个package.json Elastic Beanstalk部署