将环境变量添加到NodeJS Elastic Beanstalk的错误

Mar*_* S. 3 nginx amazon-web-services amazon-elastic-beanstalk

我的配置一直持续到昨天.我已经从AWS添加了nginx NodeJS https重定向扩展.现在,当我尝试通过Elastic Beanstalk配置添加新的环境变量时,我收到此错误:

[Instance: i-0364b59cca36774a0] Command failed on instance. Return code: 137 Output: + rm -f /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf + service nginx stop Stopping nginx: /sbin/service: line 66: 27395 Killed env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}. Hook /opt/elasticbeanstalk/hooks/configdeploy/post/99_kill_default_nginx.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
Run Code Online (Sandbox Code Playgroud)

当我查看eb-activity.log时,我看到了这个错误:

[2018-02-18T17:24:58.762Z] INFO  [13848] - [Configuration update 1.0.61@112/ConfigDeployStage1/ConfigDeployPostHook/99_kill_default_nginx.sh] : Starting activity...
[2018-02-18T17:24:58.939Z] INFO  [13848] - [Configuration update 1.0.61@112/ConfigDeployStage1/ConfigDeployPostHook/99_kill_default_nginx.sh] : Activity execution failed, because: + rm -f /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf
  + service nginx stop
  Stopping nginx: /sbin/service: line 66: 14258 Killed                  env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS} (ElasticBeanstalk::ExternalInvocationError)
caused by: + rm -f /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf
  + service nginx stop
  Stopping nginx: /sbin/service: line 66: 14258 Killed                  env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS} (Executor::NonZeroExitStatus)
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?最近发生了什么变化,因为几个月前我改变了一个环境变量就行了.

小智 8

我也有这个问题,亚马逊承认文档中的错误.这是一个可以在.ebextensions配置文件中使用的重启脚本.

  /opt/elasticbeanstalk/hooks/configdeploy/post/99_kill_default_nginx.sh:
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/bin/bash -xe
      rm -f /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf
      status=`/sbin/status nginx`

      if [[ $status = *"start/running"* ]]; then
        echo "stopping nginx..."
        stop nginx
        echo "starting nginx..."
        start nginx
      else
        echo "nginx is not running... starting it..."
        start nginx
      fi
Run Code Online (Sandbox Code Playgroud)