The AutoPirate recipe includes Lazy Librarian, a tool for tracking, finding, and downloading eBooks. However, after the eBooks are downloaded, Lazy Librarian is not much use for organising, tracking, and actually reading them.
Of course, you probably already manage your eBooks using the excellent Calibre, but this is primarily a (powerful) desktop application. Calibre-Web is an alternative way to manage / view your existing Calibre database, meaning you can continue to use Calibre on your desktop if you wish.
As a long-time Kindle user, Calibre-Web brings (among others) the following features which appeal to me:
- Filter and search by titles, authors, tags, series and language
- Create custom book collection (shelves) Support for editing eBook metadata and deleting eBooks from Calibre library
- Support for converting eBooks from EPUB to Kindle format (mobi/azw)
- Send eBooks to Kindle devices with the click of a button
- Support for reading eBooks directly in the browser (.txt, .epub, .pdf, .cbr, .cbt, .cbz)
- Upload new books in PDF, epub, fb2 format
- Docker swarm cluster with persistent shared storage
- Traefik configured per design
- DNS entry for the hostname you intend to use, pointed to your keepalived IP
Setup data locations¶
We'll need a directory to store some config data for Calibre-Web, container, so create /var/data/calibre-web, and ensure the directory is owned by the same use which owns your Calibre data (below)
mkdir /var/data/calibre-web chown calibre:calibre /var/data/calibre-web # for example
Ensure that your Calibre library is accessible to the swarm (i.e., exists on shared storage), and that the same user who owns the config directory above, also owns the actual calibre library data (including the ebooks managed by Calibre).
We'll use an oauth-proxy to protect the UI from public access, so create calibre-web.env, and populate with the following variables:
1 2 3 4 5
OAUTH2_PROXY_CLIENT_ID= OAUTH2_PROXY_CLIENT_SECRET= OAUTH2_PROXY_COOKIE_SECRET=<make this a random string> PUID= PGID=
Follow the instructions to setup your oauth provider. You need to setup a unique key/secret for each instance of the proxy you want to run, since in each case the callback URL will differ.
Setup Docker Swarm¶
Create a docker swarm config file in docker-compose syntax (v3), something like this:
I share (with my patreon patrons) a private "premix" git repository, which includes necessary docker-compose and env files for all published recipes. This means that patrons can launch any recipe with just a
git pull and a
docker stack deploy 👍
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
version: '3' services: app: image: technosoft2000/calibre-web env_file : /var/data/config/calibre-web/calibre-web.env volumes: - /var/data/calibre-web:/config - /srv/data/Archive/Ebooks/calibre:/books networks: - internal proxy: image: a5huynh/oauth2_proxy env_file : /var/data/config/calibre-web/calibre-web.env dns_search: hq.example.com networks: - internal - traefik_public deploy: labels: - traefik.frontend.rule=Host:calibre-web.example.com - traefik.docker.network=traefik_public - traefik.port=4180 volumes: - /var/data/config/calibre-web/authenticated-emails.txt:/authenticated-emails.txt command: | -cookie-secure=false -upstream=http://app:8083 -redirect-url=https://calibre-web.example.com -http-address=http://0.0.0.0:4180 -email-domain=example.com -provider=github -authenticated-emails-file=/authenticated-emails.txt networks: traefik_public: external: true internal: driver: overlay ipam: config: - subnet: 172.16.18.0/24
Setup unique static subnets for every stack you deploy. This avoids IP/gateway conflicts which can otherwise occur when you're creating/removing stacks a lot. See my list here.
Launch the Calibre-Web stack by running
docker stack deploy calibre-web -c <path -to-docker-compose.yml>
Log into your new instance at https://YOUR-FQDN. You'll be directed to the initial GUI configuraition. Set the first field (Location of Calibre database) to "/books/", and when complete, login using defaults username of "admin" with password "admin123".
- Yes, Calibre does provide a server component. But it's not as fully-featured as Calibre-Web (i.e., you can't use it to send ebooks directly to your Kindle)
- A future enhancement might be integrating this recipe with the filestore for NextCloud, so that the desktop database (Calibre) can be kept synced with Calibre-Web.
Tip your waiter (donate) 👏¶
Did you receive excellent service? Want to make your waiter happy? (..and support development of current and future recipes!) See the support page for (free or paid) ways to say thank you! 👏