services:
    tdarr:
        container_name: tdarr
        env_file:
            - .env
        image: haveagitgat/tdarr:latest
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.tdarr.entrypoints: websecure
            traefik.http.routers.tdarr.rule: Host(`tdarr.alexlebens.net`)
            traefik.http.routers.tdarr.service: tdarr
            traefik.http.routers.tdarr.middlewares: authentik@file
            traefik.http.services.tdarr.loadbalancer.server.port: 8265
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            tdarr:
                ipv4_address: 172.20.0.2
            traefik: null
        privileged: true
        restart: always
        volumes:
            - server:/app/server
            - logs:/app/logs
            - media:/media
            - cache:/temp
            - storage_nfs:/mnt/store
            - config:/app/configs

    tdarr_node:
        container_name: tdarr_node_a
        cpus: 6
        depends_on:
            - tdarr
        devices:
            - /dev/dri:/dev/dri
        env_file:
            - .env
            - .node.a.env
        image: haveagitgat/tdarr_node:latest
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            tdarr:
                ipv4_address: 172.20.0.3
        privileged: true
        restart: always
        volumes:
            - logs:/app/logs
            - media:/media
            - cache:/temp
            - storage_nfs:/mnt/store
            - config:/app/configs

networks:
    traefik:
        name: traefik
        external: true

    tdarr:
        name: tdarr
        external: false
        ipam:
            config:
                - subnet: 172.20.0.0/16

volumes:
    server:
        driver: local
        driver_opts:
            type: none
            o: bind
            device: /var/lib/docker/volumes/partition/tdarr_server

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

    media:
        driver: local
        driver_opts:
            type: none
            o: bind
            device: /var/lib/docker/volumes/partition/tdarr_media

    cache:
        driver: local
        driver_opts:
            type: none
            o: bind
            device: /var/lib/docker/volumes/partition/tdarr_cache

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

    storage_nfs:
        driver: local
        driver_opts:
            type: nfs
            o: addr=192.168.1.194,nfsvers=4
            device: :/volume2/Storage
