services:
    pihole:
        container_name: pihole
        env_file: 
            - .env
        image: pihole/pihole:latest
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.pihole.entrypoints: websecure
            traefik.http.routers.pihole.rule: Host(`pihole.alexlebens.net`)
            traefik.http.routers.pihole.service: pihole
            traefik.http.services.pihole.loadbalancer.server.port: 80
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik:
                ipv4_address: 172.27.1.3
        restart: always
        privileged: true
        volumes:
            - config:/etc/pihole
            - dnsmasq:/etc/dnsmasq.d
            - logs:/var/log

    pihole_exporter:
        container_name: pihole_exporter
        depends_on: 
            - pihole
        env_file: 
            - .env
        image: ekofr/pihole-exporter:v0.3.0
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik:
                ipv4_address: 172.27.1.4
        restart: unless-stopped

networks:
    traefik:
        name: traefik
        external: true

volumes:
    config:
        driver: local
        driver_opts:
            type: none
            o: bind
            device: /var/lib/docker/volumes/partition/pihole_config

    dnsmasq:
        driver: local
        driver_opts:
            type: none
            o: bind
            device: /var/lib/docker/volumes/partition/pihole_dnsmasq

    logs:
        driver: local
        driver_opts:
            type: none
            o: bind
            device: /var/lib/docker/volumes/partition/pihole_logs