Skip to content

Commit

Permalink
Fix Calibre merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
davestephens committed Mar 13, 2024
2 parents 952220b + 89d6416 commit 29a888d
Show file tree
Hide file tree
Showing 15 changed files with 265 additions and 34 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Bazarr](https://github.com/morpheus65535/bazarr) - companion to Radarr and Sonarr for downloading subtitles
* [Bitwarden](https://github.com/dani-garcia/vaultwarden) - Password Manger (Technically Vaultwarden, a lightweight implementation in Rust)
* [Booksonic](https://booksonic.org/) - The selfhosted audiobook server
* [Calibre](https://calibre-ebook.com) - Calibre is a powerful and easy to use e-book manager.
* [Calibre-web](https://github.com/janeczku/calibre-web) - Provides a clean interface for browsing, reading and downloading eBooks using an existing Calibre database.
* [Code Server](https://code.visualstudio.com/) - Powerful IDE from Microsoft accessible through the browser
* [Cloud Commander](https://cloudcmd.io/) - A dual panel file manager with integrated web console and text editor
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
tags:
- calibre

- role: calibreweb
tags:
- calibreweb

- role: cloudcmd
tags:
- cloudcmd
Expand Down
20 changes: 12 additions & 8 deletions roles/calibre/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
---
calibre_enabled: false
calibre_available_externally: false
calibre_available_externally: "false"

# uid / gid
calibre_user_id: "0"
calibre_group_id: "0"
calibre_user_id: "1000"
calibre_group_id: "1000"

# directories
calibre_data_directory: "{{ docker_home }}/calibre"
calibre_books_root: "{{ books_root }}"

# other
calibre_ebook_conversion: "linuxserver/calibre-web:calibre"
calibre_books_directory: "{{ books_root }}"
calibre_comics_directory: "{{ comics_root }}"

# network
calibre_port: "8084"
calibre_port: "8093"
calibre_webserver_port: "8094"
calibre_hostname: "calibre"

# env
calibre_password: ""
calibre_cli_args: ""
calibre_security_opts: "seccomp=unconfined" # For why this is here, see https://github.com/linuxserver/docker-calibre/issues/102

# specs
calibre_memory: 1g

Expand Down
24 changes: 24 additions & 0 deletions roles/calibre/docs/calibre.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Calibre

Homepage: [https://calibre-ebook.com](https://calibre-ebook.com)

Calibre is a powerful and easy to use e-book manager.

## Usage

Set `calibre_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.

## Specific Configuration

By default, there is no password set for the main gui. Optional `calibre_password` will allow setting a password for the user `abc`.

Optionally, cli start arguments can be passed to calibre using `calibre_cli_args`.

The Calibre webserver must be turned on in the Calibre manager to make it available at the selected port (8094 by default).

## Ports

```yml
calibre_port: "8093"
calibre_webserver_port: "8094"
```
1 change: 0 additions & 1 deletion roles/calibre/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ provisioner:
group_vars:
all:
calibre_enabled: true
calibre_port: "8085" # 8084 is used by github actions
25 changes: 15 additions & 10 deletions roles/calibre/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
---
- name: Start Calibre
block:
- name: Create Calibre-web Directories
- name: Create Calibre Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: 0755
with_items:
- "{{ calibre_data_directory }}/config"
- "{{ calibre_data_directory }}/data"

- name: Calibre-web Docker Container
- name: Calibre Docker Container
community.docker.docker_container:
name: "{{ calibre_container_name }}"
image: linuxserver/calibre-web:latest
image: linuxserver/calibre
pull: true
volumes:
- "{{ calibre_data_directory }}/config:/config"
- "{{ calibre_books_root }}:/books"
- "{{ calibre_data_directory }}/data:/config:rw"
- "{{ calibre_books_directory }}:/books:rw"
- "{{ calibre_comics_directory }}:/comics:rw"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ calibre_user_id }}"
PGID: "{{ calibre_group_id }}"
DOCKER_MODS: "{{ calibre_ebook_conversion }}"
PASSWORD: "{{ calibre_password }}"
CLI_ARGS: "{{ calibre_cli_args }}"
ports:
- "{{ calibre_port }}:8083"
- "{{ calibre_port }}:8080"
- "{{ calibre_webserver_port }}:8081"
security_opts: "{{ calibre_security_opts }}"
restart_policy: unless-stopped
memory: "{{ calibre_memory }}"
labels:
traefik.enable: "{{ calibre_available_externally | string }}"
traefik.http.routers.calibre.rule: "Host(`calibre.{{ ansible_nas_domain }}`)"
traefik.http.routers.calibre.rule: "Host(`{{ calibre_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.calibre.tls.certresolver: "letsencrypt"
traefik.http.routers.calibre.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.calibre.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.calibre.loadbalancer.server.port: "8083"
traefik.http.services.calibre.loadbalancer.server.port: "8080"
when: calibre_enabled is true

- name: Stop Calibre
Expand Down
24 changes: 24 additions & 0 deletions roles/calibreweb/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
calibreweb_enabled: false
calibreweb_available_externally: false

# uid / gid
calibreweb_user_id: "0"
calibreweb_group_id: "0"

# directories
calibreweb_data_directory: "{{ docker_home }}/calibreweb"
calibreweb_books_root: "{{ books_root }}"

# other
calibreweb_ebook_conversion: "linuxserver/calibre-web:calibre"

# network
calibreweb_port: "8084"
calibreweb_hostname: "calibreweb"

# specs
calibreweb_memory: 1g

# docker
calibreweb_container_name: calibreweb
37 changes: 37 additions & 0 deletions roles/calibreweb/docs/calibre-web.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# "Calibre-web"

Homepage: <https://github.com/janeczku/calibre-web>

Calibre-Web is a web app providing a clean interface for browsing, reading and downloading eBooks using an existing Calibre database.

## Usage

Set `calibreweb_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.

## Specific Configuration

Requires Calibre ebook management program. Available for download [here](https://calibre-ebook.com/download).

### Admin login

**Default admin login:** Username: admin Password: admin123

### eBook Conversion

If you do not need eBook conversion you can disable it to save resources by setting the `calibreweb_ebook_conversion` variable in `group_vars/all.yml` file to be empty.

- Conversion enabled: `calibreweb_ebook_conversion: "linuxserver/calibre-web:calibre"`

- Conversion disabled: `calibreweb_ebook_conversion: ""`

You can target just Calibre by appending `-t calibre` to your `ansible-playbook` command.

## Use with Calibre

Ansible-NAS add [../calibre](Calibre) long after Calibre-web. To allow Calibre-web direct access to the Calibre database, both applications can share a Docker data directory. To do so, include the following in your inventory `nas.yml`:

```yml
calibreweb_data_directory: "{{ docker_home }}/calibre"
```
In this case, the Calibre Database Directory is `/data/Calibre Library`.
7 changes: 7 additions & 0 deletions roles/calibreweb/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
provisioner:
inventory:
group_vars:
all:
calibreweb_enabled: true
calibreweb_port: "8085" # 8084 is used by github actions
10 changes: 10 additions & 0 deletions roles/calibreweb/molecule/default/side_effect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Stop
hosts: all
become: true
tasks:
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
calibreweb_enabled: false
18 changes: 18 additions & 0 deletions roles/calibreweb/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- include_vars:
file: ../../defaults/main.yml

- name: Get container state
docker_container_info:
name: "{{ calibreweb_container_name }}"
register: result

- name: Check Calibre-web is running
assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
18 changes: 18 additions & 0 deletions roles/calibreweb/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- include_vars:
file: ../../defaults/main.yml

- name: Try and stop and remove Calibre-web
docker_container:
name: "{{ calibreweb_container_name }}"
state: absent
register: result

- name: Check Calibre-web is stopped
assert:
that:
- not result.changed
44 changes: 44 additions & 0 deletions roles/calibreweb/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
- name: Start Calibre-web
block:
- name: Create Calibre-web Directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ calibreweb_data_directory }}/config"

- name: Calibre-web Docker Container
docker_container:
name: "{{ calibreweb_container_name }}"
image: linuxserver/calibre-web:latest
pull: true
volumes:
- "{{ calibreweb_data_directory }}/config:/config"
- "{{ calibreweb_books_root }}:/books"
- "{{ calibreweb_data_directory }}/data:/data"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ calibreweb_user_id }}"
PGID: "{{ calibreweb_group_id }}"
DOCKER_MODS: "{{ calibreweb_ebook_conversion }}"
ports:
- "{{ calibreweb_port }}:8083"
restart_policy: unless-stopped
memory: "{{ calibreweb_memory }}"
labels:
traefik.enable: "{{ calibreweb_available_externally | string }}"
traefik.http.routers.calibreweb.rule: "Host(`{{ calibreweb_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.calibreweb.tls.certresolver: "letsencrypt"
traefik.http.routers.calibreweb.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.calibreweb.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.calibreweb.loadbalancer.server.port: "8083"
when: calibreweb_enabled is true

- name: Stop Calibre-web
block:
- name: Stop Calibre-web
docker_container:
name: "{{ calibreweb_container_name }}"
state: absent
when: calibreweb_enabled is false
39 changes: 39 additions & 0 deletions website/docs/applications/media-serving/calibre-web.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: "Calibre-web"
---

Homepage: <https://github.com/janeczku/calibre-web>

Calibre-Web is a web app providing a clean interface for browsing, reading and downloading eBooks using an existing Calibre database.

## Usage

Set `calibreweb_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.

## Specific Configuration

Requires Calibre ebook management program. Available for download [here](https://calibre-ebook.com/download).

### Admin login

**Default admin login:** Username: admin Password: admin123

### eBook Conversion

If you do not need eBook conversion you can disable it to save resources by setting the `calibreweb_ebook_conversion` variable in `group_vars/all.yml` file to be empty.

- Conversion enabled: `calibreweb_ebook_conversion: "linuxserver/calibre-web:calibre"`

- Conversion disabled: `calibreweb_ebook_conversion: ""`

You can target just Calibre by appending `-t calibre` to your `ansible-playbook` command.

## Use with Calibre

Ansible-NAS add [../calibre](Calibre) long after Calibre-web. To allow Calibre-web direct access to the Calibre database, both applications can share a Docker data directory. To do so, include the following in your inventory `nas.yml`:

```yml
calibreweb_data_directory: "{{ docker_home }}/calibre"
```
In this case, the Calibre Database Directory is `/data/Calibre Library`.
27 changes: 12 additions & 15 deletions website/docs/applications/media-serving/calibre.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
---
title: "Calibre-web"
Title: Calibre
---

Homepage: [https://github.com/janeczku/calibre-web](https://github.com/janeczku/calibre-web)
Homepage: [https://calibre-ebook.com](https://calibre-ebook.com)

Calibre-Web is a web app providing a clean interface for browsing, reading and downloading eBooks using an existing Calibre database.
Calibre is a powerful and easy to use e-book manager.

## Usage

Set `calibre_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file.
Set `calibre_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.

## Specific Configuration

Requires Calibre ebook management program. Available for download [here](https://calibre-ebook.com/download).
By default, there is no password set for the main gui. Optional `calibre_password` will allow setting a password for the user `abc`.

### Admin login
Optionally, cli start arguments can be passed to calibre using `calibre_cli_args`.

**Default admin login:** Username: admin Password: admin123
The Calibre webserver must be turned on in the Calibre manager to make it available at the selected port (8094 by default).

### eBook Conversion
## Ports

If you do not need eBook conversion you can disable it to save resources by setting the `calibre_ebook_conversion` variable in `group_vars/all.yml` file to be empty.

- Conversion enabled: `calibre_ebook_conversion: "linuxserver/calibre-web:calibre"`

- Conversion disabled: `calibre_ebook_conversion: ""`

You can target just Calibre by appending `-t calibre` to your `ansible-playbook` command.
```yml
calibre_port: "8093"
calibre_webserver_port: "8094"
```

0 comments on commit 29a888d

Please sign in to comment.