Sonarr / Radarr / Bazarr / Jackett / NZBGet / Transmission / Deluge / NordVPN / Plex
TV shows and movies download, sort, with the desired quality and subtitles, behind a VPN (optional), ready to watch, in a beautiful media player. All automated.
- Pi HTPC Download Box
- Table of Contents
- Overview
- Hardware configuration
- Software stack
- Installation guide
- Manage it all from your mobile
- Going Further
- Usefull Commands
- TODO
I have a Synology DS2013j but it's too old to run sonarr/jackett/radarr/plex properly. The movies and tvshows will be stored in a NTFS folder on my nas, the softwares configurations will be stored in the PI. SQLlite doesn't like to be in a network folder, give a lot of database locked
errors.
I use a Pi 3B but I have added the instructions for older Pi like the 1B and tested it but wasn't able to make it work.
Downloaders:
- Transmission: torrent downloader with a web UI
- Deluge: torrent downloader with a web UI
- NZBGet: usenet downloader with a web UI
- Jackett: API to search torrents from multiple indexers
- Bazarr: A companion tool for Radarr and Sonarr which will automatically pull subtitles for all of your TV and movie downloads.
Download orchestration:
- Sonarr: manage TV show, automatic downloads, sort & rename
- Radarr: basically the same as Sonarr, but for movies
VPN:
Media Center:
- Plex: media center server with streaming transcoding features, useful plugins and a beautiful UI. Clients available for a lot of systems (Linux/OSX/Windows, Web, Android, Chromecast, Android TV, etc.)
- Bazarr: manage TV show and movies subtitles
The idea is to set up all these components as Docker containers in a docker-compose.yml
file.
We'll reuse community-maintained images (special thanks to linuxserver.io for many of them).
I'm assuming you have some basic knowledge of Linux and Docker.
A general-purpose docker-compose
file is maintained in this repo here.
The stack is not really plug-and-play. You'll see that manual human configuration is required for most of these tools. Configuration is not fully automated (yet?), but is persisted on reboot. Some steps also depend on external accounts that you need to set up yourself (usenet indexers, torrent indexers, vpn server, plex account, etc.). We'll walk through it.
Optional steps described below that you may wish to skip:
- Using a VPN server for Transmission and/or Deluge incoming/outgoing traffic.
- Using newsgroups (Usenet): you can skip NZBGet installation and all related Sonarr/Radarr indexers configuration if you wish to use bittorrent only.
I recently switched to Hypriot OS, it come with docker preinstall and support all the Pi versions.
Default ssh username/password is pirate/hypriot
.
sudo apt-get update
sudo apt-get install nfs-common
Instead of editing the docker-compose file to hardcode these values in, we'll instead put these values in a .env file. A .env file is a file for storing environment variables that can later be accessed in a general-purpose docker-compose.yml file, like the example one in this repository.
Here is an example of what your .env
file should look like, use values that fit for your own setup.
SQLlite use by sonarr and radarr doesn't like to be on a network folder so I separated the config folders env variable to keep them in the Pi.
Env variables will only be used by Yacht, the rest will be configured directly on Yacht web UI.
# Your timezone, https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ=America/Los_Angeles
# UNIX PUID and PGID, find with: id $USER
PUID=1000
PGID=1000
# Local network mask, find with: ip route | awk '!/ (docker0|br-)/ && /src/ {print $1}'
NETWORK=192.168.0.0/24
# The directory where data will be stored.
ROOT=/media
# The directory where configuration will be stored.
CONFIG=/config
#NordVPN informations
VPN_USER=usero@email.com
VPN_PASSWORD=password
VPN_COUNTRY=CA
This is the instructions for a Synology but should be pretty much the same for any NAS.
mkdir /home/pirate/Plex
Add in /etc/fstab
<your-nas-ip-address>:/volume1/Plex /home/pirate/Plex nfs rw,hard,intr,rsize=8192,wsize=8192,timeo=14 0 0
Re mount
sudo mount -a
We'll use Yacht Docker image to monitor the other containers, it's an alternative to Portainer.
yacht:
container_name: yacht
restart: unless-stopped
ports:
- 8000:8000
volumes:
- ${CONFIG}/config/yacht:/config
- /var/run/docker.sock:/var/run/docker.sock
image: selfhostedpro/yacht
volumes:
yacht:
Things to notice:
- I use the host network to simplify configuration. The web ui is located on port
8000
(web UI).
Then run the container with docker-compose up -d yacht
.
To follow container logs, run docker-compose logs -f yacht
.
You should be able to login on the web UI (localhost:8000
, replace localhost
by your machine ip if needed).
The default username is admin@yacht.local
and password is pass
.
We'll use Transmission Docker image from linuxserver, which runs both the Transmission daemon and web UI in a single container.
If you prefere Deluge just comment those lines in docker-compose.yml
transmission:
image: linuxserver/transmission:latest
container_name: transmission
restart: unless-stopped
network_mode: service:vpn # run on the vpn network
environment:
- PUID=${PUID} # default user id, defined in .env
- PGID=${PGID} # default group id, defined in .env
- TZ=${TZ} # timezone, defined in .env
volumes:
- ${ROOT}/downloads:/downloads # downloads folder
- ${CONFIG}/config/transmission:/config # config files
Things to notice:
- I use the host network to simplify configuration. Important ports are
9091
(web UI) and51413
(bittorrent daemon).
Then run the container with docker-compose up -d
.
To follow container logs, run docker-compose logs -f transmission
.
instruction not updated for transmission but should be pretty much the same
You should be able to login on the web UI (localhost:9091
, replace localhost
by your machine ip if needed).
The default password is admin
. You are asked to modify it, I chose to set an empty one since transmission won't be accessible from outside my local network.
The running deluge daemon should be automatically detected and appear as online, you can connect to it.
You may want to change the download directory. I like to have to distinct directories for incomplete (ongoing) downloads, and complete (finished) ones. Also, I set up a blackhole directory: every torrent file in there will be downloaded automatically. This is useful for Jackett manual searches.
You should activate autoadd
in the plugins section: it adds supports for .magnet
files.
You can also tweak queue settings, defaults are fairly small. Also you can decide to stop seeding after a certain ratio is reached. That will be useful for Sonarr, since Sonarr can only remove finished downloads from deluge when the torrent has stopped seeding. Setting a very low ratio is not very fair though !
Configuration gets stored automatically in your mounted volume (${ROOT}/config/transmission
) to be re-used at container restart. Important files in there:
auth
contains your login/passwordcore.conf
contains your deluge configuration
You can use the Web UI manually to download any torrent from a .torrent file or magnet hash.
You should also add a blacklist for extra protection
We'll use Deluge Docker image from linuxserver, which runs both the Deluge daemon and web UI in a single container.
If you prefere Transmission just comment those lines in docker-compose.yml
deluge:
container_name: deluge
image: linuxserver/deluge:latest
restart: unless-stopped
network_mode: service:vpn # run on the vpn network
environment:
- PUID=${PUID} # default user id, defined in .env
- PGID=${PGID} # default group id, defined in .env
- TZ=${TZ} # timezone, defined in .env
volumes:
- ${ROOT}/downloads:/downloads # downloads folder
- ${CONFIG}/config/deluge:/config # config files
Things to notice:
- I use the host network to simplify configuration. Important ports are
8112
(web UI).
Then run the container with docker-compose up -d
.
To follow container logs, run docker-compose logs -f deluge
.
The goal here is to have an NordVPN Client container running and always connected. We'll make Transmission and/or Deluge incoming and outgoing traffic go through this NordVPN container.
This must come up with some safety features:
- VPN connection should be restarted if not responsive
- Traffic should be allowed through the VPN tunnel only, no leaky outgoing connection if the VPN is down
- Transmission Web UI should still be reachable from the local network
Put it in the docker-compose file, and make transmissionand/or Deluge use the vpn container network:
vpn:
container_name: vpn
image: bubuntux/nordvpn:latest
cap_add:
- net_admin # required to modify network interfaces
restart: unless-stopped
devices:
- /dev/net/tun
environment:
- USER=${VPN_USER} # vpn user, defined in .env
- PASS=${VPN_PASSWORD} # vpn password, defined in .env
- COUNTRY=${VPN_COUNTRY} # vpn country, defined in .env
- NETWORK=${NETWORK} # local network mask, defined in .env
- PROTOCOL=UDP
- CATEGORY=P2P
- OPENVPN_OPTS=--pull-filter ignore "ping-restart" --ping-exit 180
- TZ=${TZ} # timezone, defined in .env
ports:
- 9091:9091 # Transmission web UI
- 51413:51413 # Transmission bittorrent daemon
- 51413:51413/udp # Transmission bittorrent daemon
- 8112:8112 # port for deluge web UI to be reachable from local network
transmission:
image: linuxserver/transmission:latest
container_name: transmission
restart: unless-stopped
network_mode: service:vpn # run on the vpn network
environment:
- PUID=${PUID} # default user id, defined in .env
- PGID=${PGID} # default group id, defined in .env
- TZ=${TZ} # timezone, defined in .env
volumes:
- ${ROOT}/downloads:/downloads # downloads folder
- ${CONFIG}/config/transmission:/config # config files
deluge:
container_name: deluge
image: linuxserver/deluge:latest
restart: unless-stopped
network_mode: service:vpn # run on the vpn network
environment:
- PUID=${PUID} # default user id, defined in .env
- PGID=${PGID} # default group id, defined in .env
- TZ=${TZ} # timezone, defined in .env
volumes:
- ${ROOT}/downloads:/downloads # downloads folder
- ${CONFIG}/config/deluge:/config # config files
Notice how transmission and/or Deluge is now using the vpn container network, with Transmission and/or Deluge web UI port exposed on the vpn container for local network access.
You can check that Transmission and/or Deluge is properly going out through the VPN IP by using torguard check. Get the torrent magnet link there, put it in Transmission and/or Deluge, wait a bit, then you should see your outgoing torrent IP on the website.
- 1337x
- cpasbien (always failed)
- RARBG
- The Pirate Bay
- LimeTorrents
- Torrent9
- Torrentz2
Uncomment container instructions in docker.compose.yml
- Run
/usr/bin/tvservice -o
- Add
/usr/bin/tvservice -o
in/etc/rc.local
to disable HDMI on boot
# The line below is used to turn off the power LED
sudo sh -c 'echo 0 > /sys/class/leds/led1/brightness'
# The line below is used to turn off the action LED
sudo sh -c 'echo 0 > /sys/class/leds/led0/brightness'
Add the following to the /boot/config.txt
# Disable Ethernet LEDs
dtparam=eth_led0=14
dtparam=eth_led1=14
# Disable the PWR LED
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off
# Disable the Activity LED
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off
Add the following to the /boot/config.txt
# Disable Wifi
dtoverlay=pi3-disable-wifi
Add the following to the /boot/config.txt
# Disable Bluetooth
dtoverlay=pi3-disable-bt
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker logs --tail 50 --follow --timestamps transmission
docker exec -ti vpn bash
curl ifconfig.me
wget ifconfig.me
ncdu # excellent command-line disk usage analyser
df -h
- When Pi restart the env variables are not set anymore and with the container auto restart it's create issues (downloaded works, did VPN was on?)
- Transmission seed config back to default after restart (seem to works now but not for
enable blocklist
) - Investigate why mount NTFS folder not working on startup (HDMI is off)
Reduce Power Consumption
not working on startup- Transmission put completed download inside
complete/admin/torrent-folder-name
- For
fstab
what's diff withauto,_netdev,nofaill
- Check why not working on Pi 1B+ (will never do it ...)