ASP.NET Core app deploy to AWS Beanstalk using GitHub Actions

旧时模样 提交于 2020-07-23 06:49:13

问题


I am trying to build a CD pipeline using the GitHub Actions and AWS Beanstalk (Linux) for my ASP.NET Core 3.1 app. I have configured the YML file as follows:

- name: dotnet Build
  run: dotnet build src/SLNNAME.sln -c Release --no-restore

- name: dotnet Publish
  run: |
    dotnet publish src/SLNNAME.Server/SLNAME.Server.Web/SLNNAME.Server.Web.csproj -c Release -o staging_SLNNAME_server -r linux-x64

- name: Build deployment package
  run: zip -r staging-server-deploy.zip staging_SLNNAME_server

..

- name: Deploy to AWS Beanstalk
  uses: einaregilsson/beanstalk-deploy@v10
  with:
    aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
    aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
    region: ${{ secrets.AWS_REGION }}
    application_name: SLNNAME-staging-app-web
    environment_name: SLNNAME-staging-server
    version_label: "staging-app-web-${{ steps.format-time.outputs.replaced }}"
    deployment_package: staging-server-deploy.zip

But an error occurs during the deployment to AWS. In particular, looking at the Beanstalk logs I can read the following error:

[ERROR] An error occurred during execution of command [app-deploy] - [CheckProcfileForDotNetCoreApplication]. Stop running the command. Error: error stat /var/app/staging/staging_SLNNAME_server/SLNNAME.dll: no such file or directory with file /var/app/staging/staging_SLNNAME_server/SLNNAME.dll

Basically, I think it is looking for a DLL with the solution name instead of the project name - SLNName.Server.Web. I wonder yet where it is picking up the solution name, since it is not part of the zip file. I gave a try with the --self-contained flag as well, but the error is exactly the same.

I have this error even if I try to publish the solution using the AWS toolking Visual Studio extension.

The only way I have found to fix this is to change the project output DLL name to match the solution one, but it doesn't make any sense to me - I might have more problems in future.

Thanks


回答1:


Warning: This is a workaround, not a solution!

On the project that's failing to deploy, change the "Assembly name" in Project Properties / Application tab, to the name of the DLL it's missing (typically the solution name or the first period-separated part of the namespace).

i.e. "SLNNAME"

Then, redeploy your beanstalk app and it should work.




回答2:


I have opened a ticket on AWS platform and this issue has been stated as a bug by the support team.

They replied to me with:

I reached out to internal team and informed the team regarding the bug. [...] I have added your voice for this request I raised with internal team to add more weightage on the issue. Currently, I am unable to provide you with ETA [...] you can certainly be assured that the internal team is looking into this issue and fix it as quickly as possible

Hoping they will fix this soon as possible



来源:https://stackoverflow.com/questions/62810938/asp-net-core-app-deploy-to-aws-beanstalk-using-github-actions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!