Skip to content

Media Server Deployment ​

The dedicated Ubuntu host runs playback, requests, downloads, library management, subtitles, analytics, and backups. Services are grouped by role below, while three Compose projects define their deployment.

First complete host setup. Private credentials, exact SSH access, and coordinated AI operations are in Media Server · Internal Operations.

Projects and setup order ​

ProjectPathServices and guide
Jellyfin/docker/jellyfinJellyfin and Seerr
Servarr/docker/servarrDownloads and indexers, library and subtitles, and Streamystats
Kopia/docker/kopiaApplication backups

Prepare storage and the shared environment first. Start Gluetun and the library applications, secure their dashboards, configure clients and indexers, then connect Seerr and analytics. Finish by configuring and testing backups. The pages describe parts of one shared Servarr project; do not create a separate competing Compose project for every component.

Storage and addressing ​

This lab's host address is 10.120.40.105. SERVER_IP is loaded from /etc/environment; start a fresh login and verify printenv SERVER_IP. For a standalone setup, set SERVER_IP in each project's .env instead. Use an address actually assigned to your host.

Host pathContainer viewPurpose
/mnt/unaspro/media/data in Jellyfin, managers, qBittorrent, and UnpackerrShared media and downloads
/mnt/unaspro/media/downloads/downloads in SABnzbdUsenet downloads
/docker/<project>Application-specific config mountLocal databases and configuration
/mnt/unaspro/server-backupsKopia repository bindingApplication backup destination

The directory diagram separates NAS-backed files from local application state. Labels after the arrows are paths inside the corresponding container; each application's /config is a separate mount.

  • /mnt/unaspro/NAS mount parent · data stored on the UNAS
    • media/Media share → /data in media containers
      • anime-movies/Anime movies
      • anime-shows/Anime series
      • family-movies/Family movies
      • movies/Movies
      • tv/TV series
      • downloads/Also mounted as /downloads in SABnzbd
        • completed/Completed torrents
        • incomplete/In-progress torrents
        • torrents/Exported .torrent files
        • sabnzbd/Usenet download directories
    • server-backups/Server_Backups share
      • media-server/repository/Encrypted Kopia repository → /repository
  • /docker/Media server SSD · application state and configuration
    • jellyfin/
      • config/Jellyfin → /config
      • jellyseerr/Seerr → /app/config
    • servarr/
      • gluetun/VPN state → /gluetun
      • qbittorrent/qBittorrent → /config
      • sabnzbd/SABnzbd → /config
      • prowlarr/Prowlarr → /config
      • sonarr/Sonarr → /config
      • radarr/Radarr → /config
      • bazarr/Bazarr → /config
      • unpackerr/Unpackerr → /config
      • subgen/models/Downloaded Whisper models → /subgen/models
      • streamystats/backup-data/Logical database dump for Kopia
    • kopia/
      • config/Repository connection and TLS files → /app/config
      • cache/Local performance cache → /app/cache
      • logs/Kopia logs → /app/logs
      • restore/Staging for restored files → /restore
  • Docker-managed storageMedia server SSD · outside /docker
    • servarr_streamystats-dataNamed volume → Streamystats /var/lib/postgresql/data

Each Compose project also keeps its compose.yaml and protected .env alongside these directories. Kopia reads /docker/jellyfin and /docker/servarr through read-only /source mounts, then writes encrypted snapshots to the NAS repository. Its local cache/ directory is separate from that repository. Streamystats' live database is in the named volume; the logical dump under streamystats/backup-data/ is what the directory-based backup captures.

NAS storage is optional on another homelab. Replace media and backup bindings with your chosen local or external storage paths, and omit NAS-specific mount dependencies when not applicable. Keep application databases on local Linux storage. Use your deployment account's actual numeric UID/GID in PUID and PGID.

The diagram shows this lab's media root folders. Containers using the /data mount see them as /data/anime-movies, /data/anime-shows, /data/family-movies, /data/movies, and /data/tv. Use consistent container paths across applications; on another homelab, adapt them to your existing library roots.

Shared Servarr Compose configuration ​

Create the project directory as your Docker deployment account:

sh
sudo install -d -o "$(id -u)" -g "$(id -g)" -m 0750 /docker/servarr
cd /docker/servarr

Create compose.yaml with this definition:

Servarr Compose example
yaml
networks:
  servarrnetwork:
    name: servarrnetwork
    ipam:
      config:
        - subnet: 10.120.6.0/24

services:
  gluetun:
    image: qmcgaw/gluetun:v3.41.3
    container_name: gluetun
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    networks:
      servarrnetwork:
        ipv4_address: ${SET_IP_GLUETUN}
    ports:
      - "${SERVER_IP}:8080:8081" # qBittorrent web interface through NPM
      - "${SERVER_IP}:8085:8080" # SABnzbd web interface through NPM
      - "${SERVER_IP}:9696:9696" # Prowlarr through NPM
    env_file:
      - .env
    volumes:
      - ./gluetun:/gluetun
    healthcheck:
      test: ping -c 1 www.google.com || exit 1
      interval: 20s
      timeout: 10s
      retries: 5
    restart: unless-stopped

  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:5.3.0_v2.1.2-ls485
    container_name: qbittorrent
    restart: unless-stopped
    labels:
      - deunhealth.restart.on.unhealthy=true
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - WEBUI_PORT=8081 # must match qBittorrent's container-side port in gluetun's service above
    volumes:
      - ./qbittorrent:/config
      - /mnt/unaspro/media:/data
    depends_on:
      gluetun:
        condition: service_healthy
        restart: true
    network_mode: service:gluetun
    healthcheck:
      test: ping -c 1 www.google.com || exit 1
      interval: 60s
      retries: 3
      start_period: 20s
      timeout: 10s

  deunhealth:
    image: qmcgaw/deunhealth:v0.3.0
    container_name: deunhealth
    network_mode: "none"
    environment:
      - LOG_LEVEL=info
      - HEALTH_SERVER_ADDRESS=127.0.0.1:9999
      - TZ=${TZ}
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  sabnzbd:
    image: lscr.io/linuxserver/sabnzbd:5.1.3-ls279
    container_name: sabnzbd
    restart: unless-stopped
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./sabnzbd:/config
      - /mnt/unaspro/media/downloads:/downloads
    depends_on:
      gluetun:
        condition: service_healthy
        restart: true
    network_mode: service:gluetun
    healthcheck:
      test: curl --fail --silent http://127.0.0.1:8080/ || exit 1
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 30s

  # Handle Cloudflare challenges for tagged Prowlarr indexers
  flaresolverr:
    image: ghcr.io/flaresolverr/flaresolverr:v3.5.2
    container_name: flaresolverr
    labels:
      - deunhealth.restart.on.unhealthy=true
    environment:
      - LOG_LEVEL=info
      - LOG_HTML=false
      - CAPTCHA_SOLVER=none
      - TZ=${TZ}
    depends_on:
      gluetun:
        condition: service_healthy
        restart: true
    network_mode: service:gluetun
    healthcheck:
      test: curl --fail --silent http://127.0.0.1:8191/health || exit 1
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s
    restart: unless-stopped

  prowlarr:
    image: lscr.io/linuxserver/prowlarr:2.7.0.5723-ls166
    container_name: prowlarr
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./prowlarr:/config
    restart: unless-stopped
    depends_on:
      gluetun:
        condition: service_healthy
        restart: true
      flaresolverr:
        condition: service_healthy
        restart: true
    network_mode: service:gluetun

  # TV Series
  sonarr:
    image: lscr.io/linuxserver/sonarr:4.0.20.3014-ls1
    container_name: sonarr
    restart: unless-stopped
    depends_on:
      qbittorrent:
        condition: service_healthy
        restart: true
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./sonarr:/config
      - /mnt/unaspro/media:/data
    ports:
      - "${SERVER_IP}:8989:8989"
    networks:
      servarrnetwork:
        ipv4_address: ${SET_IP_SONARR}

  # Movies
  radarr:
    image: lscr.io/linuxserver/radarr:6.4.4.10685-ls324
    container_name: radarr
    restart: unless-stopped
    depends_on:
      qbittorrent:
        condition: service_healthy
        restart: true
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./radarr:/config
      - /mnt/unaspro/media:/data
    ports:
      - "${SERVER_IP}:7878:7878"
    networks:
      servarrnetwork:
        ipv4_address: ${SET_IP_RADARR}

  # Extract archived torrent downloads for Sonarr and Radarr
  unpackerr:
    image: ghcr.io/unpackerr/unpackerr:v1.0.1
    container_name: unpackerr
    user: "${PUID}:${PGID}"
    restart: unless-stopped
    labels:
      - deunhealth.restart.on.unhealthy=true
    depends_on:
      sonarr:
        condition: service_started
        restart: true
      radarr:
        condition: service_started
        restart: true
    env_file:
      - ./unpackerr/.env
    environment:
      - TZ=${TZ}
      - UN_LOG_FILE=/config/unpackerr.log
      - UN_LOG_FILES=10
      - UN_LOG_FILE_MB=10
      - UN_INTERVAL=2m
      - UN_START_DELAY=1m
      - UN_PARALLEL=1
      - UN_SONARR_0_URL=http://sonarr:8989
      - UN_SONARR_0_PATHS_0=/data/downloads
      - UN_SONARR_0_PROTOCOLS=torrent,TorrentDownloadProtocol
      - UN_SONARR_0_DELETE_DELAY=5m
      - UN_SONARR_0_DELETE_ORIG=false
      - UN_RADARR_0_URL=http://radarr:7878
      - UN_RADARR_0_PATHS_0=/data/downloads
      - UN_RADARR_0_PROTOCOLS=torrent,TorrentDownloadProtocol
      - UN_RADARR_0_DELETE_DELAY=5m
      - UN_RADARR_0_DELETE_ORIG=false
      - UN_WEBSERVER_LISTEN_ADDR=127.0.0.1:5656
    volumes:
      - ./unpackerr:/config
      - /mnt/unaspro/media:/data
    networks:
      servarrnetwork:
        ipv4_address: ${SET_IP_UNPACKERR}
    healthcheck:
      test: curl --fail --silent --output /dev/null http://127.0.0.1:5656/ || exit 1
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"

  # Subtitles
  bazarr:
    image: lscr.io/linuxserver/bazarr:v1.6.2-ls370
    container_name: bazarr
    restart: unless-stopped
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./bazarr:/config
      - /mnt/unaspro/media:/data
    ports:
      - "${SERVER_IP}:6767:6767"
    networks:
      servarrnetwork:
        ipv4_address: ${SET_IP_BAZARR}

  subgen:
    image: mccloud/subgen:2026.07.3-cpu
    container_name: subgen
    restart: unless-stopped
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - WHISPER_MODEL=${SUBGEN_WHISPER_MODEL:-medium}
      - WHISPER_THREADS=${SUBGEN_WHISPER_THREADS:-8}
      - TRANSCRIBE_DEVICE=cpu
      - COMPUTE_TYPE=int8
      - CONCURRENT_TRANSCRIPTIONS=1
      - PROCESS_ADDED_MEDIA=false
      - PROCESS_MEDIA_ON_PLAY=false
      - TRANSCRIBE_OR_TRANSLATE=transcribe
      - "SUBGEN_KWARGS={'initial_prompt': 'What happened? I do not know. Wait—did you hear that? Yes, I did!'}"
      - MODEL_PATH=/subgen/models
      - MODEL_CLEANUP_DELAY=300
      - UPDATE=false
      - APPEND=false
      - DEBUG=false
    volumes:
      - ./subgen/models:/subgen/models
      - /mnt/unaspro/media:/data:ro
    networks:
      servarrnetwork:
        ipv4_address: ${SET_IP_SUBGEN:-10.120.6.10}
    cpus: ${SUBGEN_CPU_LIMIT:-8.0}
    mem_limit: ${SUBGEN_MEMORY_LIMIT:-8g}
    healthcheck:
      test: curl --fail --silent http://127.0.0.1:9000/status || exit 1
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 60s
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"

  streamystats:
    image: ghcr.io/fredrikburmester/streamystats-aio:v2.20.0
    container_name: streamystats
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: ${STREAMYSTATS_POSTGRES_PASSWORD}
      POSTGRES_DB: streamystats
      POSTGRES_HOST_AUTH_METHOD: scram-sha-256
      POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256
      DATABASE_URL: postgresql://postgres:${STREAMYSTATS_POSTGRES_PASSWORD}@localhost:5432/streamystats
      SESSION_SECRET: ${STREAMYSTATS_SESSION_SECRET}
      NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: ${STREAMYSTATS_NEXT_SERVER_ACTIONS_ENCRYPTION_KEY}
      NODE_ENV: production
      SKIP_STARTUP_FULL_SYNC: "true"
      TZ: ${TZ}
    volumes:
      - streamystats-data:/var/lib/postgresql/data
    ports:
      - "${SERVER_IP}:3000:3000"
    networks:
      servarrnetwork:
        ipv4_address: ${SET_IP_STREAMYSTATS}
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"
    restart: unless-stopped

