我最近将Django API后端部署到AWS EB上,部署在他们的Linux 2系统上(确切的平台名称是Python 3.7运行在64位Amazon Linux 2上
)。
几乎一切都按预期工作,但我的应用健康状态为严重
,经过数小时的调试后,我仍然不知道原因。
使用以下端点(django-health-check
模块)处理应用程序的健康检查。
url(r'^ht/', include('health_check.urls'))
所有请求的状态码都是200
,但我的整体健康状况如下:
|--------------------|----------------|---------------------------------------------------|
| instance-id | status | cause |
|--------------------|----------------|---------------------------------------------------|
| Overall | Degraded | Impaired services on all instances. |
| i-0eb89f... | Severe | Following services are not running: release. |
|--------------------|----------------|---------------------------------------------------|
/var/log/healthd/daemon.log
文件的内容,它的行类似于W, [2020-07-21T09:00:01.209091 #3467] WARN -- : log file "/var/log/nginx/healthd/application.log.2020-07-21-09" does not exist
时间改变的地方。
可能相关的最后一件事是我在.ebextensions
目录中的单个文件的内容:
option_settings:
"aws:elasticbeanstalk:application:environment":
DJANGO_SETTINGS_MODULE: "app.settings"
"PYTHONPATH": "/var/app/current:$PYTHONPATH"
"aws:elasticbeanstalk:container:python":
WSGIPath: app.wsgi:application
NumProcesses: 3
NumThreads: 20
aws:elasticbeanstalk:environment:proxy:staticfiles:
/static: static
/static_files: static_files
container_commands:
01_migrate:
command: "source /var/app/venv/staging-LQM1lest/bin/activate && python manage.py migrate --noinput"
leader_only: true
packages:
yum:
git: []
postgresql-devel: []
有人知道怎么解决吗?最终目标是获得绿色的“OK”状态。
编辑: 最终我切换到使用基础
健康系统,问题突然消失了。不过我仍然对解决原始问题感兴趣,因为强化版
健康系统带来了一些好处。
[ERROR] nginx: the configuration file /var/proxy/staging/nginx/nginx.conf syntax is ok nginx: configuration file /var/proxy/staging/nginx/nginx.conf test is successful
和[ERROR] Created symlink from /etc/systemd/system/multi-user.target.wants/worker.service to /etc/systemd/system/worker.service.
)。名为cloud-init-cmd
的文件甚至不是日志的一部分。 - Philip Fabianek/var/log/cfn-init-cmd.log
,抱歉。 - Marcin