version: '2'

services:
  grafana:
    image: grafana/grafana:7.1.4
    ports:
      - '3000:3000'
    volumes:
      - ./grafana/datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
      - ./grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml
      - ./grafana/hotrod_metrics_logs.json:/etc/grafana/provisioning/dashboards/hotrod_metrics_logs.json
    logging:
      driver: loki
      options:
        loki-url: 'http://localhost:3100/api/prom/push'

  loki:
    image: grafana/loki:master
    ports:
      - '3100:3100'
    command: -config.file=/etc/loki/local-config.yaml
    # send Loki traces to Jaeger
    environment:
      - JAEGER_AGENT_HOST=jaeger
      - JAEGER_AGENT_PORT=6831
      - JAEGER_SAMPLER_TYPE=const
      - JAEGER_SAMPLER_PARAM=1
    logging:
      driver: loki
      options:
        loki-url: 'http://localhost:3100/api/prom/push'

  jaeger:
    image: jaegertracing/all-in-one:latest
    ports:
      - '6831:6831'
      - '16686:16686'
    logging:
      driver: loki
      options:
        loki-url: 'http://localhost:3100/api/prom/push'

  hotrod:
    image: jaegertracing/example-hotrod:latest
    ports:
      - '8080:8080'
      - '8083:8083'
    command: ["-m","prometheus","all"]
    environment:
      - JAEGER_AGENT_HOST=jaeger
      - JAEGER_AGENT_PORT=6831
    logging:
      driver: loki
      options:
        loki-url: 'http://localhost:3100/api/prom/push'

  prometheus:
    image: prom/prometheus:v2.19.1
    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
    ports:
      - '9090:9090'
    command:
    - --config.file=/etc/prometheus/prometheus.yml
    logging:
      driver: loki
      options:
        loki-url: 'http://localhost:3100/api/prom/push'
