# Déclaration des services pour votre application Quarkus avec PostgreSQL, pgAdmin, Prometheus, Grafana et les exporters. services: #----------------------------------------------------------------------------- # Service principal : Application Quarkus #----------------------------------------------------------------------------- quarkus-app: container_name: ${APP_NAME}-app image: dahoudg/lionsdev-client-impl-quarkus-jvm:latest build: context: ./ dockerfile: Dockerfile.jvm args: - JAVA_VERSION=${JAVA_VERSION} environment: # Configuration de la base de données - QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} - QUARKUS_DATASOURCE_USERNAME=${POSTGRES_USER} - QUARKUS_DATASOURCE_PASSWORD=${POSTGRES_PASSWORD} # Configuration du serveur - QUARKUS_HTTP_PORT=${QUARKUS_HTTP_PORT} - TZ=${TZ} # Configuration des chemins et stockage - APP_STORAGE_BASE_PATH=/app/storage - APP_BASE_URL=${APP_BASE_URL:-http://localhost:8080} - APP_ENVIRONMENT=${ENVIRONMENT:-production} # Configuration des logs - QUARKUS_LOG_FILE_ENABLE=true - QUARKUS_LOG_FILE_PATH=/var/log/lionsdev/application.log - QUARKUS_LOG_LEVEL=INFO volumes: - ./logs:/var/log/lionsdev - ./storage:/app/storage tmpfs: - /tmp healthcheck: test: ["CMD", "curl", "-f", "http://localhost:${QUARKUS_HTTP_PORT}/q/health"] interval: 30s timeout: 10s retries: 3 ports: - "${QUARKUS_HTTP_PORT}:8080" # Expose uniquement le port nécessaire pour Quarkus deploy: resources: limits: cpus: '${QUARKUS_CPU_LIMIT}' memory: ${QUARKUS_MEMORY_LIMIT} depends_on: postgres-db: condition: service_healthy networks: - app-network restart: unless-stopped #----------------------------------------------------------------------------- # Base de données : PostgreSQL #----------------------------------------------------------------------------- postgres-db: container_name: ${APP_NAME}-db image: postgres:16-alpine restart: unless-stopped environment: POSTGRES_DB: ${POSTGRES_DB} POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} TZ: ${TZ} healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 10s timeout: 5s retries: 5 volumes: - postgres-data:/var/lib/postgresql/data ports: - "5432:5432" deploy: resources: limits: cpus: '1.0' memory: 1G networks: - app-network #----------------------------------------------------------------------------- # Interface d'administration PostgreSQL : pgAdmin #----------------------------------------------------------------------------- pgadmin: container_name: ${APP_NAME}-pgadmin image: dpage/pgadmin4:latest restart: unless-stopped environment: PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL} PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD} TZ: ${TZ} ports: - "${PGADMIN_PORT}:80" volumes: - pgadmin-data:/var/lib/pgadmin depends_on: postgres-db: condition: service_healthy networks: - app-network #----------------------------------------------------------------------------- # Monitoring : Prometheus #----------------------------------------------------------------------------- prometheus: container_name: ${APP_NAME}-prometheus image: prom/prometheus:latest restart: unless-stopped volumes: - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro - prometheus-data:/prometheus ports: - "${PROMETHEUS_PORT}:9090" depends_on: - postgres-exporter - node-exporter networks: - app-network #----------------------------------------------------------------------------- # Exporters pour PostgreSQL et le serveur #----------------------------------------------------------------------------- postgres-exporter: container_name: ${APP_NAME}-postgres-exporter image: prometheuscommunity/postgres-exporter:latest environment: DATA_SOURCE_NAME: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres-db:5432/${POSTGRES_DB}?sslmode=disable" ports: - "${POSTGRES_EXPORTER_PORT}:9187" depends_on: postgres-db: condition: service_healthy networks: - app-network node-exporter: container_name: ${APP_NAME}-node-exporter image: prom/node-exporter:latest ports: - "${NODE_EXPORTER_PORT}:9100" networks: - app-network #----------------------------------------------------------------------------- # Visualisation : Grafana #----------------------------------------------------------------------------- grafana: container_name: ${APP_NAME}-grafana image: grafana/grafana:latest restart: unless-stopped environment: GF_SECURITY_ADMIN_USER: ${GRAFANA_ADMIN_USER} GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD} TZ: ${TZ} ports: - "${GRAFANA_PORT}:3000" volumes: - grafana-data:/var/lib/grafana depends_on: - prometheus networks: - app-network volumes: postgres-data: pgadmin-data: prometheus-data: grafana-data: networks: app-network: driver: bridge