首页 > 解决方案 > Elastic Beanstalk 环境的运行状况严重:以下服务未运行:发布

问题描述

我将 Django 应用程序部署到 Elastic Beanstalk (EB) Amazon Linux 2 Python 3.7 平台,一切似乎都运行良好。然而,环境的健康状况很严重,我不知道为什么。

EB 给我的唯一信息如下:

总体状态:降级 - 所有实例上的服务受损。

(只有一个实例在运行)

实例状态:严重 - 以下服务未运行:发布。

我没有找到有关“发布”服务是什么的信息。

从完整日志中,我看到的唯一错误如下:

守护进程日志:

F, [2020-11-07T04:03:03.891398 #5022] FATAL -- : /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/launcher.rb:432:in `block in setup_signals': SIGTERM (SignalException)
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/single.rb:117:in `join'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/single.rb:117:in `run'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/launcher.rb:172:in `run'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/cli.rb:80:in `run'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/healthd-1.0.6/bin/healthd:112:in `block in <top (required)>'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/healthd-1.0.6/bin/healthd:19:in `chdir'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/healthd-1.0.6/bin/healthd:19:in `<top (required)>'
    from /opt/elasticbeanstalk/lib/ruby/bin/healthd:23:in `load'
    from /opt/elasticbeanstalk/lib/ruby/bin/healthd:23:in `<main>'

从我在这里读到的内容来看,这个 SignalException 被抛出以关闭一个进程,所以我认为它是正常的。

任何其他日志中都没有其他错误。如此处所述,关闭增强的运行状况检查将是简单的“解决方案”,我想继续使用它们。

很感谢任何形式的帮助。

标签: djangoamazon-web-servicesamazon-elastic-beanstalk

解决方案


.config 命令:

container_commands:
  01_migrate:
    command: "source $(find /var/app/venv/ -name activate) && export $(sudo egrep -v '^#' /opt/elasticbeanstalk/deployment/env | xargs) && python manage.py migrate --noinput"
    leader_only: true
  02_static:
    command: "source $(find /var/app/venv/ -name activate) && export $(sudo egrep -v '^#' /opt/elasticbeanstalk/deployment/env | xargs) && python manage.py collectstatic --noinput"
    leader_only: true

推荐阅读