version: '3'

services:
  filebeat-victorialogs:
    image: docker.elastic.co/beats/filebeat:8.8.1
    restart: on-failure
    volumes:
      - type: bind
        source: /var/run/docker.sock
        target: /var/run/docker.sock
      - type: bind
        source: /var/lib/docker/containers/
        target: /var/lib/docker/containers/
      - ./filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
    user: root
    command:
      - "--strict.perms=false"
    depends_on: [ victorialogs ]
  beat-exporter-victorialogs:
    image: trustpilot/beat-exporter:0.4.0
    command:
      - -beat.uri=http://filebeat-victorialogs:5066

  victorialogs:
    image: docker.io/victoriametrics/victoria-logs:v0.12.0-victorialogs
    volumes:
      - victorialogs-filebeat-docker-vl:/vlogs
    ports:
      - '9428:9428'
    command:
      - -storageDataPath=/vlogs
      - -loggerFormat=json
  grafana:
    container_name: grafana
    image: grafana/grafana:9.2.7
    depends_on:
      - "victoriametrics"
    ports:
      - 3000:3000
    volumes:
      - victorialogs-filebeat-docker-grafana:/var/lib/grafana
      - ./../../provisioning/:/etc/grafana/provisioning/
      - ./../../../../dashboards/victoriametrics.json:/var/lib/grafana/dashboards/vm.json
      - ./../../../../dashboards/victorialogs.json:/var/lib/grafana/dashboards/vl.json
  victoriametrics:
    image: victoriametrics/victoria-metrics:latest
    ports:
      - '8428:8428'
    command:
      - -storageDataPath=/vmsingle
      - -promscrape.config=/promscrape.yml
      - -loggerFormat=json
    volumes:
      - victorialogs-filebeat-docker-vm:/vmsingle
      - ./scrape.yml:/promscrape.yml

volumes:
  victorialogs-filebeat-docker-vl:
  victorialogs-filebeat-docker-vm:
  victorialogs-filebeat-docker-grafana: