From 0733ecd535e0cd9fd6070d71638150f9fa3b753d Mon Sep 17 00:00:00 2001 From: Andrew Yager Date: Sun, 1 Mar 2026 18:25:15 +1100 Subject: [PATCH] fix: prevent static file hash mismatch between web-prod replicas Restore web-init as a dependency for web-prod so replicas only start after migrations and collectstatic complete. Clear the stale manifest before collectstatic to avoid replicas loading an outdated file map. Removes the polling loops from web-prod since depends_on handles ordering. Co-Authored-By: Claude Opus 4.6 --- docker-compose.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9f5b490..2d7d800 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -265,6 +265,7 @@ services: set -a; . /var/lib/garage/credentials.env; set +a; fi && cd /app/src && + rm -f /app/src/staticfiles/staticfiles.json && python manage.py migrate --noinput && python manage.py collectstatic --noinput --clear " @@ -304,17 +305,6 @@ services: set -a; . /var/lib/garage/credentials.env; set +a; fi && cd /app/src && - echo 'Waiting for migrations...' && - until python manage.py migrate --check --no-input 2>/dev/null; do - echo 'Migrations not yet applied, waiting...'; - sleep 2; - done && - echo 'Waiting for static files...' && - until [ -f /app/src/staticfiles/staticfiles.json ]; do - echo 'Static files not yet collected, waiting...'; - sleep 2; - done && - echo 'Ready, starting Daphne...' && daphne -b 0.0.0.0 -p 8000 props.asgi:application " healthcheck: @@ -333,6 +323,8 @@ services: condition: service_healthy garage-init: condition: service_completed_successfully + web-init: + condition: service_completed_successfully env_file: .env environment: DATABASE_URL: postgres://props:${POSTGRES_PASSWORD}@db:5432/props