services:
    plex:
        container_name: plex
        devices:
            - /dev/dri:/dev/dri
        env_file:
            - .env
        hostname: plex.alexlebens.net
        image: plexinc/pms-docker
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.plex.entrypoints: websecure
            traefik.http.routers.plex.rule: Host(`plex.alexlebens.net`)
            traefik.http.routers.plex.service: plex
            traefik.http.services.plex.loadbalancer.server.port: 32400
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        ports:
            - 32400:32400/tcp
            - 32400:32400/udp
            - 3005:3005/tcp
            - 8324:8324/tcp
            - 32469:32469/tcp
            - 1900:1900/udp
            - 32410:32410/udp
            - 32412:32412/udp
            - 32413:32413/udp
            - 32414:32414/udp
        restart: unless-stopped
        privileged: true
        volumes:
            - config:/config
            - transcode:/transcode
            - preroll_nfs:/preroll
            - anime_nfs:/anime
            - anime_movies_nfs:/anime_movies
            - documentaries_nfs:/documentaries
            - documentary_shows_nfs:/documentary_shows
            - dvr_nfs:/dvr
            - movies_nfs:/movies
            - movies_classics_nfs:/movies_classics
            - movies_foreign_nfs:/movies_foreign
            - music_nfs:/music
            - standup_nfs:/standup
            - tvshows_nfs:/tvshows

    tautulli:
        container_name: plex_tautulli
        env_file:
            - .env
        image: ghcr.io/tautulli/tautulli:latest
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.tautulli.entrypoints: websecure
            traefik.http.routers.tautulli.rule: Host(`tautulli.alexlebens.net`)
            traefik.http.routers.tautulli.service: tautulli
            traefik.http.routers.tautulli.middlewares: tautulli-theme@file
            traefik.http.services.tautulli.loadbalancer.server.port: 8181
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        restart: unless-stopped
        volumes:
            - tautulli:/config

    plex_meta_manager:
        container_name: plex_meta_manager
        environment:
            - PMM_TIME=01:00
            - TZ=America/Denver
        image: meisnate12/plex-meta-manager:latest
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        restart: unless-stopped
        volumes:
            - plex_meta_manager:/config

    plex_exporter:
        container_name: plex_exporter
        env_file:
            - .env
        image: ghcr.io/axsuul/plex-media-server-exporter:latest
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        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/plex_config

    transcode:
        driver: local
        driver_opts:
            type: none
            o: bind
            device: /var/lib/docker/volumes/partition/plex_transcode

    tautulli:
        driver: local
        driver_opts:
            type: none
            o: bind
            device: /var/lib/docker/volumes/partition/plex_tautulli

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

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

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

    anime_movies_nfs:
        driver: local
        driver_opts:
            type: nfs
            o: addr=192.168.1.194,nfsvers=4
            device: ":/volume2/Storage/Anime Movies"

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

    documentary_shows_nfs:
        driver: local
        driver_opts:
            type: nfs
            o: addr=192.168.1.194,nfsvers=4
            device: ":/volume2/Storage/Documentary Shows" 

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

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

    movies_classics_nfs:
        driver: local
        driver_opts:
            type: nfs
            o: addr=192.168.1.194,nfsvers=4
            device: ":/volume2/Storage/Movies Classics"

    movies_foreign_nfs:
        driver: local
        driver_opts:
            type: nfs
            o: addr=192.168.1.194,nfsvers=4
            device: ":/volume2/Storage/Movies Foreign"

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

    standup_nfs:
        driver: local
        driver_opts:
            type: nfs
            o: addr=192.168.1.194,nfsvers=4
            device: ":/volume2/Storage/Stand Up"

    tvshows_nfs:
        driver: local
        driver_opts:
            type: nfs
            o: addr=192.168.1.194,nfsvers=4
            device: ":/volume2/Storage/TV Shows"
