Elastic beanstalk with github action Deploy fails

Viewed 369

I try to Deloy my project via Gitaction. Gitaction works well.

It upload my source bundle in S3, and update my EB environment(It takes my source bundle from S3 to staging directory successfully)

I checked logs via EC2 which is connected to my EB

Ec2 succeed in downloading sourcebundle and unpacking it with pip install -r requirements.txt.

/var/app/staging/ there is my source file(source bundle unpacked)

But Like below event statement

It keep fail deploying it... (to be exact keep fail updating EB environment)

long shots I tried

  1. I terminated Ec2 and loadbalancer(integrated with my classic ELB(load balancer)) created new one for EB. and it fail updating environment, either

  2. I changed my source bundle name (actually my sourcebundle name changes everysecond(git.sha)

  3. remake application, environment and redeploy it . fails

I need some help... Below is details

++ summary Amazon Linux 2 my application is hooked in /var/app/staging successfully

but it fails to move in /var/app/current

I want to know which Elastic beanstalk engine script is in charge of copying var/app/staging to /var/app/current

(or validating it)

ElasticBeanstalk environment settings: Python 3.7 running on 64bit Amazon Linux 2/3.3.6

.github/workflow/main.yml

    name: PlayplzAction-deploy
on:
  push:
    branches: [ playplz/backend ]
jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Create ZIP deployment package
        run: zip -r deploy_package.zip ./

      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEYID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: ${{ secrets.AWS_REGION }}


      - name: Create env file
        run: |
          touch .env
          echo SECRET_KEY="${{ secrets.SECRET_KEY }}" >> .env
          echo VIMEO_SECRET_KEY = "${{ secrets.VIMEO_SECRET_KEY }}" >> .env
          echo DEBUG = "${{ secrets.DEBUG }}" >> .env
          echo DB_NAME= "${{ secrets.DB_NAME }}">> .env
          echo DB_USER= "${{ secrets.DB_USER }}">> .env
          echo DB_PASSWORD= "${{ secrets.DB_PASSWORD }}">> .env
          echo DB_HOST= "${{ secrets.DB_HOST }}">> .env
          echo DB_PORT= "${{ secrets.DB_PORT }}">> .env 
          echo AWS_ACCESS_KEYID= "${{ secrets.AWS_ACCESS_KEYID }}">> .env
          echo AWS_SECRET_ACCESS_KEY="${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> .env
          echo AWS_STORAGE_BUCKET_NAME="${{ secrets.AWS_STORAGE_BUCKET_NAME }}" >> .env
          echo AWS_REGION= "${{ secrets.AWS_REGION}}">> .env
          cat .env    

          
      - name: Upload package to S3 bucket
        run: aws s3 cp deploy_package.zip s3://playplz/gitaction/deploy-${{ github.sha }}.zip

      - name: Create new ElasticBeanstalk Application Version
        run: |
          aws elasticbeanstalk create-application-version \
          --application-name classic_DRF \
          --source-bundle S3Bucket="playplz",S3Key="gitaction/deploy-${{ github.sha }}.zip" \
          --version-label "ver-${{ github.sha }}" \
          --description "commit-sha-${{ github.sha }}"

      - name: Deploy new ElasticBeanstalk Application Version
        run: aws elasticbeanstalk update-environment --environment-name Classicdrf-env --version-label "ver-${{ github.sha }}"


      # - name: Generate deployment package
      #   run: zip -r deploy-${{ github.sha }}.zip . -x '*.git*'

      # - name: Beanstalk Deploy for app
      #   uses: einaregilsson/beanstalk-deploy@v18
      #   with:
      #     aws_access_key: ${{secrets.AWS_ACCESS_KEYID}}
      #     aws_secret_key: ${{secrets.AWS_SECRET_ACCESS_KEY}}
      #     application_name: PLAYPLZ_NEW
      #     environment_name: Playplznew-dev
      #     region: ${{secrets.AWS_REGION}}
      #     version_label: "ver-${{ github.sha }}"
      #     deployment_package: deploy-${{ github.sha }}.zip
      #     use_existing_version_if_available : "true"
      #     existing_bucket_name : playplz

EB ec2 /var/log/ enter image description here

EB ec2 /var/log/eb-engine.log enter image description here

enter image description here

0 Answers
Related