HomeLabDocs/sonarr_complete.md

124 lines
3.8 KiB
Markdown

# 📺 Sonarr - Container 104
## Overview
Sonarr is a TV series management and downloader tool. It automates the discovery, downloading, and organization of TV content through indexers and torrent clients. In this homelab, Sonarr runs **natively inside an unprivileged LXC container** on Proxmox (not Docker).
## Service Details
- **Container ID**: 104
- **Hostname**: sonarr
- **IP Address**: 192.168.1.39
- **Port**: 8989 (Web UI)
- **Access**: LAN-only via Tailscale (not publicly exposed)
- **Authentication**: Enabled (`Forms` login)
- **Username / Password**: `admin` / `pcideas` (stored in Bitwarden under `homelab > Sonarr`)
## Hosting & Platform
- **Platform**: Native install in Debian-based LXC
- **Privileged**: No
- **Features**: `keyctl=1`, `nesting=1`
- **Service**: systemd-managed (`sonarr.service`)
- **Binary Path**: `/opt/Sonarr/Sonarr`
- **Config Directory**: `/var/lib/sonarr`
- **Runs As**: `root` (inside unprivileged LXC)
## Storage & Mounts
| Host Path | Container Path | Purpose |
| ------------------------- | -------------- | ----------------------------- |
| `/mnt/ssd_downloads` | `/downloads` | Source of completed downloads |
| `/mnt/smb_shares/g_media` | `/mnt/g_media` | TV media root folder |
| `/mnt/smb_shares/h_media` | `/mnt/h_media` | TV media root folder |
| `/mnt/smb_shares/i_media` | `/mnt/i_media` | TV media root folder |
| `/mnt/smb_shares/j_media` | `/mnt/j_media` | TV media root folder |
| `/mnt/smb_shares/k_media` | `/mnt/k_media` | TV media root folder |
| `/mnt/smb_shares/f_media` | `/mnt/f_media` | TV media root folder |
## Configuration
- **Indexer**: Jackett (Torznab URL)
- **Download Client**: qBittorrent at `192.168.1.47:8080`
- **Username / Password**: `admin` / `pcideas`
- **Remote Path Mapping**: `/mnt/ssd_downloads` (host) → `/downloads` (Sonarr)
- **Share Limit Action**: `Pause` (prevents interference with file import)
## Import Behavior
- **Completed Download Handling**: ✅ Enabled
- **Import Method**: Move + Rename
- **Category Use**: Optional (`tv`) in qBittorrent
- **Hardlinking**: ❌ Disabled
- Sonarr auto-detects the correct root folder based on existing library paths.
## Config Files
- **Primary Config**: `/var/lib/sonarr/config.xml`
- Stores:
- Web UI port (8989)
- Bind address (`*`)
- SSL settings (disabled)
- Authentication method (Forms)
- API key
- **Web UI Behavior**:
- `LaunchBrowser`: false
- `UrlBase`: empty
- `Branch`: master
## Backup & Recovery
- **Backup Target**: `/var/lib/sonarr`
- **Strategy**: Scheduled LXC container backups + optional rsync or tarball
- **Manual Backup Command**:
```bash
tar -czvf /root/sonarr-config-backup-$(date +%F).tar.gz /var/lib/sonarr
```
- **Restore**: Extract and restart the service
## Logs & Monitoring
- **Log Path**: `/var/lib/sonarr/logs/`
- **Monitoring**: Not currently configured
## Updates
To update manually:
```bash
systemctl stop sonarr
curl -Lo /tmp/sonarr.tar.gz https://services.sonarr.tv/v1/download/main/latest?version=3&os=linux&arch=x64
tar -xvzf /tmp/sonarr.tar.gz -C /tmp/sonarr-update
cp -r /tmp/sonarr-update/* /opt/Sonarr/
chown -R root:root /opt/Sonarr
systemctl start sonarr
```
## Systemd Service File
`/etc/systemd/system/sonarr.service`
```ini
[Unit]
Description=Sonarr Daemon
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/opt/Sonarr/Sonarr -nobrowser -data=/var/lib/sonarr/
TimeoutStopSec=20
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
```
## Notes
- Hardlinking is disabled
- All media mounts are SMB-backed ZFS datasets
- Remote path mapping is required due to separate qBittorrent container
- Integration with Plex is via webhook
- Config and logs are stored in `/var/lib/sonarr`
- Sonarr runs as `root` which simplifies file access across mounts