Sonarr

From Leo's Notes
Last edited on 14 June 2020, at 23:59.

Sonarr (formerly NzbDrone) is a web application written in C# that automatically downloads TV shows from both Usenet and torrents. It can be executed under both Windows and Linux using the mono framework.

Installation

I recommend running Sonarr inside Docker.

Docker

The Docker image can be built from my Dockerfile or pulled from https://git.steamr.com/docker/alpine-sonarr

Using docker-compose, I use the following deployment. The downloads volume was for Drone Factory which is now deprecated.

sonarr:
    image: registry.steamr.com/docker/alpine-sonarr:latest
    container_name: sonarr
    networks:
      - backend
      - traefik
    links:
      - sabnzbd
    volumes:
      - /var/volumes/sonarr-config:/config
      - downloads:/downloads
      - TV:/TV
    restart: always
    expose:
      - "8989"
    labels:
      - "traefik.enable=true"
      - "traefik.port=8989"
      - "traefik.docker.network=traefik"
      - "traefik.frontend.rule=Host:sonarr.example.com"
      - "traefik.frontend.redirect.entryPoint=https"
      - "traefik.frontend.auth.forward.address=http://auth/index.php"

CentOS 7

Installation under CentOS 7 is relatively straight forward. You must use a more recent version of mono than the one packaged with CentOS 7 which is another 3rd party repository needs to be used.

Use the setup script below as a guide.

#!/bin/bash

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
curl -L http://download.opensuse.org/repositories/home:tpokorra:mono/CentOS_CentOS-6/home:tpokorra:mono.repo -o /etc/yum.repos.d/mono.repo

# yum install gcc-c++ gcc mediainfo libzen libmediainfo curl gettext
yum install sqlite mediainfo libzen libmediainfo curl gettext mono-opt mono-opt-devel

groupadd -r -g 250 downloaders
adduser -M -d /usr/local/sonarr -r -u 252 -g 250 sonarr

mkdir /usr/local/sonarr
chown sonarr:downloaders /usr/local/sonarr

# Download the master release
wget -O /tmp/nzbdrone.tar.gz http://download.sonarr.tv/v2/master/mono/NzbDrone.master.tar.gz
su - sonarr -c "tar -xzf /tmp/nzbdrone.tar.gz -C /tmp; mv /tmp/NzbDrone/* /usr/local/sonarr"

# Or clone from github.
# su - sonarr -c "git clone https://github.com/Sonarr/Sonarr.git /usr/local/sonarr"

Sonaar can be started using a systemd startup script by executing:

# screen -S sonarr -dm su - sonarr -c " /opt/mono/bin/mono NzbDrone.exe -nobrowser -data /home/sonaar/"
Tip: Serve Sonaar on its own domain
You may wish to serve Sonaar on its own domain such as sonaar.example.com. By default, Sonaar will listen on port 8989. You may either change the listen IP and port or use IPTables to forward port 80 to 8989:


iptables -A PREROUTING -t nat -i eno16777736 -p tcp -d 10.1.2.3 --dport 80 -j REDIRECT --to-port 8989


See Also