Deployn

Guide for Calibre behind Traefik

Instructions for self-hosted e-book manager Calibre with Calibre-Web as GUI and Traefik as reverse proxy.

Guide for Calibre behind Traefik-heroimage

Table of Contents

CAUTION

Please note that this blog post was originally written in German and has been translated for your convenience. Although every effort has been made to ensure accuracy, there may be translation errors. I apologize for any discrepancies or misunderstandings that may result from the translation and I am grateful for any corrections in the comments or via mail.

Today (April 23) is World Book Day. The day of honor for e-books is not today, but this post is still about setting up your e-book manager. In this guide, I will show you how to do this on a server with Traefik as a reverse proxy. The prerequisite is the setup of Traefik as already described here. We use the program Calibre (as a server) and Calibre-Web (as a web GUI) as an e-book manager.

If there is interest in an equivalent description for a Synology server, this may follow later.

Once the connection (e.g. ssh username@ip-address) to the server is established, we need a folder where the books and data from Calibre will be stored.

cd ~/docker
mkdir appdata/calibre

And the Docker Compose file can already be created.

nano docker-compose-calibre.yml
version: "3.7"

### NETWORKS ###
networks:
    web:
        external:
            name: web
    default:
        driver: bridge

### SERVICEs ###
services:
    calibre-server:
        container_name: calibre-server
        image: linuxserver/calibre
        restart: unless-stopped
        networks:
            - web
        security_opt:
            - no-new-privileges:true
        volumes:
            - $DOCKERDIR/appdata/calibre:/config
        environment:
            - PUID=$PUID
            - PGID=$PGID
            - TZ=$TZ
            - UMASK=022
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.calibre-rtr.entrypoints=https"
            - "traefik.http.routers.calibre-rtr.rule=Host(`calibre.$DOMAINNAME`)"
            - "traefik.http.routers.calibre-rtr.tls=true"
            - "traefik.http.routers.calibre-rtr.service=calibre-svc"
            - "traefik.http.services.calibre-svc.loadbalancer.server.port=8080"
            - "traefik.http.routers.calibre-rtr.middlewares=chain-oauth@file"

We use the image from LinuxServer.io. The setup is now complete.

docker-compose -f docker-compose-calibre.yml up -d

After loading the container, we call up the page calibre.somedomain.de.

Calibre Setup Wizard

I leave the name of my folder at “Calibre-Bibliothek”. You can then access your library.

Calibre library

Next, we stop the container again and look at where the Calibre library is.

docker-compose -f docker-compose-calibre.yml down
cd appdata/calibre
ls -Al

Calibre directory

We see that the Calibre library has been created. We add Calibre-Web to the docker-compose file.

cd ~/docker
mkdir appdata/calibreweb
nano docker-compose-calibre.yml
version: "3.7"

### NETWORKS ###
networks:
    web:
        external:
            name: web
    default:
        driver: bridge

### SERVICEs ###
services:
    calibre-server:
        container_name: calibre-server
        image: linuxserver/calibre
        restart: unless-stopped
        networks:
            - web
        security_opt:
            - no-new-privileges:true
        volumes:
            - $DOCKERDIR/appdata/calibre:/config
        environment:
            - PUID=$PUID
            - PGID=$PGID
            - TZ=$TZ
            - UMASK=022
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.calibre-rtr.entrypoints=https"
            - "traefik.http.routers.calibre-rtr.rule=Host(`calibre.$DOMAINNAME`)"
            - "traefik.http.routers.calibre-rtr.tls=true"
            - "traefik.http.routers.calibre-rtr.service=calibre-svc"
            - "traefik.http.services.calibre-svc.loadbalancer.server.port=8080"
            - "traefik.http.routers.calibre-rtr.middlewares=chain-oauth@file"

    calibre-web:
        container_name: calibre-web
        image: linuxserver/calibre-web
        restart: unless-stopped
        networks:
            - web
        security_opt:
            - no-new-privileges:true
        volumes:
            - $DOCKERDIR/appdata/calibreweb:/config
            - $DOCKERDIR/appdata/calibre/Calibre-Bibliothek:/books
        environment:
            - PUID=$PUID
            - PGID=$PGID
            - TZ=$TZ
            - UMASK=022
            - DOCKER_MODS=linuxserver/calibre-web:calibre
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.calibreweb-rtr.entrypoints=https"
            - "traefik.http.routers.calibreweb-rtr.rule=Host(`books.$DOMAINNAME`)"
            - "traefik.http.routers.calibreweb-rtr.tls=true"
            - "traefik.http.routers.calibreweb-rtr.service=calibreweb-svc"
            - "traefik.http.services.calibreweb-svc.loadbalancer.server.port=8083"
            - "traefik.http.routers.calibreweb-rtr.middlewares=chain-oauth@file"

Then restart again.

docker-compose -f docker-compose-calibre up -d

Calibre-Web should now be available under “books.einedomain.de”.

Calibre Web Configuration

We log in with the preconfigured user data, username: admin and password: admin123. In the settings, we go to “Edit Basic Configuration”.

Admin area

The upload can be activated there.

Upload enabled

Now, it is possible to upload new books.

Calibre Web Dashboard

The setup is ready. Have fun reading and managing your e‑books 📖


This website uses cookies. These are necessary for the functionality of the website. You can find more information in the privacy policy