AWS Elasti c Ошибка Beanstalk: не удалось развернуть приложение - PullRequest
0 голосов
/ 14 апреля 2020

Я потратил много часов, чтобы решить мою проблему. Я использую CodePipeline : CodeSource , CodeBuild , который создает docker контейнер (код из Bitbucket) и сохраняет изображение в ECR .

В CodeDeploy Я хочу развернуть этот образ из ECR в Elasti c Beanstalk :

Ошибки в Elasti c Beanstalk:

Environment health has transitioned from Info to Degraded. Command failed on all instances. Incorrect application version found on all instances. Expected version "Sample Application" (deployment 6). Application update failed 15 seconds ago and took 59 seconds.

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.

Failed to deploy application.

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

Еще одна ошибка от EB:

Incorrect application version "code-pipeline-1586854202535-MyflashcardsBuildOutput-ce0d6cd7-8290-40ad-a95e-9c57162b9ff1" 
(deployment 9). Expected version "Sample Application" (deployment 8).

Ошибка в CodeDeploy:

Action execution failed
Deployment completed, but with errors: 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. Failed to deploy application. Unsuccessful command execution on instance id(s) 'i-04df539061522208a'. Aborting the operation. [Instance: i-04df549333582208a] Command failed on instance. An unexpected error has occurred [ErrorCode: 0000000001].

Кто-нибудь знает, что здесь происходит?

Я использую Dockerfile:

### STAGE 1: Build ###
FROM node:12.7-alpine AS build
WORKDIR /usr/src/app
COPY package.json ./
RUN npm install
COPY . .
RUN npm run build

### STAGE 2: Run ###
FROM nginx:1.17.1-alpine
EXPOSE 80
COPY --from=build /usr/src/app/dist /usr/share/nginx/html

и buildspe c .yml:

version: 0.2
phases:
  pre_build:
    commands:
      - echo Logging in to Amazon ECR...
      - aws --version
      - $(aws ecr get-login --region eu-west-1 --no-include-email)
      - REPOSITORY_URI=176901363719.dkr.ecr.eu-west-1.amazonaws.com/myflashcards
      - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
      - IMAGE_TAG=myflashcards
  build:
    commands:
      - echo Build started on `date`
      - echo Building the Docker image
      - docker build --tag $REPOSITORY_URI:latest .
  post_build:
    commands:
      - echo Build completed on `date`
      - echo Pushing the Docker images...
      - docker push $REPOSITORY_URI:latest
      - echo Writing image definitions file...
      - printf '[{"name":"eagle","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
#      - echo Deleting old artifacts
#      - aws s3 sync dist/ s3://$BUCKET_NAME --delete
artifacts:
  files: imagedefinitions.json

Третий шаг (CodeDeploy) завершается неудачно: (

1 Ответ

0 голосов
/ 01 мая 2020

То же самое, у меня есть API для сохранения файлов в моем хранилище.

Журнал из команды "eb deploy":

2020-05-01 16:42:44    INFO    Environment update is starting.      
2020-05-01 16:43:08    INFO    Deploying new version to instance(s).
2020-05-01 16:43:19    ERROR   [Instance: i-xxxxxxx9] Command failed on instance. An unexpected error has occurred [ErrorCode: 0000000001].
2020-05-01 16:43:19    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-05-01 16:43:19    ERROR   Unsuccessful command execution on instance id(s) 'i-xxxxxxxxx'. Aborting the operation.
2020-05-01 16:43:19    ERROR   Failed to deploy application.   

/ var / log / eb-engine.log

2020/05/01 16:24:33.128484 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:xxx:xxxxxxx:stack/xxx-e-xxx-xx/xxxx-xxxx-xx -r AWSEBAutoScalingGroup --region xxxxx --configsets Infra-EmbeddedPreBuild
2020/05/01 16:24:40.253953 [ERROR] Error occurred during build: Command atk failed

2020/05/01 16:24:40.253975 [ERROR] An error occurred during execution of command [app-deploy] - [PreBuildEbExtension]. Stop running the command. Error: EbExtension build failed. Please refer to /var/log/cfn-init.log for more details. 

2020/05/01 16:24:40.253980 [INFO] Executing cleanup logic
2020/05/01 16:24:40.254060 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[]}]}

2020/05/01 16:24:40.254233 [INFO] Platform Engine finished execution on command: app-deploy

...