version: '3'

services:
  prometheus:
    image: prom/prometheus
    container_name: prometheus
    network_mode: host
    volumes:
      - prometheus:/prometheus
    entrypoint:
      - /bin/sh
      - -c
      - |
        echo "
        global:
          scrape_interval: '15s'
          evaluation_interval: '15s'

        scrape_configs:
          - job_name: 'monerod'
            static_configs:
              - targets:
                - '127.0.0.1:9000'
        " > config.yml

          exec prometheus \
            --config.file=config.yml \
            --storage.tsdb.retention.time=30d \
            --storage.tsdb.path=/prometheus


  grafana:
    container_name: grafana
    build: ./grafana
    ports:
      - 3000:3000
    environment:
      - GF_INSTALL_PLUGINS=grafana-worldmap-panel
    volumes:
      - ./grafana/dashboards:/var/lib/grafana/dashboards:ro


volumes:
  prometheus:
