Lazy Librarian Deployment - Role Overview

This page documents the Lazy Librarian Docker deployment using Ansible, illustrating the workflow, architecture, and best practices for deploying this containerized application with version control, persistent storage, and templated configuration.


1. Overview

Lazy Librarian is deployed in a Docker container using Ansible. Key steps include:

Lazy Librarian manages its own internal configuration and does not require an external database, simplifying deployment while maintaining persistent storage for e-books, download history, and settings.


2. Persistent Configuration and Backups

Persistent storage ensures application data is preserved across container restarts:

Example variables from the role:

lazylibrarian_setup_config_dir: "/config/lazylibrarian"
lazylibrarian_setup_backups_dir: "{{ lazylibrarian_setup_mount_point }}/lazy"
lazylibrarian_setup_backup_filename: "{{ lazylibrarian_setup_backup_prefix }}{{ ansible_date_time.date }}.sqlc"

3. Docker Image Version Control

The role pins a specific Docker image version:

lazylibrarian_setup_version: 0c862d0f
lazylibrarian_setup_docker_image_name: "lazylibrarian:version-{{ lazylibrarian_setup_version }}"

4. Deployment Workflow

The sequence for deploying Lazy Librarian is:

  1. Stop and remove existing container
docker stop lazylibrarian
docker rm lazylibrarian
docker network prune -f
  1. Ensure persistent directories exist
mkdir -p {{ lazylibrarian_setup_config_dir }}
mkdir -p {{ lazylibrarian_setup_backups_dir }}
chown <user>:<group> {{ lazylibrarian_setup_config_dir }}
  1. Deploy Docker Compose file
  1. Prune unused Docker images (optional)
docker image prune -f
  1. Pull the pinned Docker image
docker-compose -f {{ lazylibrarian_setup_config_dir }}/docker-compose.yml pull
  1. Start the container
docker-compose -f {{ lazylibrarian_setup_config_dir }}/docker-compose.yml up -d

5. Architecture Diagram

                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚  Host / Docker Environment   β”‚
                 β”‚                              β”‚
                 β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
                 β”‚ β”‚ Lazy Librarian Container β”‚ β”‚
                 β”‚ β”‚ - Pinned Image           β”‚ β”‚
                 β”‚ β”‚ - Config & Backup Volumesβ”‚ β”‚
                 β”‚ β”‚ - Exposed Port 5299      β”‚ β”‚
                 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
                 β”‚                              β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚ Access
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚ Users / Clients             β”‚
                 β”‚ Web Browser / API           β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

6. Key Features


7. Summary

The Lazy Librarian deployment role demonstrates a simple, containerized workflow:

This workflow can be adapted for other containerized applications in the home lab, ensuring maintainability, reliability, and consistent infrastructure-as-code practices.