volumes:
  streamystats-data:

This lab reserves 10.120.6.0/24 for the Docker-only Servarr bridge; it is not a UniFi VLAN and is not advertised as a Tailscale subnet. For another homelab, choose an unused private subnet and update all static assignments together. Use Docker service names for supported application connections so those settings do not depend on the bridge IPs. Gluetun owns the published ports for its shared-namespace consumers.

Configure the environment ​

Create .env alongside Compose:

dotenv
SERVER_IP=10.120.40.105
TZ=America/Chicago
PUID=1000
PGID=1000
SET_IP_GLUETUN=10.120.6.2
SET_IP_SONARR=10.120.6.3
SET_IP_RADARR=10.120.6.4
SET_IP_BAZARR=10.120.6.6
SET_IP_STREAMYSTATS=10.120.6.9
SET_IP_SUBGEN=10.120.6.10
SET_IP_UNPACKERR=10.120.6.11
SUBGEN_WHISPER_MODEL=medium
SUBGEN_WHISPER_THREADS=8
SUBGEN_CPU_LIMIT=8.0
SUBGEN_MEMORY_LIMIT=8g
VPN_SERVICE_PROVIDER=surfshark
VPN_TYPE=wireguard
WIREGUARD_PRIVATE_KEY=<provider-private-key>
WIREGUARD_ADDRESSES=<provider-wireguard-address>
SERVER_COUNTRIES=Canada
HEALTH_VPN_DURATION_INITIAL=120s
STREAMYSTATS_POSTGRES_PASSWORD=<independent-database-password>
STREAMYSTATS_SESSION_SECRET=<independent-session-secret>
STREAMYSTATS_NEXT_SERVER_ACTIONS_ENCRYPTION_KEY=<base64-key>

