Skip to content

Kavita Reader in Docker Swarm

Get your FREE "elfhosted" Kavita instance for demo / trial πŸ₯³

Want to see a live demo, or "kick the tyres" πŸš™ before you commit to self-hosting Kavita?

Try out an "ElfHosted" 🧝 instance of Kavita for FREE!

So you've just watched a bunch of superhero movies, and you're suddenly inspired to deep-dive into the weird world of comic books? You're already rocking AutoPirate with Mylar and NZBGet to grab content, but how to manage and enjoy your growing collection?

Kavita Screenshot

Kavita Reader is a "rocket fueled self-hosted digital library which supports a vast array of file formats". Primarily used for cosuming Manga (but quite capable of managing ebooks too), Kavita's killer feature is an OPDS server for integration with other mobile apps such as Chunky on iPad, and the ability to save your reading position across multiple devices.

There's a public demo available too!

Kavita Requirements

Ingredients

Already deployed:

Related:

  • Traefik Forward Auth or Authelia to secure your Traefik-exposed services with an additional layer of authentication

  • AutoPirate components (specifically Mylar), for searching for, downloading, and managing comic books

Preparation

Setup data locations

First we create a directory to hold the kavita database, logs and other persistent data:

mkdir /var/data/kavita

Kavita Docker Swarm config

Create a docker swarm config file in docker-compose syntax (v3), something like the example below:

Fast-track with premix! πŸš€

I automatically and instantly share (with my sponsors) a private "premix" git repository, which includes necessary docker-compose and env files for all published recipes. This means that sponsors can launch any recipe with just a git pull and a docker stack deploy πŸ‘.

πŸš€ Update: Premix now includes an ansible playbook, so that sponsors can deploy an entire stack + recipes, with a single ansible command! (more here)

/var/data/config/kavita.yml
version: "3.2" # https://docs.docker.com/compose/compose-file/compose-versioning/#version-3

services:
  kavita:
    image: kizaing/kavita:latest
    env_file: /var/data/config/kavita/kavita.env
    volumes:
      - /var/data/kavita:/kavita/config
    deploy:
      labels:
        # traefik
        - traefik.enable=true
        - traefik.docker.network=traefik_public

        # traefikv1
        - traefik.frontend.rule=Host:kavita.example.com
        - traefik.port=8000     

        # traefikv2
        - "traefik.http.routers.kavita.rule=Host(`kavita.example.com`)"
        - "traefik.http.routers.kavita.entrypoints=https"
        - "traefik.http.services.kavita.loadbalancer.server.port=5000" 

        # uncomment for traefik-forward-auth (1)
        # - "traefik.http.routers.radarr.middlewares=forward-auth"

        # uncomment for authelia (2)
        # - "traefik.http.routers.radarr.middlewares=authelia"

    networks:
      - traefik_public

networks:
  traefik_public:
    external: true
  1. Uncomment to protect Kavita with an additional layer of authentication, using Traefik Forward Auth
  2. Uncomment to protect Kavita with an additional layer of authentication, using Authelia

Serving

Avengers Assemble!

Launch the Kavita stack by running docker stack deploy kavita -c <path -to-docker-compose.yml>

Log into your new instance at https://YOUR-FQDN. Since it's a fresh installation, Kavita will prompt you to setup a username and password, after which you'll be able to setup your library, and tweak all teh butt0ns!

Chef's notes πŸ““


  1. Since Kavita doesn't need to communicate with any other local docker services, we don't need a separate overlay network for it. Provided Traefik can reach kavita via the traefik_public overlay network, we've got all we need. ↩

  2. There's an active subreddit for Kavita ↩

Tip your waiter (sponsor) πŸ‘

Did you receive excellent service? Want to compliment the chef? (..and support development of current and future recipes!) Sponsor me on Github / Ko-Fi / Patreon, or see the contribute page for more (free or paid) ways to say thank you! πŸ‘

Employ your chef (engage) 🀝

Is this too much of a geeky PITA? Do you just want results, stat? I do this for a living - I'm a full-time Kubernetes contractor, providing consulting and engineering expertise to businesses needing short-term, short-notice support in the cloud-native space, including AWS/Azure/GKE, Kubernetes, CI/CD and automation.

Learn more about working with me here.

Flirt with waiter (subscribe) πŸ’Œ

Want to know now when this recipe gets updated, or when future recipes are added? Subscribe to the RSS feed, or leave your email address below, and we'll keep you updated.

Your comments? πŸ’¬