Skip to content

Latest commit

 

History

History
379 lines (253 loc) · 12.9 KB

Docker-Compose_Setup.md

File metadata and controls

379 lines (253 loc) · 12.9 KB

Yet Another Radarr and Sonarr Guide - Docker Conversion

Shortly after posting my last guide, I was quickly informed how much better this setup would be with docker. Well, here I am, trying to get one monolithic docker compose file for the services previously installed:

Radarr

Sonarr

Deluge

Jackett

This guide can also be used for first time setups of these services, just ignore all the backing up and restoring. You might've seen my previous guide.

Written for Ubuntu 18.04. One caveat is that I have had little experience with docker before this, completing the tutorial around a year ago and not touching it since.

Mullvad

You can use any trusted VPN. I highly recommend Mullvad due to their security and anonymity.

It's use is super easy. First, download the Linux client with: wget https://mullvad.net/media/app/MullvadVPN-2019.10_amd64.deb

Install this with: sudo dpkg -i MullvadVPN-2019.10_amd64.deb

Now you can use the mullvad VPN on command line. For my setup, I wanted to have my VPN on all the time. Some other users may want to only have their torrent client use the VPN, to prevent leakage. See this article for help, and expand it to other torrent clients.

Important: I instantly locked myself out of my machine when setting this up without thinking. You MUST enable LAN access to continue remote access to your machine. See mullvad lan for more details.

mullvad status is a good way to see the current status. Are you connected or not?

mullvad account XXXXX to connect. Obviously input XXXX as your actual account number.

To verify, run curl ifconfig.me. Make sure it's not your normal public IP. This method is insecure, for some reason, so keep that in mind.

Now your machine is connected to a VPN, and accessible through it's private address. Good job!

Recommended: You will want to force Deluge to download torrents through Mullvad. One way to do this is to enforce a SOCKS5 proxy, only accessible if mullvad is on. Please see this link for easy instructions (follow the Firefox part).

Installing Docker and Docker compose

Source 1 (Docker)

Source 2 (Docker Compose)

Now you should have Docker and Docker Compose installed.

Test with:

docker -v

docker-compose --version

Backup our Existing Setups

Sonarr and Radarr should really be backed up first. I put the most time into those, such as importing movies and fixing TV shows, plus all the custom settings.

To backup, go to System -> Backups. Download this file on your main machine, or copy the link address and use

wget <INSERT LINK>

to download this on your server.

Download the latest copies of both backups.

Backing up Jackett didn't see to work for me. The Content folder didn't match any of the docker configs. Because it was so little to configure, I just set it up from scratch again.

I don't feel it's worth to bother backing up Jackett, as I only had 6 indexers. I also couldn't find a good way to backup Jackett.

To backup Jackett, cp -r the /home//Jackett/Content folder, or wherever it is on your machine

Making our Docker Compose File

Timezone: America/New_York

Find your timezone here.

Here is a template for all services. Radarr, Sonarr, Jackett, Deluge:

version: '3'
services:
 radarr:
  container_name: radarr
  restart: unless-stopped
  ports:
   - 7878:7878
  volumes:
    - <\path to data>:/config
    - <\path/to/movies>:/movies
    - <\path/to/downloadclient-downloads>:/downloads
  environment:
   - PUID=1000
   - PGID=1000
   - TZ=America/New_York
  image: linuxserver/radarr
 
 sonarr:
  container_name: sonarr
  restart: unless-stopped
  ports:
   - 8989:8989
  volumes:
    - <\path to data>:/config
    - <\path/to/tv>:/tv
    - <\path/to/downloadclient-downloads>:/downloads
  environment:
   - PUID=1000
   - PGID=1000
   - TZ=America/New_York
  image: linuxserver/sonarr
 
 jackett:
  container_name: jackett
  restart: unless-stopped
  ports:
   - 9117:9117
  volumes:
   - <\path to data>:/config
  environment:
   - PUID=1000
   - PGID=1000
   - TZ=America/New_York
  image: linuxserver/jackett

  deluge:
    image: linuxserver/deluge
    container_name: deluge
    network_mode: host
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/New_York
      - UMASK_SET=000 #optional
      - DELUGE_LOGLEVEL=error #optional
    volumes:
      - <\/path/to/deluge/config>:/config
      - <\/path/to/your/downloads>:/downloads
    restart: unless-stopped

