version: "3"

services:
  l2geth:
    command: ["--metrics", "--metrics.influxdb", "--metrics.influxdb.endpoint", "http://influxdb:8086", "--metrics.influxdb.database", "l2geth"]

  batch_submitter:
    environment:
      BATCH_SUBMITTER_RUN_METRICS_SERVER: "true"
      BATCH_SUBMITTER_METRICS_PORT: 7300
      BATCH_SUBMITTER_METRICS_HOSTNAME: 0.0.0.0

  grafana:
    image: grafana/grafana:7.5.5
    env_file:
      -  ./envs/metrics.env
    ports:
      - ${GRAFANA_HTTP_PORT:-3000}:3000
    volumes:
      - ./docker/grafana/provisioning/:/etc/grafana/provisioning/:ro
      - grafana_data:/var/lib/grafana/
      - grafana_dashboards:/grafana-dashboards:ro

  influxdb:
    image: quay.io/influxdb/influxdb:1.6
    env_file:
      -  ./envs/metrics.env
    volumes:
      - influxdb_data:/var/lib/influxdb

  prometheus:
    image: prom/prometheus
    env_file:
      -  ./envs/metrics.env
    volumes:
      - ./docker/prometheus:/etc/prometheus
      - prometheus_data:/prometheus

  dashboard-sync:
    image: python:3
    env_file:
      -  ./envs/metrics.env
    command:
      - python
      - /scripts/dashboard-sync.py
    volumes:
      - ./docker/scripts/:/scripts
      - grafana_dashboards:/grafana-dashboards

volumes:
  influxdb_data:
  grafana_data:
  grafana_dashboards:
  prometheus_data: