Open goatwu1993 opened 1 year ago
I am new here, can you please tell me what should i check in the function? connection with database or what else? Or Can someone help me here.
@akashverma0786 possibly create a flag in cookiecutter, include django healthcheck, and add the URL in the urls.py
I think that's a pretty standard need when you need to deploy to prod, especially with Docker. One notable exception might be Heroku, maybe?
Not really sure if this sure be included in dev docker image.
Agree, I don't think it's needed for local development.
Side note, I wonder if the Celery checks would help resolve this old issue: #2727
@browniebroke I've been using this lib in production and with the recent change in how Sentry charges things, one of the pending tasks for my team is to exclude any logs generated by this lib from being sent to Sentry. I unfortunately haven't had time to work on it yet.
I think that's a pretty standard need when you need to deploy to prod, especially with Docker. One notable exception might be Heroku, maybe?
Not really sure if this sure be included in dev docker image.
Agree, I don't think it's needed for local development.
Side note, I wonder if the Celery checks would help resolve this old issue: #2727
@browniebroke
It seems Heroku does not have some health check mechanism.
django_celery_beat_periodictask
table. Using docker-compose's depends
statement, making celery beat depends on the django service healthy will also do the trick. depends_on:
django:
condition: service_healthy
However, it is overkilled and over-complicated IMO. It can be fixed by including python manage.py migrate django_celery_beat
or python manage.py migrate
in celery-beat start up script.
I'm in for adding django-health-check
as library but against adding or using it as HEALTHCHECK
.
In my opinion Python is to slow for using it in aa healthcheck. 30s start-period is not something that is usable I think.
I found this snippet a while ago but don't remember where. It checks if there is something running at port 5000 and perfectly suitable for rolling updates with docker swarm services.
services:
django:
<<: *default-opts
command: /start
healthcheck:
test: /bin/bash -c "timeout 1 bash -c '</dev/tcp/localhost/5000' 2>/dev/null"
start_period: 100s
interval: 30s
timeout: 30s
retries: 5
deploy:
restart_policy:
condition: any
delay: 5s
max_attempts: 24
rollback_config:
parallelism: 0
order: stop-first
update_config:
order: start-first
failure_action: rollback
delay: 10s
Description
"health_check", "health_check.db"
to INSTALLED_APPS"health_check.cache"
to INSTALLED_APPS if cache enabledHEALTHCHECK --interval=5m --timeout=3s --start-period=30s --retries=3 CMD python ./manage.py health_check
Not really sure if this sure be included in dev docker image.
Rationale
In a live setup, we use health-checks to see if an app or container is working right. AWS Application Load Balancer (ALB) uses an HTTP call to check health. AWS Elastic Container Service (ECS) does a health-check with a built-in method or a custom script. Other platforms like Kubernetes do similar checks.