All we need to do is fill in the blanks (meaning all the <path/to/configs>).

Username

First, get the PUID and PGID (unique identifiers) of the user you want to use these services with.

id <username>

uid=1000(wbollock) gid=1000(wbollock) groups=1000(wbollock),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),109(lxd),114(lpadmin),115(sambashare),128(deluge)

So, here they are both 1000. Substitute the username you wish to run these services with. Permissions are important in this case, and ls -l is your friend.

Directories

Now we are onto the directories.

I want my configuration files in /etc/. We need to make a configuration directory for each service.

For example, our radarr container needs these values:

volumes:
    - <\path to data>:/config
    - <\path/to/movies>:/movies
    - <\path/to/downloadclient-downloads>:/downloads

You need to repeat this step for every service. Here's a one liner of a good setup.

sudo mkdir /etc/radarr/ /etc/sonarr/ /etc/jackett/ /etc/deluge/

Now fill in the "<\path to data>" with the above directories.

Example:

volumes:
    - /etc/radarr/:/config

Do the same with your "Movies" and "TV" directories.

/mnt/STR/Plex Library/Movies:/movies

The section after the colon, "/movies", is what docker associates with the long path before it. It's a psuedo symlink.

Now, the deluge downloads folder is important. The other services will use it. I wanted this on my large storage array, so I chose: /mnt/STR/deluge/

Fill in the section <path/to/downloadclient-downloads> with the above.

I also wanted to make sure my user had access to all the config directories.

sudo chown -R wbollock:wbollock /etc/radarr/ /etc/deluge/ /etc/sonarr/ /etc/jackett

Almost There

Now we need to stop the existing services, as they both can't be bound to one port (there are other reasons too).

sudo systemctl stop radarr.service jackett.service deluged.service deluge-web.service sonarr.service

Your completed docker-compose file should look something like this:

version: '3'
services:
 radarr:
  container_name: radarr
  restart: unless-stopped
  ports:
   - 7878:7878
  volumes:
    - /etc/radarr/:/config
    - /mnt/STR/Plex Library/Movies:/movies
    - /mnt/STR/deluge/:/downloads
  environment:
   - PUID=1000
   - PGID=1000
   - TZ=America/New_York
  image: linuxserver/radarr
 
 sonarr:
  container_name: sonarr
  restart: unless-stopped
  ports:
   - 8989:8989
  volumes:
    - /etc/sonarr/:/config
    - /mnt/STR/Plex Library/TV Shows:/tv
    - /mnt/STR/deluge/:/downloads
  environment:
   - PUID=1000
   - PGID=1000
   - TZ=America/New_York
  image: linuxserver/sonarr
 
 jackett:
  container_name: jackett
  restart: unless-stopped
  ports:
   - 9117:9117
  volumes:
   - /etc/Jackett/:/config
  environment:
   - PUID=1000
   - PGID=1000
   - TZ=America/New_York
  image: linuxserver/jackett
 
 deluge:
  container_name: deluge
  restart: unless-stopped
  network_mode: host
  environment:
   - PUID=1000
   - PGID=1000
   - TZ=America/New_York
   - UMASK_SET=000 
   - DELUGE_LOGLEVEL=error 
  volumes:
   - /etc/deluge/:/config
   - /mnt/STR/deluge/:/downloads
  image: linuxserver/deluge

Check your compose file with docker-compose config. Mine is located in /home/wbollock/Radarr-Stack. Make sure to name the file docker-compose.yml.

Important: yml uses spaces, NOT tabs. It's very particular about every single indent. Make sure to line everything up properly, and possibly use an online yml parser to help.

You can only run docker-compose commands when in the same directory with your yml file. Or use the --file parameter to specify where the yml file is, if you're outside of that directory.

Finally, once you get a valid output and no errors from the above command, we're ready to create (it'll spit out the error in an obvious way if you have any). Run this in the folder with docker-compose.yml

sudo docker-compose up -d

Explanation: the -d is to run in detached mode, so we can use the terminal normally while it runs. Similar to &.

Note: one error I ran into was that a process, mono, was already listening on 8989. I took down my docker compose stack with sudo docker-compose down, and ran sudo netstat -tulpn | grep :8989 to find out what was listening on that port. It was mono, with PID 5649. I ran sudo kill 5649 to remove it from that port.

To see your processes run, type docker-compose ps. Make sure you see every service there.

Restoring our Settings

Now we should have a clean version of each service. Visit those services and make sure they all work.

Check out some of the files in /etc/radarr/. A lot of them are the same ones we backed up! We need to override those files with our backup.

First, stop all running containers.

sudo docker-compose stop

Then navigate to your radarr_backup.zip. Unzip it. Remove all files in /etc/radarr/ and /etc/sonarr/. This includes any .pids, config.xmls, nzbdrone.db*. Really everything important except for logs, if you care.

Move all the files (config.xml, nzbdrone.db, and nzbdrone.db-journal) to /etc/radarr/. These are unzipped from our .zip backups.

Then run sudo docker-compose -d from your original docker compose folder.

All your Radarr and Sonarr settings should be saved! Do sudo docker-compose logs if you have any issues.

To access your services, go to YOUR IP.XX.XX:<\PORT SET IN DOCKER>.

For example, running sudo docker-compose ps:

 Name     Command   State           Ports

deluge    /init     Up
jackett   /init     Up      0.0.0.0:9117->9117/tcp
radarr    /init     Up      0.0.0.0:7878->7878/tcp
sonarr    /init     Up      0.0.0.0:8989->8989/tcp

For some reason, deluge doesn't show up, but it's port is 8112. If you're using ufw, make sure to run sudo ufw allow PORT to get by your firewall.

Reconfiguring a few things

Sadly this isn't all automated. For example, my Sonarr/Radarr couldn't collect to deluge. I had to change "localhost" in the connection settings to 192.168.0.186 (IP you connect to deluge with).

Also, your apps will no longer understand the long root directories, /mnt/STR/Plex Library/Movies. Instead, change the path to /movies/ or /tv/, respectfully. I updated my library after doing this.

Also, deluge will need it's download folder to change. In preferences, change that to /downloads.

Lastly, just re-do your indexers in Jackett, and connect them to Radarr and Sonarr. All I had to change was my new API key - everything else stayed the same.

Missing Root Folder Error

After verifying your /movies/ or /tv/ folders work, and you want the clear the Root Folder Error, go the Series or Movies editor. Select all entries, or just one to test (safer), and select a different root folder on the bottom bar. Then hit save. The error will go away after all pieces of media are updated (and the service is restarted).

A reminder - some useful docker-compose commands

 docker-compose

  Run and manage multi container docker applications.
  More information: https://docs.docker.com/compose/reference/overview/.

  - List all running containers:
    docker-compose ps

  - Create and start all containers in the background using a docker-compose.yml file from the current directory:
    docker-compose up -d

  - Start all containers, rebuild if necessary:
    docker-compose up --build

  - Start all containers using an alternate compose file:
    docker-compose --file path/to/file up

  - Stop all running containers:
    docker-compose stop

  - Stop and remove all containers, networks, images, and volumes:
    docker-compose down --rmi all --volumes

  - Follow logs for all containers:
    docker-compose logs --follow

(Taken from tldr)

Everything else should work just fine! I hope you enjoyed.