From 1ef425283fac9580e07ebedb99c09f897f8780b6 Mon Sep 17 00:00:00 2001 From: Uma Date: Fri, 10 Jul 2026 11:26:24 +0200 Subject: [PATCH] fix(compose): keep gunicorn flags intact in web command The web service used a YAML folded block scalar (command: >) for the sh -c script. Folded scalars collapse newlines to spaces, but the multi-line gunicorn invocation was being parsed such that the flags (--bind 0.0.0.0:8000, --workers, etc.) were dropped. gunicorn then fell back to its defaults: a single worker bound to 127.0.0.1:8000. Because the process bound to container-loopback rather than 0.0.0.0, Docker's published port (127.0.0.1:8000:8000) could not reach it, so the reverse proxy returned 502. Rewrite command as an explicit argv list with the full gunicorn invocation on a single physical line so every flag is preserved and the process binds to 0.0.0.0:8000 with the intended worker count. --- docker-compose.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8b87c44..3561802 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -50,16 +50,13 @@ services: - static-assets:/app/staticfiles ports: - "127.0.0.1:8000:8000" - command: > - sh -c "python manage.py migrate --noinput && - python manage.py collectstatic --noinput && - exec gunicorn config.wsgi:application - --bind 0.0.0.0:8000 - --workers $${GOGGLES_WEB_WORKERS:-3} - --threads $${GOGGLES_WEB_THREADS:-4} - --timeout $${GOGGLES_WEB_TIMEOUT_SECONDS:-300} - --max-requests $${GOGGLES_WEB_MAX_REQUESTS:-500} - --max-requests-jitter $${GOGGLES_WEB_MAX_REQUESTS_JITTER:-50}" + command: + - sh + - -c + - >- + python manage.py migrate --noinput && + python manage.py collectstatic --noinput && + exec gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers $${GOGGLES_WEB_WORKERS:-3} --threads $${GOGGLES_WEB_THREADS:-4} --timeout $${GOGGLES_WEB_TIMEOUT_SECONDS:-300} --max-requests $${GOGGLES_WEB_MAX_REQUESTS:-500} --max-requests-jitter $${GOGGLES_WEB_MAX_REQUESTS_JITTER:-50} logging: driver: json-file options: