services: # Base de données PostgreSQL db: image: postgres:16-alpine container_name: dockezr_db_prod restart: always environment: POSTGRES_USER: dockezr_user POSTGRES_PASSWORD: Dockezr2025!Secure POSTGRES_DB: dockezr_prod ports: - "5432:5432" volumes: - postgres_data_prod:/var/lib/postgresql/data networks: - dockezr_network_prod healthcheck: test: ["CMD-SHELL", "pg_isready -U dockezr_user -d dockezr_prod"] interval: 10s timeout: 5s retries: 5 # Backend FastAPI backend: build: context: ./backend dockerfile: Dockerfile container_name: dockezr_backend_prod restart: always environment: DATABASE_URL: postgresql://dockezr_user:Dockezr2025!Secure@db:5432/dockezr_prod ports: - "8001:8000" depends_on: db: condition: service_healthy networks: - dockezr_network_prod healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/docs"] interval: 30s timeout: 10s retries: 3 # Frontend Next.js frontend: build: context: ./frontend dockerfile: Dockerfile container_name: dockezr_frontend_prod restart: always environment: NEXT_PUBLIC_API_URL: http://141.253.118.141:8001 ports: - "3000:3000" depends_on: - backend networks: - dockezr_network_prod healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"] interval: 30s timeout: 10s retries: 3 # Prometheus - Monitoring et métriques prometheus: image: prom/prometheus:latest container_name: dockezr_prometheus_prod restart: always ports: - "9090:9090" volumes: - ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml - prometheus_data_prod:/prometheus command: - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.path=/prometheus' - '--web.console.libraries=/etc/prometheus/console_libraries' - '--web.console.templates=/etc/prometheus/consoles' - '--storage.tsdb.retention.time=200h' - '--web.enable-lifecycle' networks: - dockezr_network_prod depends_on: - backend # Node Exporter - Métriques système du serveur node-exporter: image: prom/node-exporter:latest container_name: dockezr_node_exporter_prod restart: always ports: - "9100:9100" volumes: - /proc:/host/proc:ro - /sys:/host/sys:ro - /:/rootfs:ro command: - '--path.procfs=/host/proc' - '--path.rootfs=/rootfs' - '--path.sysfs=/host/sys' - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)' networks: - dockezr_network_prod # Grafana - Tableaux de bord et visualisation grafana: image: grafana/grafana:latest container_name: dockezr_grafana_prod restart: always ports: - "3001:3000" environment: - GF_SECURITY_ADMIN_USER=admin - GF_SECURITY_ADMIN_PASSWORD=Grafana2025!Secure - GF_USERS_ALLOW_SIGN_UP=false volumes: - grafana_data_prod:/var/lib/grafana - ./monitoring/grafana/provisioning:/etc/grafana/provisioning - ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards networks: - dockezr_network_prod depends_on: - prometheus networks: dockezr_network_prod: driver: bridge name: dockezr_network_prod volumes: postgres_data_prod: name: dockezr_postgres_data_prod prometheus_data_prod: name: dockezr_prometheus_data_prod grafana_data_prod: name: dockezr_grafana_data_prod