services:
  dedicated-exporter:
    image: alpine:3.20
    network_mode: host
    command:
      - /work/prometheus-feature
      - --config-path
      - /work/configs/runtime-prometheus-config-dedicated.yaml
    volumes:
      - ./generated/bin/prometheus-feature:/work/prometheus-feature:ro
      - ./generated/configs:/work/configs:ro
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1:${DEDICATED_EXPORTER_PORT:-18184}/healthz"]
      interval: 5s
      timeout: 3s
      retries: 20

  premium-exporter:
    image: alpine:3.20
    network_mode: host
    command:
      - /work/prometheus-feature
      - --config-path
      - /work/configs/runtime-prometheus-config-premium.yaml
    volumes:
      - ./generated/bin/prometheus-feature:/work/prometheus-feature:ro
      - ./generated/configs:/work/configs:ro
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1:${PREMIUM_EXPORTER_PORT:-18181}/healthz"]
      interval: 5s
      timeout: 3s
      retries: 20

  essential-exporter:
    image: alpine:3.20
    network_mode: host
    command:
      - /work/prometheus-feature
      - --config-path
      - /work/configs/runtime-prometheus-config-essential.yaml
    volumes:
      - ./generated/bin/prometheus-feature:/work/prometheus-feature:ro
      - ./generated/configs:/work/configs:ro
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1:${ESSENTIAL_EXPORTER_PORT:-18182}/healthz"]
      interval: 5s
      timeout: 3s
      retries: 20

  starter-exporter:
    image: alpine:3.20
    network_mode: host
    command:
      - /work/prometheus-feature
      - --config-path
      - /work/configs/runtime-prometheus-config-starter.yaml
    volumes:
      - ./generated/bin/prometheus-feature:/work/prometheus-feature:ro
      - ./generated/configs:/work/configs:ro
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1:${STARTER_EXPORTER_PORT:-18183}/healthz"]
      interval: 5s
      timeout: 3s
      retries: 20

  prometheus:
    image: prom/prometheus:v2.52.0
    user: "0:0"
    network_mode: host
    command:
      - --config.file=/etc/prometheus/prometheus.yml
      - --storage.tsdb.path=/prometheus
      - --web.enable-lifecycle
      - --web.listen-address=0.0.0.0:${PROM_E2E_PROMETHEUS_PORT:-19090}
    volumes:
      - ./generated/compose/prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - ./generated/compose/prometheus-data:/prometheus
    depends_on:
      dedicated-exporter:
        condition: service_healthy
      premium-exporter:
        condition: service_healthy
      essential-exporter:
        condition: service_healthy
      starter-exporter:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1:${PROM_E2E_PROMETHEUS_PORT:-19090}/-/healthy"]
      interval: 5s
      timeout: 3s
      retries: 20

  grafana:
    image: grafana/grafana:10.4.0
    network_mode: host
    environment:
      GF_SECURITY_ADMIN_USER: admin
      GF_SECURITY_ADMIN_PASSWORD: admin
      GF_USERS_ALLOW_SIGN_UP: "false"
      GF_SERVER_HTTP_PORT: "${PROM_E2E_GRAFANA_PORT:-13000}"
    volumes:
      - ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources:ro
      - ./grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro
      - ./dashboard:/var/lib/grafana/dashboards:ro
    depends_on:
      prometheus:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1:${PROM_E2E_GRAFANA_PORT:-13000}/api/health"]
      interval: 5s
      timeout: 3s
      retries: 20