Replace every placeholder before starting. Configure your own supported VPN provider, protocol, region, and provider-issued key/address; a WireGuard address is not the host's LAN address. Generate the Streamystats database password and session secret independently with openssl rand -hex 32; generate its server-actions key with openssl rand -base64 32. Keep all values private and retain the originals during recovery. Hex database passwords also avoid special-character ambiguity in the embedded database URL.

Create the separate Unpackerr environment file before validating the whole project:

sh
mkdir -p unpackerr
nano unpackerr/.env
chmod 600 .env unpackerr/.env

Use your preferred editor if nano is unavailable. The file needs these fields:

dotenv
UN_SONARR_0_API_KEY=<sonarr-api-key>
UN_RADARR_0_API_KEY=<radarr-api-key>

For a fresh stack, obtain those keys from the managers after starting them in the next step. Keep Unpackerr stopped until real keys have replaced its placeholders.

Prepare directories and start dependencies ​

Confirm real NAS mounts first if using them, then create the local config directories and your chosen media directories:

sh
mkdir -p gluetun qbittorrent sabnzbd prowlarr sonarr radarr bazarr unpackerr subgen/models streamystats/backup-data
mkdir -p /mnt/unaspro/media/downloads/{completed,incomplete,torrents,sabnzbd}
mkdir -p /mnt/unaspro/media/movies /mnt/unaspro/media/tv
docker compose config --quiet
docker compose pull
docker compose up -d gluetun qbittorrent sabnzbd flaresolverr prowlarr sonarr radarr bazarr subgen streamystats
docker compose ps

Only create the example media directories after adapting the chosen roots. On NAS storage, permissions must allow the configured application UID/GID to read and write them. On a local-storage deployment, substitute your own host paths in both Compose and these commands.

Secure the Sonarr/Radarr dashboards, retrieve their API keys into unpackerr/.env, and configure each application using the linked guides. Start Unpackerr and the selected recovery helper afterward:

sh
docker compose up -d unpackerr deunhealth

deunhealth mounts the Docker socket and can control containers. Docker socket access grants powerful host control; include this helper only as a deliberate administrative component. It restarts only containers carrying the configured unhealthy-restart label. Docker health status by itself does not restart a container.

Verify the complete workflow ​

Approve a test request, confirm it reaches the appropriate manager, verify the download and import paths, and play the result in Jellyfin. Test subtitles and analytics separately. Keep private API keys, provider accounts, logs, and request history out of public documentation.

Use Backups before routine image updates. Restarting Gluetun affects four shared-network consumers; plan their coordinated recreation rather than restarting the VPN in isolation. Image downgrades require a compatible database recovery point.