I'm so close to finding a nice setup with Docker Compose and ECS, but there is one small thing remaining.
The scenario goes like this:
- Update app (Django) source code and deploy to ECS using Docker Compose and Docker Context.
- ECS registers a new task for the app and starts it along with the old one.
- Problem: Nginx does health checks on the old container and when that is deregistered, nginx starts throwing 502 errors and restarts the task, leading to downtime and unavailability.
- Nginx starts up again and does health checks on the new container, app working again, but with undesired downtime as mentioned.
Is there some config I need to do here? Am I missing something?
docker-compose.yml for reference:
services:
web:
image: # Image from ECR, built from GH-action.
command: gunicorn core.wsgi:application --bind 0.0.0.0:8000
environment:
# ...
volumes:
# ...
deploy:
replicas: 1
nginx:
image: # Image from ECR, kept static
ports:
- "80:80"
volumes:
# ...
depends_on:
- web
deploy:
replicas: 1