services:
    calibre_db:
        container_name: calibre_database
        env_file:
            - .env
        image: lscr.io/linuxserver/calibre:latest
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.calibre_database.entrypoints: websecure
            traefik.http.routers.calibre_database.rule: Host(`calibredb.alexlebens.net`)
            traefik.http.routers.calibre_database.service: calibre_database
            traefik.http.services.calibre_database.loadbalancer.server.port: 8080
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        privileged: true
        restart: unless-stopped
        security_opt:
            - seccomp:unconfined
        user: root
        volumes:
            - calibre_database_config:/config
            - books_nfs:/books

    calibre_web:
        container_name: calibre_web
        env_file:
            - .env
        image: lscr.io/linuxserver/calibre-web:latest
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.calibre_web.entrypoints: websecure
            traefik.http.routers.calibre_web.rule: Host(`calibre.alexlebens.net`)
            traefik.http.routers.calibre_web.service: calibre_web
            traefik.http.routers.calibre_web.middlewares: calibreweb-theme@file
            traefik.http.services.calibre_web.loadbalancer.server.port: 8083
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        restart: unless-stopped
        privileged: true
        volumes:
            - calibre_web_config:/config
            - books_nfs:/books:ro

networks:
    traefik:
        name: traefik
        external: true

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

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

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