Calibre Powered Online Book Store

1 minute read

Generate Calibre Database

This is mandatory for calibre-web setup, first install calibre and generate the database on host machine:

sudo apt install -y calibre

Launch Calibre and add books, calibre will create a database in $HOME/Calibre Library/metadata.db, copy this file to $HOME/docker/calibre-web/data.

Run Calibre-web in docker

A docker image for calibre-web was created by linuxserver, create the docker-compose.yml as below:

version: "2.1"
services:
  calibre-web:
    container_name: ${CALIBRE_NAME}
    image: linuxserver/calibre-web:${CALIBRE_VERSION}
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - DOCKER_MODS=linuxserver/calibre-web:calibre # optional
      - OAUTHLIB_RELAX_TOKEN_SCOPE=1 # optional
    volumes:
      - ${PWD}/data:/config
      - ${PWD}/calibre/library:/books
    ports:
      - 8083:8083
    restart: unless-stopped

And start docker:

docker-compose up -d

Create a CNAME record with cloudflared

For accessing the calibre-web service from outside, a route to cloudflare tunnel is required to be created:

cd $HOME/docker/cloudflared
docker run -v ${PWD}/cloudflared:/etc/cloudflared cloudflare/cloudflared:2022.5.1 tunnel route dns my-tunnel calibre-test.baylabs.cc

And add an entry to $HOME/docker/cloudflared/cloudflared/config.yml

 - hostname: calibre-test.baylabs.cc
   service: http://192.168.0.15:8083

Restart cloudflared to make it recognize the newly added service:

docker-compose restart

Database Configuration

Login to https://calibre-test.baylabs.cc with admin@admin123, and set the location of the calibre database as follows: Database Configuration

Enable e-book uploading and online view

Enable uploading

  • Click Admin (the second icon from left)
  • Under Configuration section, click Edit Basic Configuration » Feature Configuration
  • Select Enable Uploads

Enable view books online

  • Click Admin (the third icon from right) » Edit Users
  • Click Edit User in the first column of the next page
  • Select Allow eBook Viewer and Allow Uploads After configuration completed, a button labeled Upload will show up.

Delete A Book

Select a book » Edit Metadata » Delete Book