Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.net core 5 webapi on loadBalanced EB Linux #77

Open
loviji opened this issue Dec 18, 2021 · 1 comment
Open

.net core 5 webapi on loadBalanced EB Linux #77

loviji opened this issue Dec 18, 2021 · 1 comment

Comments

@loviji
Copy link

loviji commented Dec 18, 2021

Getting an error while deploying .net core 5 web api to LoadBalanced Elastic Beanstalk Environment.

GitHub Action configuration:

name: deploy-to-eb
on:
  push:
    branches: [ master ]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup dotnet
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: '5.0.404' # Check for latest at link at .NET 5 download page
      - name: Install dependencies
        run: dotnet restore
      - name: Build
        run: dotnet build --configuration Release --no-restore
      - name: Test
        run: dotnet test --no-restore --verbosity normal
      - name: Publish
        run: dotnet publish -c Release -o '${{ github.workspace }}/out'
      - name: Generate deployment package
        #run: zip -r deploy.zip . -x '*.git*'
        run: | 
         cd ${{ github.workspace }}/out 
         zip -r ${{ github.workspace }}/deploy_package.zip *
      - name: Deploy new ElasticBeanstalk Application Version
        uses: einaregilsson/beanstalk-deploy@v19
        with:
         aws_access_key: ${{ secrets.ACCESS_KEY_ID }}
         aws_secret_key: ${{ secrets.SECRET_ACCESS_KEY }}
         application_name: APPName
         environment_name: ENVName
         version_label: ver-${{ github.sha }}
         region: eu-central-1
         deployment_package: deploy_package.zip
         existing_bucket_name: appname-stage-s3-github-bucket

STEP information from github action log:

Run einaregilsson/beanstalk-deploy@v19
  with:
    aws_access_key: ***
    aws_secret_key: ***
    application_name: APPName
    environment_name: ENVName
    version_label: ver-c4e1fa456a2e868da27f0c0a033784a84c09b655
    region: eu-central-1
    deployment_package: deploy_package.zip
    existing_bucket_name: appname-stage-s3-github-bucket
  env:
    DOTNET_ROOT: /home/runner/.dotnet
Beanstalk-Deploy: GitHub Action for deploying to Elastic Beanstalk.
https://github.com/einaregilsson/beanstalk-deploy

 ***** Input parameters were: ***** 
         Application: APPName
         Environment: ENVName
       Version Label: ver-c4e1fa456a2e868da27f0c0a033784a84c09b655
 Version description: 
          AWS Region: eu-central-1
                File: deploy_package.zip
Existing bucket Name: appname-stage-s3-github-bucket
      AWS Access Key: 20 characters long, starts with A
      AWS Secret Key: 40 characters long, starts with t
 Wait for deployment: true
  Recovery wait time: 30

Uploading file to bucket appname-stage-s3-github-bucket
New build successfully uploaded to S3, bucket=appname-stage-s3-github-bucket, key=/APPName/ver-c4e1fa456a2e868da27f0c0a033784a84c09b655.zip
Created new application version ver-c4e1fa456a2e868da27f0c0a033784a84c09b655 in Beanstalk.
Starting deployment of version ver-c4e1fa456a2e868da27f0c0a033784a84c09b655 to environment ENVName
Deployment started, "wait_for_deployment" was true...

21:20:00 INFO: Environment update is starting.
21:20:06 INFO: Deploying new version to instance(s).
21:20:10 INFO: Instance deployment found a runtime-dependent .NET Core application in your source bundle.
21:20:13 ERROR: Instance deployment failed. For details, see 'eb-engine.log'.
21:20:17 ERROR: [Instance: i-011*******625] Command failed on instance. Return code: 1 Output: Engine execution has encountered an error..
21:20:17 INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
21:20:17 ERROR: Unsuccessful command execution on instance id(s) 'i-011*******625'. Aborting the operation.
21:20:17 ERROR: Failed to deploy application.
21:20:17 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.
21:20:22 ERROR: Deployment failed! Current State: Version: myapi-recipeapplicationversion145c922c-w39ki1q0u1ll, Health: Red, Health Status: Severe
Error: Deployment failed: Error: Deployment failed! Current State: Version: myapi-recipeapplicationversion145c922c-w39ki1q0u1ll, Health: Red, Health Status: Severe

/var/log/eb-engine.log

2021/12/18 20:23:43.168706 [INFO] Running command /bin/sh -c systemctl show -p ConsistsOf eb-app.target | cut -d= -f2
2021/12/18 20:23:43.172706 [INFO] web.service

2021/12/18 20:23:43.172844 [ERROR] update processes [web cfn-hup nginx healthd] pid symlinks failed with error Read pid source file /var/pids/web.pid failed with error:open /var/pids/web.pid: no such file or directory
2021/12/18 20:23:43.172854 [ERROR] An error occurred during execution of command [app-deploy] - [Track pids in healthd]. Stop running the command. Error: update processes [web cfn-hup nginx healthd] pid symlinks failed with error Read pid source file /var/pids/web.pid failed with error:open /var/pids/web.pid: no such file or directory 

2021/12/18 20:23:43.172857 [INFO] Executing cleanup logic
2021/12/18 20:23:43.172974 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment found a runtime-dependent .NET Core application in your source bundle.","timestamp":1639859020,"severity":"INFO"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1639859023,"severity":"ERROR"}]}]}

2021/12/18 20:23:43.174462 [INFO] Platform Engine finished execution on command: app-deploy

2021/12/18 20:24:47.722457 [INFO] Starting...
2021/12/18 20:24:47.722509 [INFO] Starting EBPlatform-PlatformEngine
2021/12/18 20:24:47.722523 [INFO] reading event message file
2021/12/18 20:24:47.722601 [INFO] no eb envtier info file found, skip loading env tier info.
2021/12/18 20:24:47.722659 [INFO] Engine received EB command cfn-hup-exec

2021/12/18 20:24:47.803676 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-central-1:**********:stack/awseb-e-********-stack/39****20-****-11ec-8ec1-********-r AWSEBAutoScalingGroup --region eu-central-1
2021/12/18 20:24:48.110976 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-central-1:**********:stack/awseb-e-********-stack/39****20-****-11ec-8ec1-*********-r AWSEBBeanstalkMetadata --region eu-central-1
2021/12/18 20:24:48.391320 [INFO] checking whether command tail-log is applicable to this instance...
2021/12/18 20:24:48.391333 [INFO] this command is applicable to the instance, thus instance should execute command
2021/12/18 20:24:48.391336 [INFO] Engine command: (tail-log)

2021/12/18 20:24:48.391381 [INFO] Executing instruction: GetTailLogs
2021/12/18 20:24:48.391384 [INFO] Tail Logs...
2021/12/18 20:24:48.391590 [INFO] Running command /bin/sh -c tail -n 100 /var/log/eb-engine.log

When I deployed from Visual Studio to AWS EB everything is fine. But I get error when use GitHub Action method for automate deploying process

@einaregilsson
Copy link
Collaborator

What if you use the eb command line tool? Does that work also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant