services: mysql: image: mysql:8.0 container_name: auth-mysql environment: MYSQL_ROOT_PASSWORD: rootpassword MYSQL_DATABASE: auth_service MYSQL_USER: auth_user MYSQL_PASSWORD: auth_password ports: # Host 3307 to avoid clashing with any other MySQL running on the host (3306). # auth-service talks to mysql:3306 on the internal compose network regardless. - "3307:3306" volumes: - mysql-data:/var/lib/mysql healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] interval: 10s timeout: 5s retries: 5 auth-service: build: . container_name: auth-service depends_on: mysql: condition: service_healthy environment: SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/auth_service SPRING_DATASOURCE_USERNAME: auth_user SPRING_DATASOURCE_PASSWORD: auth_password # Override in real environments; this matches the local dev default. APP_JWT_SECRET: c2VjcmV0LWtleS1mb3ItYXV0aC1zZXJ2aWNlLWp3dC1zaWduaW5nLTIwMjQ= # Dev only: enables POST /api/v1/auth/simulate/server-error (returns 500) # so load tests can exercise the HTTP 5xx path. Leave off in production. APP_ERROR_SIMULATION_ENABLED: "true" ports: # Host 8082 to avoid clashing with other containers/apps already on 8080. - "8082:8080" labels: # Promtail scrapes only containers tagged for logging. logging: promtail prometheus: image: prom/prometheus:v3.2.1 container_name: auth-prometheus depends_on: - auth-service ports: # Host 9091 to avoid the busy 9090. - "9091:9090" volumes: - ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro loki: image: grafana/loki:3.4.0 container_name: auth-loki command: -config.file=/etc/loki/config.yml ports: - "3100:3100" volumes: - ./monitoring/loki/config.yml:/etc/loki/config.yml:ro promtail: image: grafana/promtail:3.4.0 container_name: auth-promtail command: -config.file=/etc/promtail/promtail.yml depends_on: - loki volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - ./monitoring/promtail/promtail.yml:/etc/promtail/promtail.yml:ro grafana: image: grafana/grafana:11.6.0 container_name: auth-grafana depends_on: - prometheus - loki environment: GF_SECURITY_ADMIN_USER: admin GF_SECURITY_ADMIN_PASSWORD: admin # Datasource + dashboard provisioning come from the mounted files below. ports: # Host 3001 to avoid clashing with whatever already runs on 3000. - "3001:3000" volumes: - ./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro - ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards:ro volumes: mysql-data: