---
volumes:
  akvorado-loki:

services:
  loki:
    extends:
      file: versions.yml
      service: loki
    profiles: [ loki ]
    restart: unless-stopped
    volumes:
      - akvorado-loki:/loki
      - ./loki.yaml:/etc/loki/local-config.yaml:ro
    expose:
      - 3100/tcp
    labels:
      - traefik.enable=true
      - traefik.http.routers.loki.rule=PathPrefix(`/loki`)
      - traefik.http.routers.loki.entrypoints=private
      - metrics.port=3100
      - metrics.path=/loki/metrics

  vector:
    extends:
      file: versions.yml
      service: vector
    profiles: [ loki ]
    restart: unless-stopped
    user: root                  # for access to /var/run/docker.sock
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./vector.yaml:/etc/vector/vector.yaml:ro
    depends_on:
      - loki
    healthcheck:
      interval: 20s
      test: ["CMD",
             "wget", "-T", "1", "--spider", "http://127.0.0.1:8686/health"]
    expose:
      - 9598 # metrics
    environment:
      VECTOR_CONFIG_DIR: /etc/vector
    labels:
      - metrics.port=9598
