Caddy on Docker on Synology

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

On your router, you need to port forward ports 80 (and 443? still awaiting response) 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 caddyfile and common.conf by replacing these terms as noted in each file:

  • YourDDNSName.DDNSPROVIDER.com (in caddyfile)
  • youremail@somewhere.com (in caddyfile)
  • YourUserID YourPassword (in common.conf with whatever you want to use when hitting your site)

Reverse Proxy Only New Caddyfile:
https://zerobin.net/?67894bcbb2fb5c6a#iQ1QL21B0tsDikCT41GgwPXf6kSGc/cWF8oq8e5L7LA=

Reverse Proxy Only Common.conf example:
https://zerobin.net/?4ed2769528df1c4a#nJfoL04CRcvyxNlCRMmkbtlhfLXB/22Hb74A9X71cFE=

Place these files in /apps/configs/caddy/Caddyfile/ and rename them to just be Caddyfile with no extension and common.conf

 

 

CaddySearch.jpg

CaddyLaunch.jpg

advanced.jpg

volume.jpg

Need new screenshot needed as first mount needs to be  /apps/config/caddy/Caddyfile to /etc/Caddyfile instead.

 

network.jpg

environment.jpg

next.jpg

apply.jpg

Need new screenshot needed as first mount needs to be  /apps/config/caddy/Caddyfile to /etc/Caddyfile instead.

 

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 common.conf, 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/radarrand YourDDNSName.DDNSPROVIDER.com/nzbget

 

I am currently explorering how to do CNAME instead.  As an example you’d go to sonarr.YourDDNSName.DDNSPROVIDER.com instead of YourDDNSName.DDNSPROVIDER.com/sonarr

This hasn’t been done correctly yet.  For now I’d recommend to remove all of the subdomain code blocks for now within the Caddyfile.

Remove these:

####################################################################################
# NZBGet subdomain code block, need to create logs folder?
####################################################################################

nzbget.YourDDNSName.DDNSPROVIDER.com {

gzip

# Separate log file for NZBGet server

log /caddy/logs/nzbgetaccess.log {
rotate_size 1 # Rotate after 1 MB
rotate_age 7 # Keep log files for 7 days
rotate_keep 2 # Keep at most 2 log files
}

errors /caddy/logs/nzbgeterror.log {
rotate_size 1 # Set max size 1 MB
rotate_age 7 # Keep log files for 7 days
rotate_keep 2 # Keep at most 2 log files
}

proxy / 127.0.0.1:6789 {
transparent
}

}

####################################################################################
# Sonarr subdomain code block, need to create logs folder?
####################################################################################

sonarr.YourDDNSName.DDNSPROVIDER.com {

gzip

# Separate log file for Sonarr server

log /caddy/logs/sonarraccess.log {
rotate_size 1 # Rotate after 1 MB
rotate_age 7 # Keep log files for 7 days
rotate_keep 2 # Keep at most 2 log files
}

errors /caddy/logs/sonarrerror.log {
rotate_size 1 # Set max size 1 MB
rotate_age 7 # Keep log files for 7 days
rotate_keep 2 # Keep at most 2 log files
}

proxy / 127.0.0.1:8989 {
transparent
}

}

####################################################################################
# Radarr subdomain code block, need to create logs folder?
####################################################################################

radarr.YourDDNSName.DDNSPROVIDER.com {

gzip

# Separate log file for Radarr server

log /caddy/logs/radarraccess.log {
rotate_size 1 # Rotate after 1 MB
rotate_age 7 # Keep log files for 7 days
rotate_keep 2 # Keep at most 2 log files
}

errors /caddy/logs/radarrerror.log {
rotate_size 1 # Set max size 1 MB
rotate_age 7 # Keep log files for 7 days
rotate_keep 2 # Keep at most 2 log files
}

proxy / 127.0.0.1:7878 {
transparent
}

}

####################################################################################
# Synology subdomain code block, need to create logs folder?
####################################################################################

synology.YourDDNSName.DDNSPROVIDER.com {

gzip

# Separate log file for Synology server

log /caddy/logs/synologyaccess.log {
rotate_size 1 # Rotate after 1 MB
rotate_age 7 # Keep log files for 7 days
rotate_keep 2 # Keep at most 2 log files
}

errors /caddy/logs/synologyerror.log {
rotate_size 1 # Set max size 1 MB
rotate_age 7 # Keep log files for 7 days
rotate_keep 2 # Keep at most 2 log files
}

proxy / 127.0.0.1:5000 {
transparent
}

}

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

 

Configuring NZBGet on Synology (Docker)

