services:
    tube_archivist_es:
        container_name: tube_archivist_es
        env_file:
            - .es.env
        image: bbilly1/tubearchivist-es:latest
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        restart: unless-stopped
        ulimits:
            memlock:
                soft: -1
                hard: -1
        volumes:
            - es:/usr/share/elasticsearch/data

    tube_archivist_redis:
        container_name: tube_archivist_redis
        depends_on:
            - tube_archivist_es
        image: redislabs/rejson:latest
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        restart: unless-stopped
        volumes:
            - redis:/data

    tube_archivist:
        container_name: tube_archivist
        depends_on:
            - tube_archivist_es
            - tube_archivist_redis
        env_file:
            - .env
        image: bbilly1/tubearchivist
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.tube_archivist.entrypoints: websecure
            traefik.http.routers.tube_archivist.rule: Host(`tubearchivist.alexlebens.net`)
            traefik.http.routers.tube_archivist.service: tube_archivist
            traefik.http.services.tube_archivist.loadbalancer.server.port: 8000
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        privileged: true
        restart: unless-stopped
        volumes:
            - media:/youtube
            - cache:/cache

networks:
    traefik:
        name: traefik
        external: true

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

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

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

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

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