services:
  lb:
    image: 'traefik:latest'
    command:
        - "--api=true"
        - "--api.dashboard=true"
        - "--api.insecure=true"
        - "--providers.docker=true"
        - "--log.level=DEBUG"
        - "--accesslog"
        - "--entrypoints.web.address=:80"
        - "--entrypoints.web.http.encodedCharacters.allowEncodedSlash=true"
        - "--providers.docker.exposedbydefault=false"
    ports:
        - "127.0.0.3:60080:80"
    volumes:
        - /var/run/docker.sock:/var/run/docker.sock
    depends_on:
        - thruk
    labels:
        - "traefik.enable=true"
        - "traefik.http.routers.dashboard.entrypoints=web"
        - "traefik.http.routers.dashboard.rule=(PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
        - "traefik.http.routers.dashboard.service=api@internal"
  omd:
    build: omd/
    environment:
        - TZ=Europe/Berlin
    volumes:
        - ../../../:/thruk:ro
        - .:/scenario:ro
        - .:/test:ro
        - ../../../var/tmp:/var/tmp:rw
        - shared_var:/mnt/var
        - shared_etc:/mnt/etc
  thruk:
    build: thruk/
    scale: 3
    ports:
        - "80"
    environment:
        - TZ=Europe/Berlin
    labels:
        - "traefik.enable=true"
        - "traefik.http.routers.thruk.entrypoints=web"
        - "traefik.http.routers.thruk.service=thruk"
        - "traefik.http.routers.thruk.rule=PathPrefix(`/demo`)"
        - "traefik.http.services.thruk.loadbalancer.server.port=80"
        - "traefik.http.services.thruk.loadbalancer.healthcheck.port=80"
        - "traefik.http.services.thruk.loadbalancer.healthcheck.path=/demo/thruk/cgi-bin/remote.cgi?lb_ping"
        - "traefik.http.services.thruk.loadbalancer.healthcheck.interval=3s"
    volumes:
        - ../../../:/thruk:ro
        - .:/scenario:ro
        - .:/test:ro
        - ../../../var/tmp:/var/tmp:rw
        - shared_var:/mnt/var
        - shared_etc:/mnt/etc

volumes:
  shared_etc:
  shared_var:
