AWS弹性beantalk部署始终失败(上传zipfile)

问题描述 投票:0回答:1

我将我的应用程序的新版本作为zip文件上传,然后单击部署。然后状态变为严重。

这是错误跟踪:

WARN
Environment health has transitioned from Info to Degraded. Command failed on all instances. Incorrect application version found on all instances. Expected version "Sample" (deployment 2). Application update failed 10 seconds ago and took 4 minutes.

ERROR
During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.

ERROR
Failed to deploy application.

ERROR
Unsuccessful command execution on instance id(s) 'i------'. Aborting the operation.

ERROR
[Instance: i-002326d7ceeba0ea9] Command failed on instance. Return code: 
1 Output: nginx: [emerg] no host in upstream ":80" in /etc/nginx/conf.d/elasticbeanstalk-nginx-docker-upstream.conf:
2 nginx: configuration file /etc/nginx/nginx.conf test failed Failed to start nginx, abort deployment. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/enact/01flip.sh failed. 
For more detail, check /var/log/eb-activity.log using console or EB CLI.

ERROR
Failed to start nginx, abort deployment

/ var / log / eb-activity.log这是此日志中的错误:

[0mInstalling dependencies from Pipfile.lock (5e00f3)…
  Failed to load paths: /bin/sh: 1: /root/.local/share/virtualenvs/app-lp47FrbD/bin/python: not found
...
[2020-05-29T01:51:24.746Z] INFO  [11395] - [Application update v1.3.3-1@3/AppDeployStage1/AppDeployEnactHook/00run.sh] : Completed activity. Result:
  jq: error (at <stdin>:1): Cannot iterate over null (null)
  a2f568b1c255eb9e0fdc6ceebdd29b9ec64b9ab4481a3e1c5bcb11828b0ac526
[2020-05-29T01:51:24.747Z] INFO  [11395] - [Application update v1.3.3-1@3/AppDeployStage1/AppDeployEnactHook/01flip.sh] : Starting activity...
[2020-05-29T01:51:26.099Z] INFO  [11395] - [Application update v1.3.3-1@3/AppDeployStage1/AppDeployEnactHook/01flip.sh] : Activity execution failed, because: nginx: [emerg] no host in upstream ":80" in /etc/nginx/conf.d/elasticbeanstalk-nginx-docker-upstream.conf:2
  nginx: configuration file /etc/nginx/nginx.conf test failed
  Failed to start nginx, abort deployment (ElasticBeanstalk::ExternalInvocationError)
caused by: nginx: [emerg] no host in upstream ":80" in /etc/nginx/conf.d/elasticbeanstalk-nginx-docker-upstream.conf:2
  nginx: configuration file /etc/nginx/nginx.conf test failed
  Failed to start nginx, abort deployment (Executor::NonZeroExitStatus)
...
[2020-05-29T01:51:26.099Z] INFO  [11395] - [Application update v1.3.3-1@3/AppDeployStage1/AppDeployEnactHook/01flip.sh] : Activity failed.
[2020-05-29T01:51:26.099Z] INFO  [11395] - [Application update v1.3.3-1@3/AppDeployStage1/AppDeployEnactHook] : Activity failed.
[2020-05-29T01:51:26.099Z] INFO  [11395] - [Application update v1.3.3-1@3/AppDeployStage1] : Activity failed.
[2020-05-29T01:51:26.100Z] INFO  [11395] - [Application update v1.3.3-1@3] : Completed activity. Result:
  Application update - Command CMD-AppDeploy failed

经过多次尝试,甚至恢复到较旧的版本后,对于该环境而言,无法部署的能力始终如一。

python-3.x amazon-web-services amazon-elastic-beanstalk
1个回答
0
投票

[之后,我通过使用带有zipfile的本地docker映像隔离代码和错误消息来解决此问题。在docker之外的计算机上运行代码并没有发现任何问题,因为pip / pipenv部分缺少某些依赖关系。

本地docker测试步骤:

其中有一个Docker容器:

docker system prune

使用Dockerfile转到文件夹

docker image build -t <app_name>:<version_number> .

要在本地运行: (docker rm <app_name>首先,如果您已经从先前的测试中获得了一个停止使用的同名容器)

docker container run --publish 80:80 --name <app_name> myapp:1.0

注意: 这不会让您测试需要环境变量的AWS函数,例如〜.aws凭证,因为它们不在映像中。 (但您可以将其与Dockerfile一起添加)

一旦Docker容器运行,您将看到(我看到)在本地测试时不存在的错误消息,因为它们是由缺少软件包依赖项和pipenv错误引起的。

© www.soinside.com 2019 - 2024. All rights reserved.