Caddy on Docker on Synology

*This guide is incomplete.  Feedback and tweaks welcomed.*

 

You need a DDNS from no-ip or duckdns.org

On your router, you need to port forward ports 80 and 443 to your NAS.

You also need to setup URL base for sonarr and radarr in settings.  NZBGet’s is already built in to to work.

Create folders on NAS.

  • /apps/configs/caddy/
  • /apps/configs/caddy/logs/
  • /apps/configs/caddy/Caddyfile/
  • /apps/configs/caddy/certificates/

Customize the caddyfile by replacing these terms as noted in each file:

  • YOUR_DDNS_NAME.YOUR_DDNS_PROVIDER.X
  • YOUR_EMAIL@YOUR_EMAIL_PROVIDER.X
  • YOUR_USERID YOUR_PASSWORD (with whatever you want to use when logging into your site remotely)
  • YOUR_NAS_LOCALIP (with your server’s local IP address, such as 192.168.1.99)

Reverse Proxy Only New Caddyfile: https://paste.ee/p/kL04B

Place this file in /apps/configs/caddy/Caddyfile/ and rename itto just be Caddyfile with no file extension.

 

Open docker, go to the registry tab.  Search and locate the abisoft/caddy container.  If you just search caddy, it will be near the top. Click Download.CaddySearch.jpg

 

It may take a few minutes to download.  Next go to the image tab and click the abiosoft/ caddy image. Click Launch. Now click Advanced Settings.

CaddyLaunch.jpg

In the first tab, Advanced Settings, check the box next to Enable auto-restart.

advanced.jpg

On the Volume tab, add the following. Please note when to use FILE and FOLDER.

Add File: apps/config/caddy/Caddyfile to /etc/Caddyfile

Add Folder: apps/config/caddy/Caddyfile to /root/.caddy

volumeFINAL.jpg

 

On the Network tab, check the box for Use the same network as Docker Host.

network.jpg

On Port Settings tab, leave default.

On Links tab, leave default

On Environment tab, add command –conf /etc/Caddyfile –log stdout

environment.jpg

Then Click OK. Then Next. Then Apply.

 

Off of your homenetwork, perhaps your cell phone with the wifi off, navigate to YourDDNSName.DDNSPROVIDER.com/sonarr , login with the userID/password you setup in the Caddyfile, and now you should be able to use Sonarr just like you were on your home network.

You can do the same with YourDDNSName.DDNSPROVIDER.com/radarr and YourDDNSName.DDNSPROVIDER.com/nzbget

 

My Issues

In my case, I had to setup some custom port forwarding for my ASUS router (running merlin) as I had issues connecting remotely.  If needed, I can update the guide with exactly what I had to do.  For now here is a run down.  On my router, I did port forwarding to my NAS IP using TCP.  External Port 80 to internal port 8080 and External Port 443 to internal port 8443.  In the docker container I then updated port settings: (first I had to update the Network tab and uncheck the box for Use the same network as Docker Host.)

Local Port 8443 to Container Port 443 via TCP

Local Port 8080 to Container Port 80 via TCP

PortSettingsUPDATED.jpg

 

 

 

Advertisements

Configuring Sonarr/Radarr on Synology (Docker)

The following guide was last edited 6/13/2017 using Sonarr 2.0.0.4753 and Radarr 0.2.0.696.

In the past, I recommended following the guide by our friends at HTPC Guides for the general setup.  I will provide a streamlined version.  Before proceeding, you will need an account with a premium indexer.  You should be able to easily find your API key on their site.

Open up the Sonarr web interface at http://ipaddress:8989

SonarrMain.jpg

Click on the Settings button across the top.

Let’s start in the Media Management tab, I recommend to enable rename episodes and customize it to your liking.  I recommend including the Quality, it isn’t strictly required, but it will help if you want Sonarr to scan existing unknown files.  Again totally person preference.  In my case I also like to use space as the separator and label season folders without spelling out the word season.

SonarrMM1.jpg

Now onto the Indexers tab.  Note that the indexer Womble is no longer available.  I just use a one premium provider.

Click the gigantic plus (+) sign.  Then select your provider.  Most are located under the NewzNab, but you can also choose custom.  If your provider is listed, it should automatically pull in the API URL.  If unsure, you can always check with your provider.  Now just plug in your assigned API, click test.

SonarrIndexer1.jpg

You should receive confirmation that the test worked in the lower right part of the screen.

IndexerNotification.jpg

Now click Save.

You will now be back at the Indexers main screen.  You may leave these options on the defaults.

SonarrIndexer2.jpg

 

Now onto the Download Client tab.  Our example will be using NZBGet.   Click the huge plus button and then select the NZBGet.   Input your nzbget information. Note that the default username is nzbget and password is tegbzn6789.

The category Series is enabled in nzbget by default, if you want it to be called tv you must first change the category name in nzbget, save all changes and reload the server. Bear in mind the category here is case sensitive for nzbget so ‘series’ won’t work unless you have changed it in nzbget from ‘Series’ to ‘series’.  I stayed with using tv.

SonarrDownloadClient2.jpg

 

Hit test, you should see the notification and hit Save.

You will now be back at the Download Client tab.  I prefer to enable all 4 items here.  Some people leave Completed Download Handling -> Remove at No.  I prefer setting it as Yes. This removes history items from nzbget after they have been imported. For nzbget that means the history item becomes ‘hidden’.

SonarrIndexer2.jpg

Important note before continuing.  Now that we use Completed Download Handling, we no longer use any Drone Factory capabilities.  Clicking the advanced tab will reveal these fields.  Check out this thread for more info.  Drone Factory must be empty and Drone Factory interval must be zero.

SonarrDownloadClient3.jpg

Lastly, in preparation for a reverse proxy guide, go to the General tab, and add ‘sonarr’ to the URL base.  Note that this will change your access URL to:

SonarrGen1.jpg

I wanted to add a special note about my setup with tv and kids_tv folders.  Upon using the import series on disk option, I was able to add both folders.  This will lock in their corresponding paths as new shows air.  Upon going to add a new series, I have both folders as options their as well.  I could always select to add other path too.

09-06-2017-06-39-03.png

 

Now onto Radarr.  It is extremely intuitive and mirror what you just did for Sonarr.  Add the indexer and Download Client the exact same way.  As you are adding the Download Client, be careful to label the category as case sensitive.  On mine I had to change to a lowercase m in movies.

6-9-2017 7-29-28 PM.jpg

Again under the Download Client advanced settings, Drone Factory must be empty and Drone Factory interval must be zero.

Radarr.jpg

 

Setting up Docker on a Synology NAS

The following guide was last edited 6/14/2017 using Synology DSM 6.1.1-15101-4 and Docker 1.11.2-0325.

This is the first part of a series showing you how to setup Usenet Automation using Docker on a Synology NAS.

I have been using the Synology community packages for quite some time as they were convenient to install from package manager but with recent iterations of DSM these packages quite often fail to install or even run, and its never clear what low level system changes they are making. So now that Docker is available for most Intel based Diskstation’s I decided to jump ship.

In this first guide I will take you through getting Docker setup.

What is Docker?

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, these application are distributed as Containers.

What is a Container?

A container is kind of what it says on the box, it contains everything that is required to run a particular application. you simply download a pre packaged image someone has already built and it will run within Docker, this means it makes no changes to your system and can easily be backed up if you even need to move it elsewhere.

Onto the Guide

This guide makes some assumptions that you have a general knowledge of the DSM interface and how to do the basics.

What I will be covering

  1. Installing Docker
  2. Getting PGID and PUID
  3. Setting up directories on your volume
  4. Downloading the Docker Images
  5. Setting up each container

Installing Docker

First things first you need to head into Package Center and search for Docker, install it to which ever volume you want, I personally have my apps on a dedicated SSD which keeps things snappy.

PackageCenterDocker.png

When you first open docker you will be asked if you want to read the help guides, you can choose if you want to do this. You will then be greeted by the overview tab, this will give you some overall usage stats for CPU and Memory, and once installed it will list running containers, my 412+ has been upgraded to 2Gb of RAM when it was my main NAS.

Before we proceed any further with downloading and installing containers, we need to determine our PGID and PUIDas well as make sure that we have shares/folders setup and ready.

 

PGID and PUID

In the previous versions of these guides I used a long winded approach to getting your ID information, I have since found a much easier approach.

You will need to SSH into your Diskstation using ‘Putty’ or an equivalent program.

Open up Putty, the only thing you need to enter is the IP address of your NAS and select the SSH radio button.

putty

Click on open, you will get a prompt asking if you trust the key, if this is the first time you have used SSH, just press OK or accept.

Enter the login information for you Synology user account, you will not be able to see the password as you type it, I use a very long one so I just paste it in from my password manager. (right click acts as paste in putty)

Once logged in type ‘id’ without the quotes and this will show your UID(aka PUID) which in my case is 1026 and the GID(aka PGID) which is 101 for an administrator

putty02

 

Setting Up Directories on Your Volume

Before we jump into downloading images and configuring containers, let’s setup a basic shared folder structure on your volume.  At the root level, I created the shared folders apps and video.

09-06-2017-05-42-39.png

Instead of housing NZBGet’s download folders within a generic downloads share folder, I decided to use the following.

  • /apps/nzbget
  • /apps/nzbget/incomplete
  • /apps/nzbget/complete
  • /apps/nzbget/complete/tv
  • /apps/nzbget/complete/movies

The tv and movie path’s are important as they will be put into Sonarr and Radarr respectively.  Everything, while being downloaded sits in incomplete.  When it’s complete, because every NZB sent to NZBGet from Sonarr/Radarr is either tagged with category “tv” or “movies” it ends up unpacked/unrar’d in either /completed/tv or /completed/movies and then Sonarr/Radarr auto scan picks it up and does rename/move/clean up leftover files.  All of this is really taking place within the NZBGet app itself, so I decided to keep it this way as there are other folders and files under NZBGet too.

I decided to make “/apps/configs” a real directory on my actual volume and have all containers write their configs to that.  The reason for this is that if something goes wrong with any container and I have to delete it and start again, I already have a copy of my config saved on my actual volume rather than inside the container.  /config is where most Linux|Server.io apps store all of their config details.  Inside the apps folder I created a configs folder.  I then created a folder for each app I plan to install.  Here is a list of the folders I created:

  • /apps/configs/nzbget (or could have /apps/configs/sabnzb)
  • /apps/configs/radarr
  • /apps/configs/sonarr

Next I created folders to organize my videos final locations.  For my setup, I wanted to have separate kids areas.  You may want some additional folders, such as one just for anime.  Here are the ones I am using:

  • /video/kids_movies
  • /video/kids_tv
  • /video/movies
  • /video/tv

 

Downloading the Docker Images

Now that we have our folders setup, let’s download the Docker images.  Open up Docker and click on the Registry tab on the left hand side. The registry is where you search for all of the available docker images on Docker.com.  Let’s start with NZBGet.  In the search box enter NZBGet.

09-06-2017-05-17-39.png

Click on the image made by Linux|Server.io as this will always be kept up to date. Click on Download.

After a few seconds the image will begin downloading this can be tracked in the ‘image’ tab, once the download has completed you will get a system message and the little blue animation to the right will stop.  Go ahead and repeat this process for all of the apps you want to install.  In our guide we will be using: NZBGet (or SabNZB), Radarr, and Sonarr. <later we may go back and add more, such a nginx or however we decide to write-up remote/external access>

 

Setting Up Each Container <We may just link to each existing app page instead>

Now that we have our folders setup and Docker app images are fully downloaded.  Let’s setup each container.  Back in the image menu highlight the first container you’d like to configure and click on Launch.  This will open up the setup wizard.

On the first screen, tick the ‘Enable Auto Restart’ this will ensure the container starts up automatically if you reboot.  Otherwise, I am not making any changes as I do not need to limit the resources on my 1815+ as I have 6GB of RAM, just go straight into ‘Advanced Settings’.

newnzbget01

 

Volumes Tab

Then click on volumes tab, we are now going to set up the shares we want to mount.  They are fairly similar in that they all have /apps both for columns file/folder and mount.  They each have their corresponding /config folder mount path mapped to /apps/configs/<app name here>.  Lastly, Sonarr points to tv while Radarr points to movies.   Note that I also created mounts for my kids folders.  Here are screenshots of the volumes tab for each app:

nzbgetvolumes.png

sonarrvolumes.png

radarrvolumes.png

Network

Next click on the Network tab.  Tick the box for “Use the same network as Docker Host”.  This step is very important.  Prior to this setting being added to Docker, it was a very frustrating experience to get the containers to interact.

NetworkTab.png

Port Settings Tab

Now that we are using the “same network as Docker Host” setting in the Network tab, the port settings are no longer editable here.  The defaults for each app will be used.  You must make changes within each apps config to change any ports and/or enable SSL.

Links

You do not need to setup anything on this tab.

Environment Variables (PGID,  PUID and Timezone)

Next we are going to setup a couple of environment variables.  These are the user details we took note of earlier so that the Docker images have the right access to the shares we just added.  In addition, there is a new requirement to add the correct Timezone to the container you can do this as shown in the screen shot below, you can find a list of timezone here https://en.wikipedia.org/wiki/List_of_tz_database_time_zones .  Complete this setup within all of your containers.

 

Almost Done

You have now completed the setup of the container, click on OK to move back to the initial settings screen and then click next, you will be shown an overall summary of the settings we have specified, this is a good time to double check everything is correct. Finally click on Finish and the container should start to boot.

Once you’ve got all of your containers setup accordingly, continue to the next post for configuration of each app.

Here are the stock ports, you connect to each app within your internet browser by accessing your <NAS’ hostname or IP>:<port below>, such as http://192.168.1.99:6789 :

  • NZBGet Port = 6789 (SSL = 6791, but won’t work until enabled in it’s config)
    • (default userID/password is nzbget/tegbzn6789)
  • Sonarr Port = 8989 (SSL = 9898, but won’t work until enabled in it’s config)
  • Radarr Port = 7878