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
- Installing Docker
- Getting PGID and PUID
- Setting up directories on your volume
- Downloading the Docker Images
- Setting up each container
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.
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.
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
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.
Instead of housing NZBGet’s download folders within a generic downloads share folder, I decided to use the following.
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)
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:
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.
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’.
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:
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.
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.
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.
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