简体   繁体   中英

Amazon Elastic Beanstalk .config for node 64bit & env

Here is an excerpt of my EB configuration file .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

then I do the normal thing:

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

Then after deploy is complete and in green state, looking inside the eb generated .elasticbeansalk/optionsettings.myapp-env file I found:

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

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

My environment variable was not set, the NodeCommand directive was not set, and the NodeVersion has been ignored. What gives, EB? How can it ignore certain directives and not others? Any ideas on what I'm doing wrong?


EDIT

according to this post , the JSON holding the environment variables is held here:

/opt/elasticbeanstalk/deploy/configuration/containerconfiguration

which means I can parse this fiel for the variables, but this is frustrating since it's supposed to be taken care of with the configuration file (otherwise why have one?). There still must be an issue with my configuration file, otherwise EB seems completely broken in this respect...

I've run into this problem as well. I believe there are 2 ways to solve it.

  1. Run "eb update" this should update your environment and hopefully grab the variables.

  2. Create a new env and deploy your code into that environment. Once everything is good then point dns at the new env and delete the old one.

Also I read somewhere (aws forum I believe) that if you update the env in the elastic beanstalk gui interface that those values will take precedence over anything you put in the source code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM