April 3, 2020

Docker Plex Part 2

Setting up the Plex backend for download.

Tautulli, Sonarr, Radarr, Sabnzbd as the Plex backend

We've recently built out a new Plex server and now want to automate the process of downloading all the media.  If you haven't checked out Part 1, you can find it here.

Before all that here is a list of the paid service accounts and websites I needed to sign up with in order to get things going:

Then a few optional ones too but not necessary.

Initially our docker-compose.yml file only included the Plex setup.  Now that we have a little experience in setting up Plex, we're going to add to that compose file and include our backend services.  Update that compose file to include these new services tautulli, sonarr, radarr and sabnzbd:

version: '2'
services:
  plex:
    image: linuxserver/plex
    container_name: plex
    network_mode: host
    environment:
      - PUID=1000
      - PGID=1000
      - VERSION=docker
      - UMASK_SET=022 
      - PLEX_CLAIM= 
    ports:
      - '32400:32400'
    volumes:
      - /media/plex/config:/config
      - /media/tv:/tv
      - /media/movies:/movies
    restart: unless-stopped  
  tautulli:
    container_name: tautulli
    network_mode: bridge
    image: 'shiggins8/tautulli'
    ports:
      - '3001:8181'
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /media/tautulli/config:/config
      - /media/tautulli/plexlogs:/logs
    environment:
      - PGID=1000
      - PUID=1000
      - TZ=America/Los_Angeles
    restart: unless-stopped
  radarr:
    container_name: radarr
    network_mode: bridge
    image: 'linuxserver/radarr'
    ports:
      - '3002:7878'
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /media/radarr/config:/config
      - /media/completed:/downloads
      - /media/movies/:/movies
    environment:
      - PGID=1000
      - PUID=1000
      - TZ=America/Los_Angeles
    restart: unless-stopped
  sonarr:
    container_name: sonarr
    network_mode: bridge
    image: 'linuxserver/sonarr'
    ports:
      - '3003:8989'
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /media/sonarr/config:/config
      - /media/completed:/downloads
      - /media/tv:/tv
    environment:
      - PGID=1000
      - PUID=1000
      - TZ=America/Los_Angeles
    restart: unless-stopped
  sabnzbd:
    container_name: sabnzbd
    network_mode: bridge
    image: 'linuxserver/sabnzbd'
    ports:
      - '3004:8080'
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /media/sabnzbd/config:/config
      - /media/incompleteDownloads:/incomplete-downloads
      - /media/completed:/downloads
    environment:
      - PGID=1000
      - PUID=1000
      - TZ=America/Los_Angeles
    restart: unless-stopped    

Reading the yaml you would see the different services being spun up.

  • Plex
    • Plex Server
  • Tautulli
    • Plex Monitoring
  • Radarr
    • Movie Download Queueing Interface
  • Sonarr
    • TV Show Download Queueing Interface
  • SabNZBD
    • NZB Download Client

Download Flow

To get an idea of how the download process actually takes place behind the scenes you can refer to the flowchart described and pictured here.

Docker Compose YAML

The new docker-compose file can be a little overwhelming.  You're adding a bunch of new services and you're adding a handful of new websites to your arsenal.  Some key pieces you want to take note of are the ports section and the volumes section for each of the services.

Ports

For each of the services there is a port being forwarded from the container to the house.  If you think of each container as a self contained virtual machine, the port inside the container is being forwarded to the port on your host.  Let's take Sonarr as an example:

  sonarr:
    ...
    ports:
      - '3003:8989'
    ...

So Sonarr has a front end website UI that you would use to setup and configure.  That website would normally be hosted on http://localhost:8989.  But in our case, since we are hosting Sonarr on a machine that will be hosting many websites and servers, we need to make sure the ports are not clashing.  So we forward the container's 8989 port to the host machine's 3003 port.  So instead of accessing Sonarr's web UI on http://localhost:8989, we will be hitting the host machine's local host on the host's forwarded port, http://localhost:3003.

To get a more visual idea of how this looks you can get an idea here.

Volumes

Next we have the set volumes being mounted from our host machine to our containers.  Like we explained in [part 1](), we have a mount on our local machine that is being super imposed into the container's filesystem.  To get a visual mapping of how each of these directories are being mounted you can refer to this flow here.

Compose Up

Once you got a decent understanding of all of that, we should be able to simply navigate to our plex folder and re-run that docker compose.

  • cd /media/plex
  • docker-compose up -d

This should pull down all the new docker images and start up each of the services.  One all that shows successful and completed hit each of your websites and start going through the configuration.  If you used our yaml, you should be able to hit:

Configuration

Set up each of the services the way you'd like.  The only only thing you want to keep wary of is the host URLs and ports.  For example, when setting up the Download Client for Radarr, the setup page will ask for the host, port, API Key etc.  For the host, you don't want to use localhost.  You want to enter your host's IP address.  The localhost in this context would be the container's local host which is not what you want.  Then for the port, you want to use the mapped port we defined in our yaml.  In our case use 3004 for Sabnzbd as our download client.


This it for now.  Part 3 (TBD) will go into setting up Let's Encrypt and NGINX proxy to give our websites a domain name and SSL to resolve to on the WAN.