Skip to content

Commit

Permalink
feat(service): add calibre-web
Browse files Browse the repository at this point in the history
  • Loading branch information
borjapazr committed Sep 8, 2023
1 parent e83a0bd commit 96aa2c5
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
10 changes: 10 additions & 0 deletions services/calibre-web/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Volume settings ##
VOLUME_DIR=

## Domain settings ##
DOMAIN=

## Timezone configuration ##
PUID=
PGID=
TZ=
15 changes: 15 additions & 0 deletions services/calibre-web/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
SERVICE := calibre-web
include $(ROOT_DIR)/../../core/common.mk
include .env

.ONESHELL:

.PHONY: install
install: ## Start all containers in background
@$(DOCKER_COMPOSE) up -d

.PHONY: uninstall
uninstall: ## Stop all containers and remove all data
@$(DOCKER_COMPOSE) down -v
@sudo rm -rf $(VOLUME_DIR)
53 changes: 53 additions & 0 deletions services/calibre-web/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: "3.7"

services:
### Calibre Web: A web app providing a clean interface for browsing, reading and downloading eBooks using an existing Calibre database. ###
calibre-web:
image: lscr.io/linuxserver/calibre-web:0.6.20
container_name: calibre-web
restart: always
environment:
- PUID=${PUID}
- PGID=${PGID}
- DOCKER_MODS=linuxserver/mods:universal-calibre
- TZ=${TZ}
volumes:
- ${VOLUME_DIR}/data:/config
- ${VOLUME_DIR}/library:/books
- ./mods:/custom-cont-init.d:ro
networks:
- default
- traefik-network
ports:
- 8083:8083
labels:
## Watchtower configuration ##
- com.centurylinklabs.watchtower.enable=true
- com.centurylinklabs.watchtower.monitor-only=true

## Diun configuration ##
- diun.enable=true

## Traefik configuration ##
# Enable Traefik #
- traefik.enable=true
- traefik.docker.network=traefik-network

# Set entrypoint port #
- traefik.http.services.calibre.loadbalancer.server.port=8083

# Set HTTP domain and HTTP -> HTTPS redirection #
- traefik.http.routers.calibre.rule=Host(`${DOMAIN}`)
- traefik.http.routers.calibre.entrypoints=web
- traefik.http.routers.calibre.middlewares=https-redirect@file

# Set HTTPS domain #
- traefik.http.routers.calibre-secure.rule=Host(`${DOMAIN}`)
- traefik.http.routers.calibre-secure.entrypoints=websecure

networks:
default:
name: calibre-network
traefik-network:
name: traefik-network
external: true
7 changes: 7 additions & 0 deletions services/calibre-web/mods/fix-cloudflare-login.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

echo "**** patching calibre-web - removing session protection ****"

sed -i "/lm.session_protection = 'strong'/d" /app/calibre-web/cps/__init__.py
sed -i "/if not ub.check_user_session(current_user.id, flask_session.get('_id')) and 'opds' not in request.path:/d" /app/calibre-web/cps/admin.py
sed -i "/logout_user()/d" /app/calibre-web/cps/admin.py

0 comments on commit 96aa2c5

Please sign in to comment.