Lidarr Deployment - Role Overview

This page documents the Lidarr Docker deployment using Ansible, illustrating the workflow, architecture, and best practices for deploying this containerized application with version control, persistent storage, and integration with an external PostgreSQL database.


1. Overview

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

Additionally, Lidarr connects to an external PostgreSQL database, separating storage from the application for improved reliability and scalability.


2. Persistent Configuration and Backups

Persistent storage ensures application data is preserved across container restarts:

Example variables from the role:

lidarr_setup_config_dir: "/config"
lidarr_setup_backups_dir: "/nfs/backups/lidarr"
lidarr_setup_backup_filename: "{{ lidarr_setup_backup_prefix }}{{ ansible_date_time.date }}.sqlc"

3. Docker Image Version Control

The role pins a specific Docker image version:

lidarr_setup_version: 2.13.3.4711
lidarr_setup_docker_image_name: "lidarr:{{ lidarr_setup_version }}"

4. Deployment Workflow

The sequence for deploying Lidarr is:

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

5. Architecture Diagram

                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚  Host / Docker Environment   β”‚
                 β”‚                              β”‚
                 β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
                 β”‚ β”‚ Lidarr Container         β”‚ β”‚
                 β”‚ β”‚ - Pinned Image           β”‚ β”‚
                 β”‚ β”‚ - Config & Backup Volumesβ”‚ β”‚
                 β”‚ β”‚ - Exposed Ports 8686/6868β”‚ β”‚
                 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
                 β”‚                              β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚ Access
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚ Users / Clients             β”‚
                 β”‚ Web Browser / API           β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚ Database Connection
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚ External PostgreSQL Server  β”‚
                 β”‚ - Database: lidarr-main     β”‚
                 β”‚ - User: lidarr              β”‚
                 β”‚ - Port: 5432                β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

6. Key Features


7. Summary

The Lidarr deployment role demonstrates a robust, production-like container workflow:

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