Automated Torrenting

By thunderwood

The current problem I find myself in is being stuck downloading torrents the old fashioned way. I start up the VPN (I use IPvanish), go to a torrent website, download the file I want, plug it into uTorrent, then save it to my media server. This can be tedious when you want to download multiple files, or are away from the computer. This is why I will be setting up and automated torrenting network to handle all this for me, and only requires the click of a button to get any show, movie, or book onto my media server.

Setup

For this network, I will be using the following containers and images:

  • Portainer (GUI for docker)
  • Transmission (Bittorrent Client)
  • Lidarr, Sonarr, Radarr, LazyLibrarian (For Management and Search of Torrents)
  • Jackett (Work alongside above apps to search and manage torrent indexes)
  • Plex (Media server)
  • Tautilli (Metrics and Analytics for Plex)
  • Ombi (Content Request Management)

First, we setup the main VM that will be handling the setup. I networked mine to be in my DMZ due to the fact that I will be hosting services from this machine to the web.

Spin up a Ubuntu 20.04 VM the run the following commands after basic setup:

sudo apt update

sudo apt install docker.io

sudo apt install apt-transport-https ca-certificates curl software-properties-common

sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable”

Next, follow the Portainer guide linked here: https://digitalmetaverse.com/?p=379

Next, setup your directories. I don’t save the files on the vm running this setup, instead I have an SMB share from my FREENAS box that will be storing data for me. First, mount the share to the linux box:

sudo mkdir /mnt/media

sudo mount -t cifs -o username=user //server-ip/<smb share>

sudo mount -a

Then, create the required directories that you will point your containers too:

cd /mnt/media

sudo mkdir downloads

cd /mnt/media/downloads

sudo mkdir completed

cd /mnt/media/completed

sudo mkdir movies,tv,music,ereader

Containers

Next, we need to setup containers to run the applications needed. Each one will be configured and deployed using Portainer (I’m a sucker for GUI’s).

Transmission-openvpn

To deploy this container, select it from the app templates in portainer, then change the following values:

  • Local_Network – add ip ranges from where you want access. In this case I added the DMZ and LAN ranges. (Comma separated list)
  • Provider – Choose your vpn provider here ie. PIA, IPVANISH, etc
  • User/Pass – The username and password you will use can be generated from your VPN account. This will be under the PPTP,L2TP,SOCKS5 section.
  • Web_UI – I filled this field out with combustion. It’s a fancier GUI for Transmission
  • DNS – use Google DNS for this:

Once setup, deploy it. This process will take about 5 minutes as it establishes the tunnel with the VPN provider you listed.

Now navigate to server-ip:9091 and you should see the following:

If you see this, you are all set!

Jackett

The next container to add is Jackett. Again, this is for your torrent indexing and is quite vital to gain faster torrent speeds and seed availability. Under App Templates find jackett, change the hostname, and deploy. Then navigate to the web console on port 9117.

Next, add indexers to jacket by clicking on “Add indexer” then choosing the servers you want.

Once all the indexes you want are added, we can move to Sonarr

Sonarr

Here, just like with Jackett, find the Sonarr template and add it. Nothing needs to be edited here, just deploy the container and navigate to port 8989.

Lidarr

Same thing as Sonarr, then navigate to port 7878.

Lidarr

And again…

LazyLibrarian

Finally…

Configuration

Next, we need to start adding transmission and indexers to the apps. In Sonarr, navigate to Settings and then Download Client. Click on the grey + to add your Transmission details. Edit to match your Transmission IP, Port, Username and Password. Once entered, click Test to, you guessed it, test the connection and then Save. Repeat this step for Radarr and Lidarr (LazyLibrarian is as easy, navigate to Config, Downloaders then tick the Transmission box and enter deets).

Pop back to Jackett and take note of your API key in the top right as you’ll need this for each entry. The other value required is URL. In the dashboard find an added Indexer and click on Copy Torznab Feed.

In Sonarr go to Settings then Indexers. Just like before, click on the grey and then under Toznab click on Custom. Armed with your API key and URL, enter a name and the deets and click Test to test then Save to save.

Now repeat that for each Indexer and one each platform (Radarr, Lidarr …). Unfortunately there isn’t any mass upload or config sharing, trust me I’ve checked. However, once you’ve got at least a few added and working, you can run a test by searching for a movie or TV show. Hopefully, if I’ve written this up correctly, after minute or two you should see the torrent in Transmission!

Next, it’s finally time for the media server…Plex!

Plex

For this, find the app template in portainer, select it, the edit the following variables:

  • Mounts – Movies, TV, Music
  • Network- Make sure its on the Host net!
  • PUID and GUID – Both 0
  • Plex Claim – Add your plex claim code here

With that, deploy the container and navigate to port 32400. At this point it will ask to manage libraries, configure your categories for media here. Once done, click next. Some further setting I changed are as follows:

  • Scan my library automatically – Enable
  • Run a partial scan when changes are detected – Enable
  • Run scanner tasks at a lower priority – Enable
Ombi

This is the last, and final step. This container will allow you and your Plex users to request TV, movies or music to download and add to Plex. Anything you already have, will be shown ‘Available’ and even a direct link to the content on Plex. When setup, this should be the only portal you need to access to request media (no logging into Sonarr then Radarr then Lidarr …) as it’s all in one place.

Same in the previous container steps, find the template, then all you have to do is deploy it. Then navigate to port 3579 on the server hosting the service.

You and any other user you add into Ombi will use their Plex credentials to log in. Once we’re in, the first step is to ensure that users can actually sign in. Go to Settings > Configuration and then under Authentication make sure the Enable Plex OAuth is enabled and click Submit.

Now let’s configure the most important part, Plex. Under Settings > Media Server select Plex and then enter your credentials to pull down your server settings. If this doesn’t work, fill out the rest of the fields including Plex Auth Token and Machine Identifier. Make sure to test the connectivity once finished.

Plex is now configured in Ombi and all we now need is to add in Sonarr, Radarr and Lidarr to complete this setup of ours. Let’s start with Sonarr.

Navigate to Settings > TV and then click on Sonarr. Similar to before, enter the IP, Port and Sonarr API Key before clicking on Test Connectivity to confirm. If all good, click Get Quality Profiles and choose your preferred “Download quality profile”. Then click Get Root Folders and choose your preferred media folder for TV shows. Finally click Submit.

As the standard time saving measure goes, I’ll leave you to setup Radarr and Lidarr as it is simply repeating the steps above, changing the Port and API Key.

Hopefully, if that has worked you can now see all the users under User Management on the top bar. Here you can tweak each user’s permissions allowing maximum requests, auto-approval, etc. As usual, it’s always best to look around and get yourself familiar with Ombi and also check in Settings to see other handy features or configurations you may want to enable, disable, or change.

To test the final product, navigate to Requests in Ombi and search for a film or TV show that you know is available (otherwise you’ll be waiting for a release!). If you haven’t set yourself to ‘Auto-Approval’, approve your request in Ombi and then wait for a confirmation window to appear. Waiting a few minutes between each step:

  • Navigate to Sonarr/Radarr to check the media has been requested from Ombi
  • Confirm Sonarr/Radarr has searched and found content via Jackett and forwarded to Transmission
  • Ensure that the correct torrent has been added and downloaded successfully!

Reverse Proxy

The next step is to configure Plex and Ombi to be reachable outside your network with TLS/SSL. I will be making a guide on how to do this with Haproxy and Acme certificates behind Cloudflare later on. Until then, there are plenty of guides that others have created that are extremely helpful, plus a handful of videos. I highly recommend Lawrence Systems on Youtube.

Optional

I have a home intranet dashboard I created using DashMachine on my LAN Portainer instance. I will be creating a guide on how to setup and configure this nifty tool later on. As you can see, I don’t need to remember all my IP’s and ports as all I have to do is click on the tile, and it takes me there.