version: '3.8'

services:
  # Backend FastAPI du panel admin
  admin-backend:
    build:
      context: ../admin/backend
      dockerfile: Dockerfile
    container_name: web-sentinel-admin-backend
    restart: unless-stopped
    environment:
      - WEB_SENTINEL_POSTGRES_URL=postgresql://websentinel_user:WebSentinelDB2025!@web-sentinel-db:5432/websentinel_prod
      - WEB_SENTINEL_ADMIN_JWT_SECRET=977d44204e28d0a7b337941c54fdfa109bbbf085bb4b6f2f0d16659ef159ca6d
      - ALLOWED_ORIGINS=https://admin.web-sentinel.taaazzz-prog.fr
    networks:
      - faildaily-ssl-network  # Réseau Traefik existant
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.admin-backend.rule=Host(`admin-api.web-sentinel.taaazzz-prog.fr`)"
      - "traefik.http.routers.admin-backend.entrypoints=websecure"
      - "traefik.http.routers.admin-backend.tls.certresolver=letsencrypt"
      - "traefik.http.services.admin-backend.loadbalancer.server.port=8000"
      - "traefik.docker.network=faildaily-network"

  # Frontend React du panel admin
  admin-frontend:
    build:
      context: ../admin/frontend
      dockerfile: Dockerfile
      args:
        - VITE_API_URL=https://admin-api.web-sentinel.taaazzz-prog.fr
    container_name: web-sentinel-admin-frontend
    restart: unless-stopped
    networks:
      - faildaily-ssl-network  # Réseau Traefik existant
    depends_on:
      - admin-backend
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.admin-frontend.rule=Host(`admin.web-sentinel.taaazzz-prog.fr`)"
      - "traefik.http.routers.admin-frontend.entrypoints=websecure"
      - "traefik.http.routers.admin-frontend.tls.certresolver=letsencrypt"
      - "traefik.http.services.admin-frontend.loadbalancer.server.port=80"

networks:
  faildaily-ssl-network:
    external: true
    name: faildaily_faildaily-ssl-network
