我有一个 Flask/React webpp,我想将其部署到 Azure WebApp,但它失败了,没有明显的原因。我在
build
中有这样的 deploy
和 packages.json
设置:
"build": "react-scripts build",
"deploy": "cd api && az webapp up --sku P1v3",
并使用
yarn
调用它们,yarn deploy
完成得很好,没有错误,但 yarn deploy
给了我以下内容:
$ yarn deploy
yarn run v1.22.22
$ cd api && az webapp up --sku P1v3
/opt/az/lib/python3.11/site-packages/paramiko/pkey.py:100: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
"cipher": algorithms.TripleDES,
/opt/az/lib/python3.11/site-packages/paramiko/transport.py:259: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
"class": algorithms.TripleDES,
The webapp 'jolly-pond-9d2f840394224fd7b4137f53669b613e' doesn't exist
Creating Resource group 'ron.eggler_rg_0002' ...
Resource group creation complete
Creating AppServicePlan 'ron.eggler_asp_6962' or Updating if already exists
Readonly attribute name will be ignored in class <class 'azure.mgmt.web.v2023_01_01.models._models_py3.AppServicePlan'>
Creating webapp 'jolly-pond-9d2f840394224fd7b4137f53669b613e' ...
Configuring default logging for the app, if not already enabled
Creating zip with contents of dir /home/osboxes/src/azure_templates/dashboard/api ...
Getting scm site credentials for zip deployment
Starting zip deployment. This operation can take a while to complete ...
Deployment endpoint responded with status code 202
Polling the status of async deployment. Start Time: 2024-10-29 02:45:59.557048+00:00 UTC
Status: Building the app... Time: 1(s)
Status: Building the app... Time: 17(s)
Status: Build failed. Time: 33(s)
Deployment failed because the build process failed
Please check the build logs for more info: https://jolly-pond-9d2f840394224fd7b4137f53669b613e.scm.azurewebsites.net/api/deployments/01fad258-e3f2-4db3-a2f2-ac52dc35c12e/log
最后一行的日志文件没有表明有问题:
[{"log_time":"2024-10-29T02:46:02.9925098Z","id":"1b29b2fc-1edf-4053-8583-93eeba0a82ba","message":"Updating submodules.","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:04.1256585Z","id":"3aeb84e7-7277-4c9c-bcee-5c72532496cc","message":"Preparing deployment for commit id '01fad258-e'.","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:04.4346827Z","id":"9becdf04-b5fa-4a71-b120-862fe5852303","message":"PreDeployment: context.CleanOutputPath False","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:04.5562813Z","id":"e76ee2a2-4fe4-4889-bae0-75d95e125b53","message":"PreDeployment: context.OutputPath /home/site/wwwroot","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:04.7479159Z","id":"94b2f80d-f810-4ffa-9ca2-98f28615b052","message":"Repository path is /tmp/zipdeploy/extracted","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:04.8470532Z","id":"79f3192d-0cea-43d5-9aba-f8ae4802309b","message":"Running oryx build...","type":0,"details_url":"https://jolly-pond-9d2f840394224fd7b4137f53669b613e.scm.azurewebsites.net/api/deployments/01fad258-e3f2-4db3-a2f2-ac52dc35c12e/log/79f3192d-0cea-43d5-9aba-f8ae4802309b"}]
这些日志中引用的日志文件也没有:
[{"log_time":"2024-10-29T02:46:04.866859Z","id":"","message":"Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.10 -p virtualenv_name=antenv --log-file /tmp/build-debug.log -i /tmp/8dcf7c3d4f04a76 --compress-destination-dir | tee /tmp/oryx-build.log","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:05.6255635Z","id":"","message":"Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:05.6469473Z","id":"","message":"You can report issues at https://github.com/Microsoft/Oryx/issues","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:05.6589661Z","id":"","message":"","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:05.6727889Z","id":"","message":"Oryx Version: 0.2.20240424.1, Commit: d37b2225a252ab2c04b4726024d047cf01ea1318, ReleaseTagName: 20240424.1","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:05.6841286Z","id":"","message":"","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:05.6938606Z","id":"","message":"Build Operation ID: dde9811847b99798","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:05.7048847Z","id":"","message":"Repository Commit : 01fad258-e3f2-4db3-a2f2-ac52dc35c12e","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:05.7177738Z","id":"","message":"OS Type : bullseye","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:05.7306011Z","id":"","message":"Image Type : githubactions","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:05.7435001Z","id":"","message":"","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:05.7531563Z","id":"","message":"Detecting platforms...","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:06.8728979Z","id":"","message":"Detected following platforms:","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:06.9052407Z","id":"","message":" python: 3.10.15","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:06.9278961Z","id":"","message":"Version '3.10.15' of platform 'python' is not installed. Generating script to install it...","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.0242166Z","id":"","message":"","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.0540251Z","id":"","message":"Using intermediate directory '/tmp/8dcf7c3d4f04a76'.","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.0793335Z","id":"","message":"","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.0897575Z","id":"","message":"Copying files to the intermediate directory...","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.1166965Z","id":"","message":"Done in 0 sec(s).","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.1325729Z","id":"","message":"","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.1457956Z","id":"","message":"Source directory : /tmp/8dcf7c3d4f04a76","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.1683034Z","id":"","message":"Destination directory: /home/site/wwwroot","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.1784144Z","id":"","message":"","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.1920042Z","id":"","message":"","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.201706Z","id":"","message":"Downloading and extracting 'python' version '3.10.15' to '/tmp/oryx/platforms/python/3.10.15'...","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:07.2112715Z","id":"","message":"Detected image debian flavor: bullseye.","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:08.1576423Z","id":"","message":"Downloaded in 1 sec(s).","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:08.1747759Z","id":"","message":"Verifying checksum...","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:08.1928186Z","id":"","message":"Extracting contents...","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:10.9485112Z","id":"","message":"performing sha512 checksum for: python...","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:11.4459116Z","id":"","message":"Done in 4 sec(s).","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:11.4579214Z","id":"","message":"","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:11.8853613Z","id":"","message":"image detector file exists, platform is python..","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:11.9975432Z","id":"","message":"OS detector file exists, OS is bullseye..","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:12.5675826Z","id":"","message":"Python Version: /tmp/oryx/platforms/python/3.10.15/bin/python3.10","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:12.5814083Z","id":"","message":"Creating directory for command manifest file if it does not exist","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:13.0326258Z","id":"","message":"Removing existing manifest file","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:13.0678387Z","id":"","message":"Python Virtual Environment: antenv","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:13.0786015Z","id":"","message":"Creating virtual environment...","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:18.26874Z","id":"","message":"Activating virtual environment...","type":0,"details_url":null},{"log_time":"2024-10-29T02:46:18.3113996Z","id":"","message":"Running pip install...","type":0,"details_url":null}]
顶部显示的第一个错误
Deployment failed because the build process failed
表明 Oryx 容器可能会失败,但我不确定在哪里或如何访问这些日志,有人可以帮我解决这个问题吗?
SCM_DO_BUILD_DURING_DEPLOYMENT=true
作为应用程序设置将激活 Oryx 在部署期间处理构建过程。不要依赖
az webapp up
,而是尝试使用 az webapp deploy
和 zip 文件手动打包和部署应用程序。
zip -r app.zip .
az webapp deploy --resource-group ron.eggler_rg_0002 --name jolly-pond-9d2f840394224fd7b4137f53669b613e --src-path app.zip
requirements.txt
和 React 的 package.json
中是否正确列出了所有 Python 和 JavaScript 依赖项。构建进程还会在
stdout
下生成 stderr
和 /LogFiles
日志,这些日志可以提供额外的线索,特别是当它们包含堆栈跟踪或系统错误时。
启用日志流以监控实时部署日志。
[
{"log_time":"2024-10-29T02:46:00.000Z","id":"1a29b2fc-1edf-4053-8583-93eeba0a82ba","message":"Updating submodules.","type":0},
{"log_time":"2024-10-29T02:46:01.000Z","id":"3beb84e7-7277-4c9c-bcee-5c72532496cc","message":"Preparing deployment for commit id '01fad258-e'.","type":0},
{"log_time":"2024-10-29T02:46:02.000Z","id":"9decdf04-b5fa-4a71-b120-862fe5852303","message":"Starting Oryx build...","type":0},
{"log_time":"2024-10-29T02:46:03.000Z","id":"6cf32d08-0bd4-47b6-9348-0e00a507e7cb","message":"Detected platform 'python' with version '3.10.15'.","type":0},
{"log_time":"2024-10-29T02:46:05.000Z","id":"d56f341a-2745-45f4-83a4-2a562f3b4c9e","message":"Installing 'python' version '3.10.15'.","type":0},
{"log_time":"2024-10-29T02:46:08.000Z","id":"b7d7a37a-43bf-4fa9-b432-b8ed4d39c6a9","message":"Python installed successfully.","type":0},
{"log_time":"2024-10-29T02:46:10.000Z","id":"a89e1b1b-df3c-4d07-a0e1-0f0ed8fa230b","message":"Creating virtual environment 'antenv'.","type":0},
{"log_time":"2024-10-29T02:46:15.000Z","id":"eb93d4e5-97f8-4e22-8674-3f36d0df65f1","message":"Virtual environment created and activated.","type":0},
{"log_time":"2024-10-29T02:46:20.000Z","id":"f98b2cf5-bf43-4ea4-8525-7b1e6f4eb1b7","message":"Running pip install from requirements.txt.","type":0},
{"log_time":"2024-10-29T02:46:30.000Z","id":"c99f5a10-aef4-431b-bb85-8d1c8e38c93c","message":"Successfully installed all dependencies.","type":0},
{"log_time":"2024-10-29T02:46:35.000Z","id":"dbc27f6a-dcf5-4d06-8f7a-b12a9a9b7b2c","message":"Copying files to deployment directory '/home/site/wwwroot'.","type":0},
{"log_time":"2024-10-29T02:46:40.000Z","id":"afbe2fa3-4d2f-4d0f-ae31-2cfa7e2cbd14","message":"Files copied successfully.","type":0},
{"log_time":"2024-10-29T02:46:45.000Z","id":"fa29a2fc-1edf-4053-8583-93eeba0a82bc","message":"Container started successfully. Application logs available at https://<your-app-name>.scm.azurewebsites.net/api/logs.","type":0},
{"log_time":"2024-10-29T02:46:50.000Z","id":"8ab14ed7-02e3-4e3d-987f-7c4e39a49b8e","message":"Your app is running and accessible at https://<your-app-name>.azurewebsites.net","type":0},
{"log_time":"2024-10-29T02:46:55.000Z","id":"da83b4f7-bf4b-4db2-92ba-92e5873491d9","message":"Health check passed: Container is running smoothly.","type":0},
{"log_time":"2024-10-29T02:47:00.000Z","id":"cb72cf34-2c12-4ed4-a3a3-79c3a8b1c1c9","message":"Deployment completed successfully. App is live.","type":0}
]