# ============================================================================== # DOCKER COMPOSE - GAMILIT # ============================================================================== # Servicios de produccion/staging para Gamilit # Mantenido por: DevOps-Agent # Actualizado: 2025-12-18 # ============================================================================== version: "3.8" # Anchors reutilizables x-logging: &default-logging driver: "json-file" options: max-size: "10m" max-file: "3" x-healthcheck: &default-healthcheck interval: 30s timeout: 5s retries: 3 start_period: 10s services: # ========================================================================== # GAMILIT API # ========================================================================== gamilit-api: build: context: ../apps/backend dockerfile: Dockerfile container_name: gamilit-api restart: unless-stopped # Solo expose, NO ports (Traefik maneja el routing) expose: - "3000" environment: - NODE_ENV=${NODE_ENV:-production} - PORT=3000 - DATABASE_URL=${DATABASE_URL} - REDIS_URL=${REDIS_URL:-redis://redis:6379} - JWT_SECRET=${JWT_SECRET} - JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-1d} - LOG_LEVEL=${LOG_LEVEL:-info} - CORS_ORIGIN=${CORS_ORIGIN:-http://gamilit.localhost} healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3000/health"] <<: *default-healthcheck labels: - "traefik.enable=true" - "traefik.http.routers.gamilit-api.rule=Host(`api.gamilit.localhost`)" - "traefik.http.routers.gamilit-api.entrypoints=web" - "traefik.http.services.gamilit-api.loadbalancer.server.port=3000" networks: - gamilit_${ENV:-local} - infra_shared depends_on: - postgres - redis logging: <<: *default-logging # ========================================================================== # GAMILIT WEB # ========================================================================== gamilit-web: build: context: ../apps/frontend dockerfile: Dockerfile args: - VITE_API_URL=${VITE_API_URL:-http://api.gamilit.localhost} container_name: gamilit-web restart: unless-stopped expose: - "3001" environment: - NODE_ENV=${NODE_ENV:-production} healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3001/"] interval: 60s timeout: 5s retries: 3 start_period: 10s labels: - "traefik.enable=true" - "traefik.http.routers.gamilit-web.rule=Host(`gamilit.localhost`)" - "traefik.http.routers.gamilit-web.entrypoints=web" - "traefik.http.services.gamilit-web.loadbalancer.server.port=3001" networks: - gamilit_${ENV:-local} - infra_shared depends_on: - gamilit-api logging: <<: *default-logging # ========================================================================== # POSTGRESQL # ========================================================================== postgres: image: postgres:15-alpine container_name: gamilit-postgres restart: unless-stopped expose: - "5432" environment: - POSTGRES_DB=${POSTGRES_DB:-gamilit_db} - POSTGRES_USER=${POSTGRES_USER:-gamilit_owner} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} volumes: - postgres_data:/var/lib/postgresql/data - ../database/schemas:/docker-entrypoint-initdb.d:ro healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-gamilit_owner}"] <<: *default-healthcheck networks: - gamilit_${ENV:-local} logging: <<: *default-logging # ========================================================================== # REDIS # ========================================================================== redis: image: redis:7-alpine container_name: gamilit-redis restart: unless-stopped expose: - "6379" command: redis-server --appendonly yes volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] <<: *default-healthcheck networks: - gamilit_${ENV:-local} logging: <<: *default-logging # ============================================================================== # VOLUMES # ============================================================================== volumes: postgres_data: name: gamilit_postgres_data redis_data: name: gamilit_redis_data # ============================================================================== # NETWORKS # ============================================================================== networks: gamilit_${ENV:-local}: external: true infra_shared: external: true