diff --git a/docker-compose.yml b/docker-compose.yml index 6585e7e..05ef019 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,6 @@ version: '3.8' services: app: build: . - container_name: template-001-app restart: unless-stopped environment: - NODE_ENV=production @@ -16,12 +15,20 @@ services: - REDIS_HOST=redis - REDIS_PORT=6379 depends_on: - - postgres - - redis + postgres: + condition: service_healthy + redis: + condition: service_healthy networks: - app-network expose: - "3000" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000/health"] + interval: 10s + timeout: 3s + start_period: 5s + retries: 2 labels: - "traefik.enable=true" - "traefik.http.routers.template-001.rule=Host(`template-001.startanaicompany.com`)" @@ -32,7 +39,6 @@ services: postgres: image: postgres:15-alpine - container_name: template-001-postgres restart: unless-stopped environment: - POSTGRES_USER=postgres @@ -44,10 +50,14 @@ services: - app-network expose: - "5432" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 5s + timeout: 3s + retries: 3 redis: image: redis:7-alpine - container_name: template-001-redis restart: unless-stopped command: redis-server --appendonly yes volumes: @@ -56,6 +66,11 @@ services: - app-network expose: - "6379" + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 5s + timeout: 3s + retries: 3 volumes: postgres-data: