使用 Django 应用程序排查 AWS Elastic Beanstalk 部署错误 - 错误:EbExtension 构建失败

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

当我尝试将 Django 应用程序部署到 AWS Elastic Beanstalk 时。然后我得到了这个错误。

2023/12/30 21:26:42.478526 [ERROR] An error occurred during the execution of command [app-deploy] - [PreBuildEbExtension]. Stop running the command. Error: EbExtension build failed. Please refer to /var/log/cfn-init.log for more details. 

这是什么原因?

这是我的 Django.config,位于 .ebextensions 文件夹中。

当我删除“命令”时,它会给我 502 bad gateway,因为应用程序无法导入相关包。

commands:
  01_activate_virtualenv:
    command: "source /var/app/venv/staging-LQM1lest/bin/activate"
  02_install_requirements:
    command: "pip install -r /var/app/current/requirements.txt"

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: django-pixel/core/wsgi.py

django amazon-web-services yaml amazon-elastic-beanstalk django-deployment
1个回答
0
投票

Elastic Beanstalks 为部署的每个阶段保留许多日志文件。如果 .ebextensions 文件夹中出现任何错误,则需要检查 cfn-init.log。正如错误消息所说:

Please refer to /var/log/cfn-init.log for more details. 

您需要 ssh 进入您的 eb 实例并写下:

cat /var/log/cfn-init.log
才能查看它。更多详情请看
cfn-init-cmd.log

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