version: '2.3'

networks:
  monitor-dfe:
    driver: bridge

services:
    prometheus:
      image: prom/prometheus:latest
      container_name: prometheus
      hostname: prometheus
      restart: unless-stopped
      volumes:
        - './config/prometheus.yml:/etc/prometheus/prometheus.yml'
        - '/tmp/prometheus:/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'
        - '--web.enable-lifecycle'
      ports:
          - "9090:9090"
      networks:
        - monitor-dfe
      extra_hosts:
        - "host.docker.internal:host-gateway"
    
    alertmanager:
      image: prom/alertmanager:latest
      container_name: alertmanager
      volumes:
        - './config/alertmanager.yml:/etc/alertmanager/config.yml'
        - '/tmp/alertmanager:/alertmanager'
      command:
        - '--config.file=/etc/alertmanager/config.yml'
        - '--storage.path=/alertmanager'
      restart: unless-stopped
      networks:
        - monitor-dfe
      ports:
        - "9093:9093"
      depends_on:
        - prometheus
    
    grafana:
        image: grafana/grafana-oss:latest
        container_name: grafana
        volumes:
          - '/tmp/grafana:/var/lib/grafana'
        restart: unless-stopped
        networks:
          - monitor-dfe
        ports:
          - "3000:3000"
        depends_on:
          - prometheus
