From 1b87b918c188509e03d8a1a3b78b958802e50fb3 Mon Sep 17 00:00:00 2001 From: eniad Date: Tue, 4 Oct 2022 22:35:44 -0400 Subject: [PATCH 1/8] add calibremanager --- README.md | 1 + nas.yml | 5 +++ roles/calibre/tasks/main.yml | 1 + roles/calibremanager/defaults/main.yml | 28 ++++++++++++ .../molecule/default/molecule.yml | 6 +++ .../molecule/default/side_effect.yml | 10 +++++ .../molecule/default/verify.yml | 18 ++++++++ .../molecule/default/verify_stopped.yml | 18 ++++++++ roles/calibremanager/tasks/main.yml | 45 +++++++++++++++++++ .../media-serving/calibremanager.md | 34 ++++++++++++++ 10 files changed, 166 insertions(+) create mode 100644 roles/calibremanager/defaults/main.yml create mode 100644 roles/calibremanager/molecule/default/molecule.yml create mode 100644 roles/calibremanager/molecule/default/side_effect.yml create mode 100644 roles/calibremanager/molecule/default/verify.yml create mode 100644 roles/calibremanager/molecule/default/verify_stopped.yml create mode 100644 roles/calibremanager/tasks/main.yml create mode 100644 website/docs/applications/media-serving/calibremanager.md diff --git a/README.md b/README.md index 38a939a2a7..eae1ddaf81 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ If you have a spare domain name you can configure applications to be accessible * [Bitwarden_rs](https://github.com/dani-garcia/bitwarden_rs) - Self-Hosting port of password manager * [Booksonic](https://booksonic.org/) - The selfhosted audiobook server * [Calibre-web](https://github.com/janeczku/calibre-web) - Provides a clean interface for browsing, reading and downloading eBooks using an existing Calibre database. +* [Calibre](https://calibre-ebook.com) - Calibre is a powerful and easy to use e-book manager. * [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 * [Cloudflare DDNS](https://hub.docker.com/r/joshuaavalon/cloudflare-ddns/) - automatically update Cloudflare with your IP address diff --git a/nas.yml b/nas.yml index da82bc9acf..9166cb12c6 100644 --- a/nas.yml +++ b/nas.yml @@ -61,6 +61,11 @@ tags: - calibre + - role: calibremanager + tags: + - calibremanager + when: (calibremanager_enabled | default(False)) + - role: cloudcmd tags: - cloudcmd diff --git a/roles/calibre/tasks/main.yml b/roles/calibre/tasks/main.yml index 0a98a5c4d0..b6c02e77a5 100644 --- a/roles/calibre/tasks/main.yml +++ b/roles/calibre/tasks/main.yml @@ -16,6 +16,7 @@ volumes: - "{{ calibre_data_directory }}/config:/config" - "{{ calibre_books_root }}:/books" + - "{{ calibre_data_directory }}/data:/data" env: TZ: "{{ ansible_nas_timezone }}" PUID: "{{ calibre_user_id }}" diff --git a/roles/calibremanager/defaults/main.yml b/roles/calibremanager/defaults/main.yml new file mode 100644 index 0000000000..f6cbc88b31 --- /dev/null +++ b/roles/calibremanager/defaults/main.yml @@ -0,0 +1,28 @@ +--- +calibremanager_enabled: false +calibremanager_available_externally: "false" + +# uid / gid +calibremanager_user_id: "1000" +calibremanager_group_id: "1000" + +# directories +calibremanager_data_directory: "{{ docker_home }}/calibremanager" +calibremanager_books_directory: "{{ books_root }}" +calibremanager_comics_directory: "{{ comics_root }}" + +# network +calibremanager_port: "8093" +calibremanager_webserver_port: "8094" +calibremanager_hostname: "calibremanager" + +# env +calibremanager_password: "" +calibremanager_cli_args: "" +calibremanager_security_opts: "seccomp=unconfined" # For why this is here, see https://github.com/linuxserver/docker-calibre/issues/102 + +# specs +calibremanager_memory: 1g + +# docker +calibremanager_container_name: calibremanager diff --git a/roles/calibremanager/molecule/default/molecule.yml b/roles/calibremanager/molecule/default/molecule.yml new file mode 100644 index 0000000000..9f13c2558c --- /dev/null +++ b/roles/calibremanager/molecule/default/molecule.yml @@ -0,0 +1,6 @@ +--- +provisioner: + inventory: + group_vars: + all: + calibremanager_enabled: true diff --git a/roles/calibremanager/molecule/default/side_effect.yml b/roles/calibremanager/molecule/default/side_effect.yml new file mode 100644 index 0000000000..1fa2b2a6ab --- /dev/null +++ b/roles/calibremanager/molecule/default/side_effect.yml @@ -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: + calibremanager_enabled: false diff --git a/roles/calibremanager/molecule/default/verify.yml b/roles/calibremanager/molecule/default/verify.yml new file mode 100644 index 0000000000..7e1a983c00 --- /dev/null +++ b/roles/calibremanager/molecule/default/verify.yml @@ -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: "{{ calibremanager_container_name }}" + register: result + + - name: Check Calibre is running + assert: + that: + - result.container['State']['Status'] == "running" + - result.container['State']['Restarting'] == false diff --git a/roles/calibremanager/molecule/default/verify_stopped.yml b/roles/calibremanager/molecule/default/verify_stopped.yml new file mode 100644 index 0000000000..86bdf0836d --- /dev/null +++ b/roles/calibremanager/molecule/default/verify_stopped.yml @@ -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 + docker_container: + name: "{{ calibremanager_container_name }}" + state: absent + register: result + + - name: Check Calibre is stopped + assert: + that: + - not result.changed diff --git a/roles/calibremanager/tasks/main.yml b/roles/calibremanager/tasks/main.yml new file mode 100644 index 0000000000..447b0928ac --- /dev/null +++ b/roles/calibremanager/tasks/main.yml @@ -0,0 +1,45 @@ +--- +- name: Create Calibre Directories + file: + path: "{{ item }}" + state: directory + mode: 0755 + with_items: + - "{{ calibremanager_data_directory }}/data" + +- name: Calibre Docker Container + docker_container: + name: "{{ calibremanager_container_name }}" + image: linuxserver/calibre + pull: true + volumes: + - "{{ calibremanager_data_directory }}/data:/config:rw" + - "{{ calibremanager_books_directory }}:/books:rw" + - "{{ calibremanager_comics_directory }}:/comics:rw" + ports: + - "{{ calibremanager_port }}:8080" + - "{{ calibremanager_webserver_port }}:8081" + security_opts: "{{ calibremanager_security_opts }}" + env: + TZ: "{{ ansible_nas_timezone }}" + PUID: "{{ calibremanager_user_id }}" + PGID: "{{ calibremanager_group_id }}" + PASSWORD: "{{ calibremanager_password }}" + CLI_ARGS: "{{ calibremanager_cli_args }}" + restart_policy: unless-stopped + memory: "{{ calibremanager_memory }}" + labels: + traefik.enable: "{{ calibremanager_available_externally }}" + traefik.http.routers.calibre.rule: "Host(`{{ calibremanager_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: "8080" + +- name: Stop Calibre Manager + block: + - name: Stop Calibre Manager + docker_container: + name: "{{ calibremanager_container_name }}" + state: absent + when: calibremanager_enabled is false \ No newline at end of file diff --git a/website/docs/applications/media-serving/calibremanager.md b/website/docs/applications/media-serving/calibremanager.md new file mode 100644 index 0000000000..cb462b5d12 --- /dev/null +++ b/website/docs/applications/media-serving/calibremanager.md @@ -0,0 +1,34 @@ +# Calibre + +Homepage: [https://calibre-ebook.com](https://calibre-ebook.com) + +Calibre is a powerful and easy to use e-book manager. + +## Usage + +Set `calibremanager_enabled: true` in your `inventories//nas.yml` file. + +## Specific Configuration + +By default, there is no password set for the main gui. Optional `calibremanager_password` will allow setting a password for the user `abc`. + +Optionally, cli start arguments can be passed to calibre using `calibremanager_cli_args`. + +The Calibre webserver must be turned on in the Calibre manager to make it available at the selected port (8094 by default). + +## Use with Calibre-web + +Ansible-NAS has long come with [../calibre](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 +calibremanager_data_directory: "{{ docker_home }}/calibre" +``` + +In this case, the Calibre Database Directory is `/data/Calibre Library` + +## Ports + +```yml +calibremanager_port: "8093" +calibremanager_webserver_port: "8094" +``` From bdcaca6a7c3e875fe1ef2c7a46cc710f3d1991f6 Mon Sep 17 00:00:00 2001 From: eniad Date: Tue, 4 Oct 2022 23:46:56 -0400 Subject: [PATCH 2/8] linting calibremanager role --- roles/calibremanager/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/calibremanager/tasks/main.yml b/roles/calibremanager/tasks/main.yml index 447b0928ac..9d3f262232 100644 --- a/roles/calibremanager/tasks/main.yml +++ b/roles/calibremanager/tasks/main.yml @@ -19,7 +19,7 @@ ports: - "{{ calibremanager_port }}:8080" - "{{ calibremanager_webserver_port }}:8081" - security_opts: "{{ calibremanager_security_opts }}" + security_opts: "{{ calibremanager_security_opts }}" env: TZ: "{{ ansible_nas_timezone }}" PUID: "{{ calibremanager_user_id }}" @@ -42,4 +42,4 @@ docker_container: name: "{{ calibremanager_container_name }}" state: absent - when: calibremanager_enabled is false \ No newline at end of file + when: calibremanager_enabled is false From 68352004f327a7af229d73bb0289cca5fafdb812 Mon Sep 17 00:00:00 2001 From: eniad Date: Wed, 5 Oct 2022 20:56:53 -0400 Subject: [PATCH 3/8] reformat calibremanager task to match new format --- nas.yml | 1 - roles/calibremanager/tasks/main.yml | 73 +++++++++++++++-------------- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/nas.yml b/nas.yml index 9166cb12c6..5af29495fb 100644 --- a/nas.yml +++ b/nas.yml @@ -64,7 +64,6 @@ - role: calibremanager tags: - calibremanager - when: (calibremanager_enabled | default(False)) - role: cloudcmd tags: diff --git a/roles/calibremanager/tasks/main.yml b/roles/calibremanager/tasks/main.yml index 9d3f262232..63fbce0dcd 100644 --- a/roles/calibremanager/tasks/main.yml +++ b/roles/calibremanager/tasks/main.yml @@ -1,40 +1,43 @@ --- -- name: Create Calibre Directories - file: - path: "{{ item }}" - state: directory - mode: 0755 - with_items: - - "{{ calibremanager_data_directory }}/data" +- name: Start Calibre Manager + block: + - name: Create Calibre Manager Directories + file: + path: "{{ item }}" + state: directory + mode: 0755 + with_items: + - "{{ calibremanager_data_directory }}/data" -- name: Calibre Docker Container - docker_container: - name: "{{ calibremanager_container_name }}" - image: linuxserver/calibre - pull: true - volumes: - - "{{ calibremanager_data_directory }}/data:/config:rw" - - "{{ calibremanager_books_directory }}:/books:rw" - - "{{ calibremanager_comics_directory }}:/comics:rw" - ports: - - "{{ calibremanager_port }}:8080" - - "{{ calibremanager_webserver_port }}:8081" - security_opts: "{{ calibremanager_security_opts }}" - env: - TZ: "{{ ansible_nas_timezone }}" - PUID: "{{ calibremanager_user_id }}" - PGID: "{{ calibremanager_group_id }}" - PASSWORD: "{{ calibremanager_password }}" - CLI_ARGS: "{{ calibremanager_cli_args }}" - restart_policy: unless-stopped - memory: "{{ calibremanager_memory }}" - labels: - traefik.enable: "{{ calibremanager_available_externally }}" - traefik.http.routers.calibre.rule: "Host(`{{ calibremanager_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: "8080" + - name: Calibre Docker Container + docker_container: + name: "{{ calibremanager_container_name }}" + image: linuxserver/calibre + pull: true + volumes: + - "{{ calibremanager_data_directory }}/data:/config:rw" + - "{{ calibremanager_books_directory }}:/books:rw" + - "{{ calibremanager_comics_directory }}:/comics:rw" + env: + TZ: "{{ ansible_nas_timezone }}" + PUID: "{{ calibremanager_user_id }}" + PGID: "{{ calibremanager_group_id }}" + PASSWORD: "{{ calibremanager_password }}" + CLI_ARGS: "{{ calibremanager_cli_args }}" + ports: + - "{{ calibremanager_port }}:8080" + - "{{ calibremanager_webserver_port }}:8081" + security_opts: "{{ calibremanager_security_opts }}" + restart_policy: unless-stopped + memory: "{{ calibremanager_memory }}" + labels: + traefik.enable: "{{ calibremanager_available_externally | string }}" + traefik.http.routers.calibremanager.rule: "Host(`{{ calibremanager_hostname }}.{{ ansible_nas_domain }}`)" + traefik.http.routers.calibremanager.tls.certresolver: "letsencrypt" + traefik.http.routers.calibremanager.tls.domains[0].main: "{{ ansible_nas_domain }}" + traefik.http.routers.calibremanager.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" + traefik.http.services.calibremanager.loadbalancer.server.port: "8080" + when: calibremanager_enabled is true - name: Stop Calibre Manager block: From 1e3c150fffb2fbc4d9914c3000bbf65d495ec7e2 Mon Sep 17 00:00:00 2001 From: eniad Date: Thu, 6 Oct 2022 15:01:09 -0400 Subject: [PATCH 4/8] rename misnamed calibre role to calibreweb --- nas.yml | 4 +- roles/calibre/defaults/main.yml | 20 ++++---- roles/calibre/molecule/default/molecule.yml | 1 - roles/calibre/tasks/main.yml | 32 +++++++------ roles/calibremanager/defaults/main.yml | 28 ----------- .../molecule/default/molecule.yml | 6 --- roles/calibremanager/tasks/main.yml | 48 ------------------- roles/calibreweb/defaults/main.yml | 24 ++++++++++ .../calibreweb/molecule/default/molecule.yml | 7 +++ .../molecule/default/side_effect.yml | 2 +- .../molecule/default/verify.yml | 2 +- .../molecule/default/verify_stopped.yml | 2 +- roles/calibreweb/tasks/main.yml | 44 +++++++++++++++++ .../applications/media-serving/calibre-web.md | 39 +++++++++++++++ .../applications/media-serving/calibre.md | 27 +++++------ .../media-serving/calibremanager.md | 34 ------------- 16 files changed, 160 insertions(+), 160 deletions(-) delete mode 100644 roles/calibremanager/defaults/main.yml delete mode 100644 roles/calibremanager/molecule/default/molecule.yml delete mode 100644 roles/calibremanager/tasks/main.yml create mode 100644 roles/calibreweb/defaults/main.yml create mode 100644 roles/calibreweb/molecule/default/molecule.yml rename roles/{calibremanager => calibreweb}/molecule/default/side_effect.yml (86%) rename roles/{calibremanager => calibreweb}/molecule/default/verify.yml (88%) rename roles/{calibremanager => calibreweb}/molecule/default/verify_stopped.yml (86%) create mode 100644 roles/calibreweb/tasks/main.yml create mode 100644 website/docs/applications/media-serving/calibre-web.md delete mode 100644 website/docs/applications/media-serving/calibremanager.md diff --git a/nas.yml b/nas.yml index 5af29495fb..621ae0fcce 100644 --- a/nas.yml +++ b/nas.yml @@ -61,9 +61,9 @@ tags: - calibre - - role: calibremanager + - role: calibreweb tags: - - calibremanager + - calibreweb - role: cloudcmd tags: diff --git a/roles/calibre/defaults/main.yml b/roles/calibre/defaults/main.yml index f5c0289b5c..602c21055f 100644 --- a/roles/calibre/defaults/main.yml +++ b/roles/calibre/defaults/main.yml @@ -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 diff --git a/roles/calibre/molecule/default/molecule.yml b/roles/calibre/molecule/default/molecule.yml index bc8274e36c..ba7b4d59c5 100644 --- a/roles/calibre/molecule/default/molecule.yml +++ b/roles/calibre/molecule/default/molecule.yml @@ -4,4 +4,3 @@ provisioner: group_vars: all: calibre_enabled: true - calibre_port: "8085" # 8084 is used by github actions diff --git a/roles/calibre/tasks/main.yml b/roles/calibre/tasks/main.yml index b6c02e77a5..1fe1b23673 100644 --- a/roles/calibre/tasks/main.yml +++ b/roles/calibre/tasks/main.yml @@ -1,43 +1,47 @@ --- -- name: Start Calibre +- name: Start Calibre Manager block: - - name: Create Calibre-web Directories + - name: Create Calibre Manager Directories 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 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:/data" + - "{{ 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 +- name: Stop Calibre Manager block: - - name: Stop Calibre + - name: Stop Calibre Manager docker_container: name: "{{ calibre_container_name }}" state: absent diff --git a/roles/calibremanager/defaults/main.yml b/roles/calibremanager/defaults/main.yml deleted file mode 100644 index f6cbc88b31..0000000000 --- a/roles/calibremanager/defaults/main.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -calibremanager_enabled: false -calibremanager_available_externally: "false" - -# uid / gid -calibremanager_user_id: "1000" -calibremanager_group_id: "1000" - -# directories -calibremanager_data_directory: "{{ docker_home }}/calibremanager" -calibremanager_books_directory: "{{ books_root }}" -calibremanager_comics_directory: "{{ comics_root }}" - -# network -calibremanager_port: "8093" -calibremanager_webserver_port: "8094" -calibremanager_hostname: "calibremanager" - -# env -calibremanager_password: "" -calibremanager_cli_args: "" -calibremanager_security_opts: "seccomp=unconfined" # For why this is here, see https://github.com/linuxserver/docker-calibre/issues/102 - -# specs -calibremanager_memory: 1g - -# docker -calibremanager_container_name: calibremanager diff --git a/roles/calibremanager/molecule/default/molecule.yml b/roles/calibremanager/molecule/default/molecule.yml deleted file mode 100644 index 9f13c2558c..0000000000 --- a/roles/calibremanager/molecule/default/molecule.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -provisioner: - inventory: - group_vars: - all: - calibremanager_enabled: true diff --git a/roles/calibremanager/tasks/main.yml b/roles/calibremanager/tasks/main.yml deleted file mode 100644 index 63fbce0dcd..0000000000 --- a/roles/calibremanager/tasks/main.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -- name: Start Calibre Manager - block: - - name: Create Calibre Manager Directories - file: - path: "{{ item }}" - state: directory - mode: 0755 - with_items: - - "{{ calibremanager_data_directory }}/data" - - - name: Calibre Docker Container - docker_container: - name: "{{ calibremanager_container_name }}" - image: linuxserver/calibre - pull: true - volumes: - - "{{ calibremanager_data_directory }}/data:/config:rw" - - "{{ calibremanager_books_directory }}:/books:rw" - - "{{ calibremanager_comics_directory }}:/comics:rw" - env: - TZ: "{{ ansible_nas_timezone }}" - PUID: "{{ calibremanager_user_id }}" - PGID: "{{ calibremanager_group_id }}" - PASSWORD: "{{ calibremanager_password }}" - CLI_ARGS: "{{ calibremanager_cli_args }}" - ports: - - "{{ calibremanager_port }}:8080" - - "{{ calibremanager_webserver_port }}:8081" - security_opts: "{{ calibremanager_security_opts }}" - restart_policy: unless-stopped - memory: "{{ calibremanager_memory }}" - labels: - traefik.enable: "{{ calibremanager_available_externally | string }}" - traefik.http.routers.calibremanager.rule: "Host(`{{ calibremanager_hostname }}.{{ ansible_nas_domain }}`)" - traefik.http.routers.calibremanager.tls.certresolver: "letsencrypt" - traefik.http.routers.calibremanager.tls.domains[0].main: "{{ ansible_nas_domain }}" - traefik.http.routers.calibremanager.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" - traefik.http.services.calibremanager.loadbalancer.server.port: "8080" - when: calibremanager_enabled is true - -- name: Stop Calibre Manager - block: - - name: Stop Calibre Manager - docker_container: - name: "{{ calibremanager_container_name }}" - state: absent - when: calibremanager_enabled is false diff --git a/roles/calibreweb/defaults/main.yml b/roles/calibreweb/defaults/main.yml new file mode 100644 index 0000000000..1a8abfc92a --- /dev/null +++ b/roles/calibreweb/defaults/main.yml @@ -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 diff --git a/roles/calibreweb/molecule/default/molecule.yml b/roles/calibreweb/molecule/default/molecule.yml new file mode 100644 index 0000000000..cbb41075f6 --- /dev/null +++ b/roles/calibreweb/molecule/default/molecule.yml @@ -0,0 +1,7 @@ +--- +provisioner: + inventory: + group_vars: + all: + calibreweb_enabled: true + calibreweb_port: "8085" # 8084 is used by github actions diff --git a/roles/calibremanager/molecule/default/side_effect.yml b/roles/calibreweb/molecule/default/side_effect.yml similarity index 86% rename from roles/calibremanager/molecule/default/side_effect.yml rename to roles/calibreweb/molecule/default/side_effect.yml index 1fa2b2a6ab..704ce061b6 100644 --- a/roles/calibremanager/molecule/default/side_effect.yml +++ b/roles/calibreweb/molecule/default/side_effect.yml @@ -7,4 +7,4 @@ include_role: name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" vars: - calibremanager_enabled: false + calibreweb_enabled: false diff --git a/roles/calibremanager/molecule/default/verify.yml b/roles/calibreweb/molecule/default/verify.yml similarity index 88% rename from roles/calibremanager/molecule/default/verify.yml rename to roles/calibreweb/molecule/default/verify.yml index 7e1a983c00..12bf6ba8e2 100644 --- a/roles/calibremanager/molecule/default/verify.yml +++ b/roles/calibreweb/molecule/default/verify.yml @@ -8,7 +8,7 @@ - name: Get container state docker_container_info: - name: "{{ calibremanager_container_name }}" + name: "{{ calibreweb_container_name }}" register: result - name: Check Calibre is running diff --git a/roles/calibremanager/molecule/default/verify_stopped.yml b/roles/calibreweb/molecule/default/verify_stopped.yml similarity index 86% rename from roles/calibremanager/molecule/default/verify_stopped.yml rename to roles/calibreweb/molecule/default/verify_stopped.yml index 86bdf0836d..9e92e7ce98 100644 --- a/roles/calibremanager/molecule/default/verify_stopped.yml +++ b/roles/calibreweb/molecule/default/verify_stopped.yml @@ -8,7 +8,7 @@ - name: Try and stop and remove Calibre docker_container: - name: "{{ calibremanager_container_name }}" + name: "{{ calibreweb_container_name }}" state: absent register: result diff --git a/roles/calibreweb/tasks/main.yml b/roles/calibreweb/tasks/main.yml new file mode 100644 index 0000000000..e7411c3236 --- /dev/null +++ b/roles/calibreweb/tasks/main.yml @@ -0,0 +1,44 @@ +--- +- name: Start Calibre + 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 + block: + - name: Stop Calibre + docker_container: + name: "{{ calibreweb_container_name }}" + state: absent + when: calibreweb_enabled is false diff --git a/website/docs/applications/media-serving/calibre-web.md b/website/docs/applications/media-serving/calibre-web.md new file mode 100644 index 0000000000..d6b149cee7 --- /dev/null +++ b/website/docs/applications/media-serving/calibre-web.md @@ -0,0 +1,39 @@ +--- +title: "Calibre-web" +--- + +Homepage: + +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//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`. diff --git a/website/docs/applications/media-serving/calibre.md b/website/docs/applications/media-serving/calibre.md index 607a533b0b..0ae22af8da 100644 --- a/website/docs/applications/media-serving/calibre.md +++ b/website/docs/applications/media-serving/calibre.md @@ -1,10 +1,8 @@ ---- -title: "Calibre-web" ---- +# Calibre -Homepage: +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 @@ -12,18 +10,15 @@ Set `calibre_enabled: true` in your `inventories//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" +``` diff --git a/website/docs/applications/media-serving/calibremanager.md b/website/docs/applications/media-serving/calibremanager.md deleted file mode 100644 index cb462b5d12..0000000000 --- a/website/docs/applications/media-serving/calibremanager.md +++ /dev/null @@ -1,34 +0,0 @@ -# Calibre - -Homepage: [https://calibre-ebook.com](https://calibre-ebook.com) - -Calibre is a powerful and easy to use e-book manager. - -## Usage - -Set `calibremanager_enabled: true` in your `inventories//nas.yml` file. - -## Specific Configuration - -By default, there is no password set for the main gui. Optional `calibremanager_password` will allow setting a password for the user `abc`. - -Optionally, cli start arguments can be passed to calibre using `calibremanager_cli_args`. - -The Calibre webserver must be turned on in the Calibre manager to make it available at the selected port (8094 by default). - -## Use with Calibre-web - -Ansible-NAS has long come with [../calibre](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 -calibremanager_data_directory: "{{ docker_home }}/calibre" -``` - -In this case, the Calibre Database Directory is `/data/Calibre Library` - -## Ports - -```yml -calibremanager_port: "8093" -calibremanager_webserver_port: "8094" -``` From 1769218a5e7bc928f995fd6f81070a918358f1c6 Mon Sep 17 00:00:00 2001 From: eniad Date: Tue, 18 Oct 2022 21:20:35 -0400 Subject: [PATCH 5/8] clean up naming for rename of calibre-web role --- roles/calibre/tasks/main.yml | 8 ++++---- roles/calibreweb/molecule/default/verify.yml | 2 +- roles/calibreweb/molecule/default/verify_stopped.yml | 4 ++-- roles/calibreweb/tasks/main.yml | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/roles/calibre/tasks/main.yml b/roles/calibre/tasks/main.yml index 1fe1b23673..0cbd7e725e 100644 --- a/roles/calibre/tasks/main.yml +++ b/roles/calibre/tasks/main.yml @@ -1,7 +1,7 @@ --- -- name: Start Calibre Manager +- name: Start Calibre block: - - name: Create Calibre Manager Directories + - name: Create Calibre Directories file: path: "{{ item }}" state: directory @@ -39,9 +39,9 @@ traefik.http.services.calibre.loadbalancer.server.port: "8080" when: calibre_enabled is true -- name: Stop Calibre Manager +- name: Stop Calibre block: - - name: Stop Calibre Manager + - name: Stop Calibre docker_container: name: "{{ calibre_container_name }}" state: absent diff --git a/roles/calibreweb/molecule/default/verify.yml b/roles/calibreweb/molecule/default/verify.yml index 12bf6ba8e2..9147588805 100644 --- a/roles/calibreweb/molecule/default/verify.yml +++ b/roles/calibreweb/molecule/default/verify.yml @@ -11,7 +11,7 @@ name: "{{ calibreweb_container_name }}" register: result - - name: Check Calibre is running + - name: Check Calibre-web is running assert: that: - result.container['State']['Status'] == "running" diff --git a/roles/calibreweb/molecule/default/verify_stopped.yml b/roles/calibreweb/molecule/default/verify_stopped.yml index 9e92e7ce98..d44eca621a 100644 --- a/roles/calibreweb/molecule/default/verify_stopped.yml +++ b/roles/calibreweb/molecule/default/verify_stopped.yml @@ -6,13 +6,13 @@ - include_vars: file: ../../defaults/main.yml - - name: Try and stop and remove Calibre + - name: Try and stop and remove Calibre-web docker_container: name: "{{ calibreweb_container_name }}" state: absent register: result - - name: Check Calibre is stopped + - name: Check Calibre-web is stopped assert: that: - not result.changed diff --git a/roles/calibreweb/tasks/main.yml b/roles/calibreweb/tasks/main.yml index e7411c3236..09c6fd49b8 100644 --- a/roles/calibreweb/tasks/main.yml +++ b/roles/calibreweb/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: Start Calibre +- name: Start Calibre-web block: - name: Create Calibre-web Directories file: @@ -35,9 +35,9 @@ traefik.http.services.calibreweb.loadbalancer.server.port: "8083" when: calibreweb_enabled is true -- name: Stop Calibre +- name: Stop Calibre-web block: - - name: Stop Calibre + - name: Stop Calibre-web docker_container: name: "{{ calibreweb_container_name }}" state: absent From 684061819a12b66a028da280d9ba6a2624bfa09f Mon Sep 17 00:00:00 2001 From: eniad Date: Tue, 18 Oct 2022 21:29:20 -0400 Subject: [PATCH 6/8] add cache-dependency-path to github test-deploy --- .github/workflows/docs-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs-test.yml b/.github/workflows/docs-test.yml index 5a8a919a3f..b3fd85e681 100644 --- a/.github/workflows/docs-test.yml +++ b/.github/workflows/docs-test.yml @@ -26,6 +26,7 @@ jobs: with: node-version: 18 cache: yarn + cache-dependency-path: ./website/package-lock.json - name: Install dependencies run: yarn install --frozen-lockfile From 378836e5a983a9970552fe660436dc5e6164f3cb Mon Sep 17 00:00:00 2001 From: eniad Date: Tue, 18 Oct 2022 21:33:35 -0400 Subject: [PATCH 7/8] Revert "add cache-dependency-path to github test-deploy" This reverts commit 684061819a12b66a028da280d9ba6a2624bfa09f. --- .github/workflows/docs-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docs-test.yml b/.github/workflows/docs-test.yml index b3fd85e681..5a8a919a3f 100644 --- a/.github/workflows/docs-test.yml +++ b/.github/workflows/docs-test.yml @@ -26,7 +26,6 @@ jobs: with: node-version: 18 cache: yarn - cache-dependency-path: ./website/package-lock.json - name: Install dependencies run: yarn install --frozen-lockfile From 89d641699e1690e22f02a3c1066cb731776e0724 Mon Sep 17 00:00:00 2001 From: eniad Date: Fri, 22 Dec 2023 10:29:19 -0500 Subject: [PATCH 8/8] add docs to calibre and calibreweb roles --- roles/calibre/docs/calibre.md | 24 ++++++++++++ roles/calibreweb/docs/calibre-web.md | 37 +++++++++++++++++++ .../applications/media-serving/calibre.md | 4 +- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 roles/calibre/docs/calibre.md create mode 100644 roles/calibreweb/docs/calibre-web.md diff --git a/roles/calibre/docs/calibre.md b/roles/calibre/docs/calibre.md new file mode 100644 index 0000000000..0ae22af8da --- /dev/null +++ b/roles/calibre/docs/calibre.md @@ -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//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" +``` diff --git a/roles/calibreweb/docs/calibre-web.md b/roles/calibreweb/docs/calibre-web.md new file mode 100644 index 0000000000..26d746ef98 --- /dev/null +++ b/roles/calibreweb/docs/calibre-web.md @@ -0,0 +1,37 @@ +# "Calibre-web" + +Homepage: + +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//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`. diff --git a/website/docs/applications/media-serving/calibre.md b/website/docs/applications/media-serving/calibre.md index 0ae22af8da..c9261262c9 100644 --- a/website/docs/applications/media-serving/calibre.md +++ b/website/docs/applications/media-serving/calibre.md @@ -1,4 +1,6 @@ -# Calibre +--- +Title: Calibre +--- Homepage: [https://calibre-ebook.com](https://calibre-ebook.com)