Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Kavita #684

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Jackett](https://github.com/Jackett/Jackett) - API Support for your favorite torrent trackers
* [Jellyfin](https://jellyfin.github.io) - The Free Software Media System
* [Joomla](https://www.joomla.org/) - Open source content management system
* [Kavita](https://www.kavitareader.com/) - Digital library which supports a vast array of file formats
* [Komga](https://komga.org/) - a media server for your comics, mangas, BDs and magazines
* [Krusader](https://krusader.org/) - Twin panel file management for your desktop
* [Lidarr](https://github.com/lidarr/Lidarr) - Music collection manager for Usenet and BitTorrent users
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@
tags:
- joomla

- role: kavita
tags:
- kavita

- role: komga
tags:
- komga
Expand Down
25 changes: 25 additions & 0 deletions roles/kavita/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
kavita_enabled: false
kavita_available_externally: false

# uid / gid
kavita_user_id: "1000"
kavita_group_id: "1000"

# directories
kavita_data_directory: "{{ docker_home }}/kavita"
kavita_books_directory: "{{ books_root }}"
kavita_comics_directory: "{{ comics_root }}"

# image
kavita_image: "linuxserver/kavita"

# network
kavita_port: "5002"
kavita_hostname: "kavita"

# specs
kavita_memory: 1g

# docker
kavita_container_name: kavita
6 changes: 6 additions & 0 deletions roles/kavita/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
kavita_enabled: true
10 changes: 10 additions & 0 deletions roles/kavita/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:
kavita_enabled: false
18 changes: 18 additions & 0 deletions roles/kavita/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: "{{ kavita_container_name }}"
register: result

- name: Check Kavita is running
assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
18 changes: 18 additions & 0 deletions roles/kavita/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 Kavita
docker_container:
name: "{{ kavita_container_name }}"
state: absent
register: result

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

- name: Kavita Docker Container
docker_container:
name: "{{ kavita_container_name }}"
image: "{{ kavita_image }}"
pull: true
volumes:
- "{{ kavita_data_directory }}/config:/kavita/config"
- "{{ kavita_comics_directory }}:/comics"
- "{{ kavita_books_directory }}:/books"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ kavita_user_id }}"
PGID: "{{ kavita_group_id }}"
ports:
- "{{ kavita_port }}:5000"
restart_policy: unless-stopped
memory: "{{ kavita_memory }}"
labels:
traefik.enable: "{{ kavita_available_externally | string }}"
traefik.http.routers.kavita.rule: "Host(`kavita.{{ ansible_nas_domain }}`)"
traefik.http.routers.kavita.tls.certresolver: "letsencrypt"
traefik.http.routers.kavita.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.kavita.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.kavita.loadbalancer.server.port: "5002"
eniad marked this conversation as resolved.
Show resolved Hide resolved
when: kavita_enabled is true

- name: Stop Kavita
block:
- name: Stop Kavita
docker_container:
name: "{{ kavita_container_name }}"
state: absent
when: kavita_enabled is false
17 changes: 17 additions & 0 deletions website/docs/applications/media-serving/kavita.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: "Kavita"
---

Homepage: <https://www.kavitareader.com/>

Github: <https://github.com/Kareadita/Kavita>

Docker Image: <https://hub.docker.com/r/linuxserver/kavita>

Lighting fast with a slick design, Kavita is a rocket fueled self-hosted digital library which supports a vast array of file formats. Install to start reading and share your server with your friends.

## Usage

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

Access the webui at <http://ansible_nas_host_or_ip:5002> by default.