From fe8218f618d290847ad5da68767aaf7d57dbb860 Mon Sep 17 00:00:00 2001 From: digorgonzola <29941279+digorgonzola@users.noreply.github.com> Date: Fri, 17 Nov 2023 22:07:02 +1100 Subject: [PATCH 1/3] requirements.txt: add uwsgi-readiness-check --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 5ce9ceb..f24bab0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,4 @@ psycopg2>=2.7.5,<2.8.0 Pillow>=5.3.0,<5.4.0 uwsgi>=2.0.18,<2.1.0 flake8>=3.6.0,<3.7.0 +uwsgi-readiness-check From 71a635002d081c6a9940e612b01a3c44a5db68bc Mon Sep 17 00:00:00 2001 From: digorgonzola <29941279+digorgonzola@users.noreply.github.com> Date: Fri, 17 Nov 2023 22:07:34 +1100 Subject: [PATCH 2/3] entrypoint.sh: pass stats param to uwsgi --- scripts/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index a0c5063..01c2f2d 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -4,4 +4,4 @@ set -e python manage.py collectstatic --noinput python manage.py wait_for_db python manage.py migrate -uwsgi --socket :9000 --workers 4 --master --enable-threads --module app.wsgi +uwsgi --socket :9000 --workers 4 --master --enable-threads --module app.wsgi --stats /tmp/statsock From 87670490e067513e9d8ace33b7987dadd70ea2a0 Mon Sep 17 00:00:00 2001 From: digorgonzola <29941279+digorgonzola@users.noreply.github.com> Date: Fri, 17 Nov 2023 22:07:58 +1100 Subject: [PATCH 3/3] docker-compose-proxy.yml: add uwsgi health check to app --- docker-compose-proxy.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose-proxy.yml b/docker-compose-proxy.yml index f477152..7eb7c26 100644 --- a/docker-compose-proxy.yml +++ b/docker-compose-proxy.yml @@ -4,6 +4,8 @@ services: app: build: context: . + healthcheck: + test: ["CMD-SHELL", "uwsgi-is-ready --stats-socket /tmp/statsock > /dev/null 2>&1 || exit 1"] volumes: - ./app:/app - static_data:/vol/web @@ -24,8 +26,7 @@ services: depends_on: - app healthcheck: - test: ["CMD-SHELL", "curl -so /dev/null http://localhost:8000/ || exit 1"] - timeout: 10s + test: ["CMD-SHELL", "curl -so /dev/null http://localhost:8000/health || exit 1"] ports: - "8000:8000" volumes: