5

I deployed a Django application to Elastic Beanstalk (EB) Amazon Linux 2 Python 3.7 platform and everything seems to be working fine. However, the health of the environment is severe and I can't figure out why.

The only information EB gives me is the following:

Overall status: Degraded - Impaired services on all instances.

(there is only one instance running)

Instance status: Severe - Following services are not running: release.

I found no information about what the "release" service is.

From the full logs, the only errors I'm seeing are the following:

daemon.log:

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>'

From what I've read here this SignalException is thrown to shut down a process, so I assume it's normal.

There is no other error in any of the other logs. Turning the enhanced health check off would be the easy "solution" as stated here but I would like to keep them on.

Any help is very much appreciated.

Zufra
  • 574
  • 1
  • 7
  • 16
  • 1
    I've found EB to be very finicky. Try redeploying your app that usually corrects unsubstantiated errors for me. – Daniel Nov 07 '20 at 15:19
  • 1
    I've tried redeploying several times and nothing changes. Have you deployed to production a Django application? If so, do you recommend another hosting service? I was considering manually configuring an EC2 instance but EB seemed to provide a simpler interface to configure load balancers, monitoring, etc. – Zufra Nov 07 '20 at 15:54
  • 1
    I use EB for a few different Django-based web applications and, other than a few quirks, it works really well. Can you try printing out the logs? `eb logs` in your terminal – Daniel Nov 07 '20 at 16:29
  • 1
    I get an HTTP 403: Forbidden error when I run that command. Its weird because my user has FullAccess to EB. Aren't this logs the ones EB provides when requesting "Full logs"? – Zufra Nov 07 '20 at 19:28
  • 1
    I've ran into that issue as well - I also was not able to download the logs from the aws web interface - however, I was able to `eb ssh` into my eb-env and find the logs there - can you try that? – Daniel Nov 07 '20 at 19:31
  • 1
    Sure thing, give me a minute and I'll edit the question with the logs. – Zufra Nov 07 '20 at 19:33
  • 1
    What logs do you want me to include in the question? There are lots of them and most probably aren't useful at all. – Zufra Nov 07 '20 at 19:36
  • 1
    Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/224261/discussion-between-zufra-and-daniel). – Zufra Nov 07 '20 at 19:40
  • @Daniel after continuing investigating about this problem I found out that by removing the python3 manage.py collectstatic command after a deployment, the health turned to Ok. Do you have by any chance a .config file in which you run this command correctly on the Amazon Linux 2 platform? All the examples available are for the previous version of Amazon Linux. – Zufra Nov 08 '20 at 00:47

1 Answers1

0

.config commands:

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
Daniel
  • 3,228
  • 1
  • 7
  • 23
  • Tried it and the commands ran succesfully but the status is severe again. Sorry to keep bothering you, you have been very helpful, but last request: do you have other .config files in the .ebextensions folder of the Django application you deployed to the Amazon Linux 2 Python 3.7 platform? If so, could you edit this answer to include them? Thanks a lot Daniel! – Zufra Nov 09 '20 at 00:05
  • No problem - and that's the AL2 Py 3.7 config file I have - as mentioned upgrading the EBS version caused my previous config files to fall apart. Maybe try rolling back the EBS version if you can? – Daniel Nov 09 '20 at 00:08
  • 1
    I have other .config files. I deleted them and kept only the one you specified in this answer and nothing changed. So the other .config files where quite useless it seems. Configuring the EB AL2 platform is like walking in the dark. Anyway, thank you very much for your help. I'll keep the environment as it is and if I manage to correct it I'll post an answer. – Zufra Nov 09 '20 at 01:54