name: mpei-iis-system

services:

  prices-predictor:
    image: ml_service:2
    ports:
      - "8010:8000"
    volumes:
      - './models:/models:ro'

  load-tester:
    image: load_tester:1
    environment:
      API_BASE_URL: "http://prices-predictor:8000/api"
    # XXX: Предотвращает аварийный выход тестера при отсутствии ответа от prices-predictor
    # во время его (потенциально долгого) запуска.
    depends_on:
      - prices-predictor
    deploy:
      replicas: 2
    profiles:
      - "with-testers"

  prometheus:
    image: prom/prometheus:v3.7.3
    ports:
      - "9090:9090"
    user: nobody
    command:
      - "--config.file=/etc/prometheus/prometheus.yaml"
    volumes:
      - "./prometheus/prometheus.yaml:/etc/prometheus/prometheus.yaml:ro"
      - "prometheus-storage:/prometheus"

  grafana:
    image: grafana/grafana:12.4.0-20012734117
    ports:
      - "3000:3000"
    #environment:
    #  GF_SECURITY_ADMIN_USER: "$__file{/run/secrets/grafana-admin-user}"
    #  GF_SECURITY_ADMIN_PASSWORD: "$__file{/run/secrets/grafana-admin-password}"
    #secrets:
    #  - grafana-admin-user
    #  - grafana-admin-password
    environment:
      GF_SECURITY_ADMIN_USER: "${GF_SECURITY_ADMIN_USER:-admin}"
      GF_SECURITY_ADMIN_PASSWORD: "${GF_SECURITY_ADMIN_PASSWORD:-admin}"
    volumes:
      - "grafana-storage:/var/lib/grafana"

volumes:

  prometheus-storage: {}

  grafana-storage: {}

#secrets:
#
#  grafana-admin-user:
#    environment: GF_SECURITY_ADMIN_USER
#
#  grafana-admin-password:
#    environment: GF_SECURITY_ADMIN_PASSWORD
