You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
367 lines
15 KiB
367 lines
15 KiB
4 years ago
|
# Synology
|
||
|
|
||
|
!!! note
|
||
|
|
||
6 months ago
|
Being I don't have a Synology myself and I kind of hate the Synology GUI for the dockers, we're going to do this with the use of docker-compose through a terminal.
|
||
4 years ago
|
|
||
2 years ago
|
This is faster than the GUI and after installing, it shows up in the Docker GUI.
|
||
4 years ago
|
|
||
3 years ago
|
Thanks to faxity for the initial compose that I used to create the Synology Guide.
|
||
4 years ago
|
|
||
3 years ago
|
And a very big thanks to [Bokkoman](https://www.buymeacoffee.com/bokkoman){:target="_blank" rel="noopener noreferrer"} and [BZwart](https://github.com/BaukeZwart){:target="_blank" rel="noopener noreferrer"} that updated this Guide for DSM 7 and also offered their help on discord as Synology Support Team.
|
||
3 years ago
|
|
||
3 years ago
|
## Introduction
|
||
|
|
||
6 months ago
|
This page will provide you with guidance on how to install several Docker images related to the Servarr apps to your Synology. We highly recommend reading the full guide, that way you have a better understanding of what you do, in case you later decide to make changes.
|
||
8 months ago
|
|
||
|
## Summary
|
||
|
|
||
7 months ago
|
1. We will create **_one_** share that will hold all your data. This ensures hardlinking and/or instant moves are possible.
|
||
6 months ago
|
1. Create one user that will be assigned to the docker images as the user they run out of security reasons.
|
||
8 months ago
|
1. Create a folder structure on the `data` and `docker` share with a few commands (or manually).
|
||
|
1. Download and edit the `docker-compose.yml` and `.env` files to your system settings.
|
||
6 months ago
|
1. Set permissions to all folders related to the shares.
|
||
8 months ago
|
1. Run and execute docker commands to start the containers.
|
||
3 years ago
|
|
||
3 years ago
|
### Automated Script
|
||
3 years ago
|
|
||
1 year ago
|
??? example "Automated script (**:bangbang:Use this script at your own risk:bangbang:**) - [Click to show/hide]"
|
||
3 years ago
|
|
||
3 years ago
|
!!! Warning
|
||
7 months ago
|
|
||
1 year ago
|
Though, we offer a short way out. This is intended as a quick way to do everything that is written on this page within one script. And is only for initial setup. After that, you need to manage it yourself. Rerunning the script can or will reset all personal changes made in the compose/env.
|
||
3 years ago
|
|
||
2 years ago
|
The script is only tested on Synology DSM7 and higher.
|
||
3 years ago
|
|
||
6 months ago
|
**:bangbang: We are not held liable if anything breaks on your system. Use at your own risk :bangbang:**
|
||
3 years ago
|
|
||
2 years ago
|
To get this working you will need to enable terminal access (SSH) and home folders.
|
||
2 years ago
|
|
||
6 months ago
|
Be sure to delete current running Docker containers related to this guide (ie. *arr apps, download clients), and backup settings before you do.
|
||
2 years ago
|
|
||
2 years ago
|
To enable SSH on your Synology take a look [HERE](#ssh){:target="_blank" rel="noopener noreferrer"}.
|
||
2 years ago
|
|
||
2 years ago
|
To enable Home folders, go to `Control Panel` > `User & Group` > `Advanced` > `Enable user home service` at the bottom.
|
||
2 years ago
|
|
||
2 years ago
|
![!home-folders](images/home-folders.png)
|
||
3 years ago
|
|
||
6 months ago
|
When you enable these two settings, run the following commands in your favorite terminal app and follow the onscreen questions.
|
||
3 years ago
|
|
||
|
```bash
|
||
3 years ago
|
curl -sL git.io/syno-script > ~/syno-script
|
||
3 years ago
|
```
|
||
3 years ago
|
|
||
3 years ago
|
```bash
|
||
3 years ago
|
sudo bash ~/syno-script
|
||
3 years ago
|
```
|
||
3 years ago
|
|
||
|
## Install Docker
|
||
|
|
||
6 months ago
|
You need to install Docker / Container Manager from the `Package Center`. This should also create a share named `docker`, and check File Station if it is present.
|
||
4 years ago
|
|
||
3 years ago
|
## Create the main share
|
||
|
|
||
8 months ago
|
We will create and use a new share named `data` (lowercase) for all your library media and downloads.
|
||
3 years ago
|
|
||
|
To create a new share:
|
||
|
|
||
3 years ago
|
`Control Panel` > `Shared Folder` > click `Create` > choose `Create Shared Folder`
|
||
3 years ago
|
|
||
3 years ago
|
![!create_share](images/create_share.png)
|
||
|
|
||
8 months ago
|
Name this shared folder `data`. You can disable the trash can, up to you. Click next until you are done.
|
||
3 years ago
|
|
||
3 years ago
|
## Create a user
|
||
3 years ago
|
|
||
6 months ago
|
We are going to create a new user that only has access to the share(s) that we use for the containers to run. You should not have the containers run as an admin/root user.
|
||
3 years ago
|
|
||
3 years ago
|
Go to `Control Panel` > `User & Group`
|
||
3 years ago
|
|
||
6 months ago
|
In the `User` section, create a new user. Name it whatever you like, but for this guide, we will use the name `docker`.
|
||
3 years ago
|
|
||
3 years ago
|
![!adduser](images/adduser.PNG)
|
||
3 years ago
|
|
||
3 years ago
|
Fill out the rest of the information, generate a password or type your own.
|
||
3 years ago
|
|
||
8 months ago
|
Click next, you will now be able to select which group this user will belong to, it should only be the group `users`. Click `Next`.
|
||
3 years ago
|
|
||
|
### Assign shared folder permissions
|
||
|
|
||
6 months ago
|
In the next screen, you will be able to select which Shares this user will have access to, click `No Access` on the top, this will deny all access.
|
||
3 years ago
|
|
||
8 months ago
|
Now **only** select `Read/Write` on the shares `docker` and `data` (the share we created earlier).
|
||
3 years ago
|
|
||
3 years ago
|
![!Assign shared folders permissions](images/adduser_2.PNG)
|
||
3 years ago
|
|
||
3 years ago
|
Click `Next` until you reach `Assign application permissions`
|
||
3 years ago
|
|
||
3 years ago
|
### Assign application permissions
|
||
3 years ago
|
|
||
6 months ago
|
In this screen, you will be able to select which application this user will have access to. Check `Deny` for all applications.
|
||
3 years ago
|
|
||
3 years ago
|
![!Assign application permissions](images/adduser_3.PNG)
|
||
|
|
||
|
Continue to click `Next` until you are finished.
|
||
3 years ago
|
|
||
3 years ago
|
## SSH
|
||
3 years ago
|
|
||
3 years ago
|
You are mostly going to use the terminal. Some parts will need the Synology web GUI.
|
||
8 months ago
|
To enable terminal access, you need to enable SSH in the Synology Settings.
|
||
3 years ago
|
|
||
3 years ago
|
`Control Panel` > `Terminal & SNMP` > `Enable SSH service`
|
||
3 years ago
|
|
||
|
![!synology-control-panel](images/synology-ssh.png)
|
||
3 years ago
|
|
||
7 months ago
|
Then use a program like [Putty](https://www.putty.org/){:target="\_blank" rel="noopener noreferrer"} or Powershell/Terminal to SSH into your Synology.
|
||
3 years ago
|
|
||
6 months ago
|
Enter the login information of a Synology user account that has admin privileges, as only members of the 'administrators' user group can use SSH.
|
||
3 years ago
|
|
||
8 months ago
|
If you get a message asking if you want to trust the key, just press `OK` or `ACCEPT`.
|
||
3 years ago
|
|
||
|
### PUID and PGID
|
||
3 years ago
|
|
||
6 months ago
|
For the Docker container to access the shares on Synology, we need to know the user ID (PUID) and group ID (PGID) from the `docker` user we just created.
|
||
3 years ago
|
|
||
8 months ago
|
Once logged in to the terminal type `id docker`. If you used a different username, change `docker` to the one you used.
|
||
3 years ago
|
|
||
4 years ago
|
![!synology-id](images/synology-id.png)
|
||
|
|
||
3 years ago
|
This will show you the UID (aka PUID).
|
||
6 months ago
|
In the screenshot above this is `1035` for the docker user and `100` is the GID (aka PGID) for the user's group.
|
||
8 months ago
|
Save these values for later use.
|
||
4 years ago
|
|
||
8 months ago
|
## Create Folder Structure
|
||
4 years ago
|
|
||
8 months ago
|
Let's create a good folder structure on the shares we use (`docker` and `data`). This will be done with a few commands.
|
||
4 years ago
|
|
||
8 months ago
|
The structure will look like this. You can of course edit this, but do this when you know what you are doing.
|
||
6 months ago
|
_We are using lowercase on all folders on purpose, being Linux is case-sensitive._
|
||
4 years ago
|
|
||
2 months ago
|
{! include-markdown "../../../includes/file-and-folder-structure/docker-tree-full.md" !}
|
||
4 years ago
|
|
||
2 months ago
|
{! include-markdown "../../../includes/file-and-folder-structure/bad-path-suggestion.md" !}
|
||
2 years ago
|
|
||
8 months ago
|
To create the folder structure for your media library and also for your preferred download client, run one or both of the following commands:
|
||
4 years ago
|
|
||
8 months ago
|
### If you use usenet
|
||
3 years ago
|
|
||
|
```bash
|
||
1 year ago
|
mkdir -p /volume1/data/{usenet/{incomplete,complete}/{tv,movies,music},media/{tv,movies,music}}
|
||
3 years ago
|
```
|
||
|
|
||
8 months ago
|
### If you use torrents
|
||
3 years ago
|
|
||
|
```bash
|
||
3 years ago
|
mkdir -p /volume1/data/{torrents/{tv,movies,music},media/{tv,movies,music}}
|
||
3 years ago
|
```
|
||
|
|
||
7 months ago
|
---
|
||
3 years ago
|
|
||
|
### Appdata
|
||
4 years ago
|
|
||
8 months ago
|
Your application data will be stored in the `docker` share in the folder called `appdata` (`/volume1/docker/appdata`)
|
||
6 months ago
|
Create these folders with the command below, or create them in File Station manually.
|
||
4 years ago
|
|
||
|
```bash
|
||
8 months ago
|
mkdir -p /volume1/docker/appdata/{radarr,sonarr,bazarr,plex,prowlarr,pullio}
|
||
4 years ago
|
```
|
||
|
|
||
8 months ago
|
You can add your own subfolders for your download client(s) using the command above, by adding the name to the command.
|
||
3 years ago
|
|
||
4 years ago
|
So your appdata folder will look like this.
|
||
|
|
||
|
```none
|
||
|
docker
|
||
|
└── appdata
|
||
|
├── radarr
|
||
|
├── sonarr
|
||
|
├── bazarr
|
||
|
├── plex
|
||
8 months ago
|
├── prowlarr
|
||
3 years ago
|
├── pullio
|
||
8 months ago
|
├── (your download client, i.e. nzbget; sabnzbd; qbittorrent)
|
||
|
└── (other applications)
|
||
4 years ago
|
```
|
||
|
|
||
7 months ago
|
---
|
||
4 years ago
|
|
||
|
## Needed files
|
||
|
|
||
3 years ago
|
Now we are ready to move to the installation of containers.
|
||
|
|
||
3 years ago
|
For this, we need two files:
|
||
|
|
||
|
1. `docker-compose.yml`
|
||
|
1. `.env`
|
||
3 years ago
|
|
||
6 months ago
|
We will start by downloading the `docker-compose.yml` file
|
||
4 years ago
|
|
||
6 months ago
|
Download this [docker-compose.yml](https://raw.githubusercontent.com/TRaSH-/Guides-Synology-Templates/main/docker-compose/docker-compose.yml){:target="\_blank" rel="noopener noreferrer"} to your `/volume1/docker/appdata` location so you can get your important stuff together. Or use the command below:
|
||
4 years ago
|
|
||
|
```bash
|
||
3 years ago
|
wget https://raw.githubusercontent.com/TRaSH-/Guides-Synology-Templates/main/docker-compose/docker-compose.yml -P /volume1/docker/appdata/
|
||
4 years ago
|
```
|
||
|
|
||
8 months ago
|
### What's included in the compose and what is not included
|
||
4 years ago
|
|
||
8 months ago
|
This docker-compose file will have the following docker containers included.
|
||
4 years ago
|
|
||
8 months ago
|
```none
|
||
4 years ago
|
- Radarr
|
||
|
- Sonarr
|
||
3 years ago
|
- Bazarr (Subtitle searcher and downloader)
|
||
4 years ago
|
- Plex
|
||
8 months ago
|
- Prowlarr (indexer/tracker manager)
|
||
8 months ago
|
```
|
||
4 years ago
|
|
||
8 months ago
|
What's not included (and where are the download clients?).
|
||
4 years ago
|
|
||
7 months ago
|
We didn't add a download client to it, because it depends on what you prefer (usenet/torrent) and which client you prefer. We have a repository [Repository](https://github.com/TRaSH-/Guides-Synology-Templates/tree/main/templates){:target="\_blank" rel="noopener noreferrer"} on Github where we provide and maintain some templates that are ready to use with the main `docker-compose.yml`.
|
||
4 years ago
|
|
||
6 months ago
|
The only thing you need to do is copy & paste what's inside the template file into the main `docker-compose.yml` on the bottom, the templates also have a command that you need to use to create the [appdata](#appdata) folder that we explained earlier. Without the appdata folder for the application, the creation of the container will fail because of the missing folder.
|
||
4 years ago
|
|
||
6 months ago
|
Second, we will download the `.env` file
|
||
4 years ago
|
|
||
7 months ago
|
Download this [.env](https://raw.githubusercontent.com/TRaSH-/Guides-Synology-Templates/main/docker-compose/.env){:target="\_blank" rel="noopener noreferrer"} to your `/volume1/docker/appdata` location next to the `docker-compose.yml`. Or use this command:
|
||
4 years ago
|
|
||
|
```bash
|
||
3 years ago
|
wget https://raw.githubusercontent.com/TRaSH-/Guides-Synology-Templates/main/docker-compose/.env -P /volume1/docker/appdata/
|
||
4 years ago
|
```
|
||
|
|
||
2 years ago
|
!!! warning
|
||
3 years ago
|
|
||
7 months ago
|
:bangbang: MAKE SURE THE FILE KEEPS THE ORIGINAL NAME `.env` WITH THE DOT BEFORE IT :bangbang:
|
||
|
|
||
|
---
|
||
4 years ago
|
|
||
3 years ago
|
### Changes and preparations
|
||
4 years ago
|
|
||
3 years ago
|
!!! tip
|
||
7 months ago
|
|
||
|
If you need to edit docker-compose.yml or the .env file we advise to use [Notepad++](https://notepad-plus-plus.org/){:target="\_blank" rel="noopener noreferrer"} or [Visual Studio Code](https://code.visualstudio.com/){:target="\_blank" rel="noopener noreferrer"}
|
||
4 years ago
|
|
||
6 months ago
|
The `.env` file we downloaded holds the variables/information you need to change for everything to work. I added explanations in the `.env` file.
|
||
3 years ago
|
|
||
3 years ago
|
1. DOCKERCONFDIR (only change this if you know what you're doing and decide to use another path than this guide used)
|
||
3 years ago
|
1. DOCKERDATADIR (only change this if you know what you're doing and decide to use another path than this guide used)
|
||
3 years ago
|
1. PUID/PGID (this info you got earlier from [HERE](#puid-and-pgid))
|
||
7 months ago
|
1. TZ (Change to your timezone, can be found [HERE](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones){:target="\_blank" rel="noopener noreferrer"})
|
||
3 years ago
|
1. Install and Create a task scheduler for Pullio, so your containers stay up to date.
|
||
3 years ago
|
|
||
3 years ago
|
!!! info ""
|
||
7 months ago
|
|
||
3 years ago
|
The `.env` holds more variables/information for other containers you don't need to remove those variables and will be only used when you install the other containers.
|
||
|
|
||
7 months ago
|
---
|
||
3 years ago
|
|
||
|
#### Pullio - Auto update docker-compose the correct way
|
||
4 years ago
|
|
||
8 months ago
|
Pullio allows you to automatically update your containers. And send you a notification through various means. We use a Discord Webhook.
|
||
3 years ago
|
|
||
6 months ago
|
First, you need to download Pullio
|
||
3 years ago
|
|
||
|
```bash
|
||
7 months ago
|
sudo curl -fsSL "https://raw.githubusercontent.com/hotio/pullio/master/pullio.sh" -o /usr/local/bin/pullio
|
||
3 years ago
|
```
|
||
3 years ago
|
|
||
3 years ago
|
```bash
|
||
7 months ago
|
sudo chmod +x /usr/local/bin/pullio
|
||
3 years ago
|
```
|
||
|
|
||
6 months ago
|
For Pullio to do its job, you will need to create a Scheduled Task in your Task Scheduler that runs for example at 4AM with **root** privileges.
|
||
3 years ago
|
|
||
6 months ago
|
`Control Panel` > `Task Scheduler` > click `Create` > choose `Scheduled task - user-defined script`
|
||
3 years ago
|
|
||
|
Give the task a name so you know what it does. Choose user `root`.
|
||
|
|
||
8 months ago
|
In the `Schedule` tab choose when and how often you want it to check for updates.
|
||
3 years ago
|
|
||
|
At `Task Settings` tab, add the following line in the Run Command section:
|
||
3 years ago
|
|
||
|
```bash
|
||
3 years ago
|
/usr/local/bin/pullio > /volume1/docker/appdata/pullio/pullio.log 2>&1
|
||
3 years ago
|
```
|
||
4 years ago
|
|
||
6 months ago
|
It can be frustrating to test the script if no docker image updates are available, therefore you can run the command `sudo pullio` --debug` and the script will behave as if an update is available. If you have set to receive notifications, you should receive them.
|
||
3 years ago
|
|
||
7 months ago
|
More info about Pullio [HERE](https://hotio.dev/scripts/pullio/){:target="\_blank" rel="noopener noreferrer"}
|
||
3 years ago
|
|
||
7 months ago
|
---
|
||
4 years ago
|
|
||
|
### Permissions
|
||
|
|
||
|
Now we need to make sure that the newly created files and folders have the correct permissions.
|
||
|
|
||
8 months ago
|
If you have an existing library, it is advised to move these to the new `data` share prior to running the commands below.
|
||
|
|
||
4 years ago
|
!!! note
|
||
7 months ago
|
|
||
6 months ago
|
If you're using a different user than `docker` (the user-generated in the beginning), then you need to change the `docker:users` part in the command below!!!
|
||
4 years ago
|
|
||
|
```bash
|
||
3 years ago
|
sudo chown -R docker:users /volume1/data /volume1/docker
|
||
3 years ago
|
```
|
||
3 years ago
|
|
||
3 years ago
|
```bash
|
||
4 years ago
|
sudo chmod -R a=,a+rX,u+w,g+w /volume1/data /volume1/docker
|
||
|
```
|
||
3 years ago
|
|
||
3 years ago
|
!!! note
|
||
7 months ago
|
|
||
6 months ago
|
If you move files from a different library into the newly created library afterward, you need to rerun these commands. !!!
|
||
3 years ago
|
|
||
7 months ago
|
---
|
||
4 years ago
|
|
||
4 years ago
|
## Run the Docker Compose
|
||
4 years ago
|
|
||
2 years ago
|
!!! tip
|
||
7 months ago
|
|
||
3 years ago
|
make sure you delete/remove all your existing dockers from the Docker GUI and also remove your native installs (in Package Center) of these applications !!!
|
||
6 months ago
|
If you had previously installed apps, make a backup of their config folders or backup through the WebUI of the app.
|
||
4 years ago
|
|
||
8 months ago
|
If you have followed all the steps and your compose file is ready, run the following commands:
|
||
4 years ago
|
|
||
|
```bash
|
||
|
cd /volume1/docker/appdata
|
||
3 years ago
|
```
|
||
3 years ago
|
|
||
3 years ago
|
```bash
|
||
4 years ago
|
sudo docker-compose up -d
|
||
|
```
|
||
|
|
||
6 months ago
|
You will notice that all the images will be downloaded, and after that, the containers will be started. If you get an error then read what the error says and try to fix it (missing folders, permissions errors, etc). If you can't figure out the solution to your errors, join the guides-discord [here](https://trash-guides.info/discord){:target="\_blank" rel="noopener noreferrer"} and create a support ticket.
|
||
4 years ago
|
|
||
7 months ago
|
---
|
||
4 years ago
|
|
||
2 months ago
|
**If you need help setting up the applications, look at the [Examples](/File-and-Folder-Structure/Examples/) of how to set up the paths inside your applications.**
|
||
4 years ago
|
|
||
2 years ago
|
!!! warning
|
||
4 years ago
|
|
||
6 months ago
|
If you need to make any changes, only edit the `docker-compose.yml` file. To activate the changes, [run the commands from here](#run-the-docker-compose) again.
|
||
4 years ago
|
|
||
3 years ago
|
Any changes you do/did in the GUI will be reverted when you run the docker-compose command.
|
||
4 years ago
|
|
||
3 years ago
|
Just don't use the GUI, only for information purposes !!!
|
||
4 years ago
|
|
||
2 months ago
|
{! include-markdown "../../../includes/file-and-folder-structure/docker-compose-commands.md" !}
|
||
3 years ago
|
|
||
6 months ago
|
--8<-- "includes/support.md"
|
||
1 year ago
|
|
||
7 months ago
|
---
|
||
1 year ago
|
|
||
|
## Additional Synology Info
|
||
|
|
||
|
### DSM Task for correctly reporting IP in Plex/Nginx/Etc
|
||
|
|
||
1 year ago
|
Due to some iptables configuration in DSM, you can get an incorrect IP reported in Plex or other apps that need an read/report the IP. To fix this, you need to add two rules to your iptables. unfortunately, those rules can sometimes be deleted at reboot or after DSM update.
|
||
1 year ago
|
|
||
6 months ago
|
To fix this, you will need to add a Scheduled Task that executes at boot as the root user which will check if the rules exist, and, if not - re-add them.
|
||
1 year ago
|
|
||
1 year ago
|
??? question "Task bash command - [Click to show/hide]"
|
||
1 year ago
|
|
||
1 year ago
|
```bash
|
||
2 months ago
|
--8<-- "includes/file-and-folder-structure/docker-iptables-fix.sh"
|
||
1 year ago
|
```
|
||
2 months ago
|
|
||
|
--8<-- "includes/support.md"
|