如何在 Azure Web App 上运行二进制服务器?

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

我有一个在端口 8000 上运行的 Go 项目,我正在尝试在 Azure DevOps 上构建它,然后部署到 Linux Azure Web 应用程序。

但是当我尝试访问该页面时,它显示“:(应用程序错误”,并且在我的大多数尝试中基本错误显示“容器没有响应端口:8000 上的 HTTP ping”

开发运营

pool:

  name: Azure Pipelines

  timeoutInMinutes: 30



steps:



- task: GoTool@0

  displayName: 'Use Go 1.22.2'

  inputs:

    version: 1.22.2



- task: Go@0

  displayName: 'go get'

  inputs:

    arguments: '-d'

    workingDirectory: '$(System.DefaultWorkingDirectory)'



- task: Go@0

  displayName: 'go build'

  inputs:

    command: build

    arguments: '-ldflags="-s -w" -o build'

    workingDirectory: '$(System.DefaultWorkingDirectory)'



- task: ArchiveFiles@2

  displayName: 'Archive $(System.DefaultWorkingDirectory)/build'

  inputs:

    rootFolderOrFile: '$(System.DefaultWorkingDirectory)/build'

    includeRootFolder: false



- task: AzureRmWebAppDeployment@4

  displayName: 'Azure App Service Deploy: MyServerProject'

  inputs:

    azureSubscription: 'Visual Studio Enterprise: ...'

    appType: webAppLinux

    WebAppName: MyServerProject

    packageForLinux: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'

    RuntimeStack: 'DOTNETCORE|7.0'

    StartupCommand: 'my-server'

    AppSettings: '-PORT 8000 -WEBSITES_PORT 8000 -WEBSITES_CONTAINER_START_TIME_LIMIT 1800'

日志

2024-05-06T19:44:07.724140609Z    _____
2024-05-06T19:44:07.734185163Z   /  _  \ __________ _________   ____
2024-05-06T19:44:07.734190363Z  /  /_\  \\___   /  |  \_  __ \_/ __ \
2024-05-06T19:44:07.734193663Z /    |    \/    /|  |  /|  | \/\  ___/
2024-05-06T19:44:07.734196563Z \____|__  /_____ \____/ |__|    \___  >
2024-05-06T19:44:07.734199763Z         \/      \/                  \/
2024-05-06T19:44:07.734203064Z A P P   S E R V I C E   O N   L I N U X
2024-05-06T19:44:07.734206264Z
2024-05-06T19:44:07.734208964Z Documentation: http://aka.ms/webapp-linux
2024-05-06T19:44:07.734211764Z Dotnet quickstart: https://aka.ms/dotnet-qs
2024-05-06T19:44:07.734214564Z ASP .NETCore Version: 7.0.13
2024-05-06T19:44:07.734217364Z Note: Any data outside '/home' is not persisted
2024-05-06T19:44:09.748366682Z Starting OpenBSD Secure Shell server: sshd.
2024-05-06T19:44:10.140172606Z Starting periodic command scheduler: cron.
2024-05-06T19:44:10.149816058Z Running oryx create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -defaultAppFilePath /defaulthome/hostingstart/hostingstart.dll     -bindPort 8000 -bindPort2 '' -userStartupCommand 'my-server'
2024-05-06T19:44:10.341022895Z Could not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2024-05-06T19:44:10.369622450Z Could not find operation ID in manifest. Generating an operation id...
2024-05-06T19:44:10.369672950Z Build Operation ID: 054d28e9-d3b7-43b9-8e77-ea26b35fa7fd
2024-05-06T19:44:11.658474634Z
2024-05-06T19:44:11.658510434Z Agent extension
2024-05-06T19:44:11.658515034Z Before if loop >> DotNet Runtime
2024-05-06T19:44:11.670287898Z DotNet Runtime 7.0Writing output script to '/opt/startup/startup.sh'
2024-05-06T19:44:11.949309510Z Running user provided startup command...
2024-05-06T19:44:11.949361811Z my-server: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by my-server)
2024-05-06T19:44:11.949386711Z my-server: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by my-server)
2024-05-06T19:44:05.685Z INFO  - 7.0_20240321.5.tuxprod Pulling from appsvc/dotnetcore
2024-05-06T19:44:05.706Z INFO  -  Digest: sha256:***
2024-05-06T19:44:05.706Z INFO  -  Status: Image is up to date for 10.1.0.5:13209/appsvc/dotnetcore:7.0_20240321.5.tuxprod
2024-05-06T19:44:05.724Z INFO  - Pull Image successful, Time taken: 0 Seconds
2024-05-06T19:44:05.925Z INFO  - Starting container for site
2024-05-06T19:44:05.926Z INFO  - docker run -d --expose=8000 --name myserverproject_123312 -e WEBSITE_USE_DIAGNOSTIC_SERVER=true -e PORT=8000 -e WEBSITES_PORT=8000 -e WEBSITE_SITE_NAME=myserverProject -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=myserverproject.azurewebsites.net -e WEBSITE_INSTANCE_ID=*** -e HTTP_LOGGING_ENABLED=1 appsvc/dotnetcore:7.0_20240321.5.tuxprod my-server
2024-05-06T19:44:09.424Z INFO  - Initiating warmup request to container myserverproject_123312 for site myserverproject
2024-05-06T19:44:13.018Z ERROR - Container myserverproject_123312 for site myserverproject has exited, failing site start
2024-05-06T19:44:13.044Z ERROR - Container myserverproject_123312 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
2024-05-06T19:44:13.057Z INFO  - Stopping site myserverproject because it failed during startup.

这可能实现吗?如果是这样,我可能会错过什么?

azure-devops azure-web-app-service
1个回答
0
投票

根据您提供的日志,Docker镜像中的GLIBC版本可能存在兼容性问题。

2024-05-06T19:44:11.949361811Z my-server: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by my-server)
2024-05-06T19:44:11.949386711Z my-server: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by my-server)

你可以先检查这个问题Error /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found先解决问题,看看问题是否仍然存在。

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