The following guide was last edited 6/13/2017 using NZBGet 18.1.  The settings in this guide go along with our guide “Setting up Docker on a Synology NAS”.

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 a usenet provider account.  In our example, we will be using Newsgroup.ninja.  You will need to read up and decide what provider that you want to use.  Some sites may require you to pay a full year in advanced to get the best deal.  It is a good idea to test them out before signing up for a long term deal.  Currently, News.Ninja is offering a special deal on Reddit at only $5.99 month to month without a commitment.  I appreciate they are active in the community, and please note that I am not receiving a referral bonus.  In general, look out around Black Friday/ Cyber Monday for awesome deals too.

Open up the NZBGet web interface at http://ipaddress:6789

The default username is nzbget and the password is tegbzn6789

On the main nzbget page, click Settings along the top.

nzbget-first-page-click-settings2.jpg

On the PATHS page (tabs on left side), I just tweaked the first three boxes:

  • MainDir: /apps/nzbget
  • DestDir: ${MainDir}/complete
  • InterDir: ${MainDir}/incomplete

09-06-2017-05-54-45.png

On the NEWS-SERVERS page, this is where you will add your usenet server(s).  Start with making sure your first entry, Server 1 is set to active.  Next type in a name for this server.  In this example, I am using Ninja-US for the name and using their direct address for their US server.  Check with your Usenet Provider to see if they offer direct links.  In this example, I will setup three different country servers US, NL, and DE.  I leave group at 0, but put them in different “levels” in NZBGet as nearest 0, next nearest 1, and furthest 2.

I recommend using the encryption option (SSL) of yes and using port 443.  An alternative SSL port is 563.  Check with your provider on options, but these two options should work fine for most.  Go ahead and populate the fields: Active , Name, Level, Host providers server address), usenet account username, usenet account password, encryption, and connections.  Regarding connections, one recommendation is to start with 6 connections and check your speed.  Then keep adding 2 more and testing until you maximize your speed.  I am currently trying out 15 connections.  Here is a screenshot:

Server1a.jpg

Server1b.jpg

Click Test Connection and confirm you get the success message in the lower right corner as shown here:

ConnectionSuccessful.jpg

At this point you can stop with one server, but if you’d like to add all three, click Add Another Server, then input the details for your second server, test the connection, and then add the third server.  Here are screenshots for the second and third servers for our example:

Server2a.jpgServer2b.jpg

Server3a.jpg

Server3b.jpg

One final note on usenet providers, some people choose to add an entirely different usenet provider, usually as a Block Account.  Click that link to understand that further.

Click Save all changes, and let’s move on to the next section.

Click on CATEGORIES to load up our next page.  An important note before we start, notice that I did not use anything in the aliases fields.  This is because Sonarr/Radarr will do all of the work instead of NZBGet.  Your first category defaults to movies.  Pay attention as these are case sensitive.  In this guide we are keeping everything lower case.  Also note the DestDir may need tweaked from ‘completed’ to ‘complete’ as an example too.  Go ahead and fill in name as movies, DestDir as ${MainDir}/complete/movies, and make sure Unpack is set to Yes.

09-06-2017-06-06-29.png

Now scroll down to Category2.  This may have defaulted to the category name Series.  In this guide, we use tv instead.  Go ahead and fill in name as tv, DestDir as ${MainDir}/complete/tv, and make sure Unpack is set to Yes.

09-06-2017-06-12-58.png

Next, click on INCOMING NZBS.  Make sure AppendCategoryDir is enabled to work with the categories we configured earlier. Note that you may need to disable this for some automation software like CouchPotato, SickRage or Sonarr.

Leave DupeCheck on, which will avoid downloading the same nzb file twice

nzbget-incoming-nzbs2.jpg

Next, click on UNPACK on the left menu to load up the next page we will edit.  In the field ExtCleanupDisk, we will add to what is already there: ,.nfo, .jpg, .exe, .bat, therefore in the field you will have .par2, .sfv, _brokenlog.txt, .nfo, .jpg, .exe, .bat

ExtCleanupDisk.jpg

Next, click on LOGGING in the left menuand for WriteLog set it to Rotate.  This will keeps the logs from getting too large.logging.jpg

<Is this necessary, lets test leaving at default?> Next click on SECURITY and scroll down to umask to 0002.  Sonarr requires umask 007 or you will see an error like this:  “Couldn’t add report to download queue. *****.S01E11.HDTV.x264-LOL: Failed to add nzb *****.S01E11.HDTV.x264-LOL.nzb”

security_umask.jpg

Scroll down until you see Save Changes in the bottom left corner and click it.

nzbget-save-all-changes.jpg

That should do it as a basic configuration for NZBGet.  You may want to check out HTPC’s Guide for low power devices configuration if you have an older NAS. Now you can move onto Sonarr/Radarr configuration!

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