<inputclass="md-option"data-md-color-media="(prefers-color-scheme: dark)"data-md-color-scheme="slate"data-md-color-primary="indigio"data-md-color-accent="blue"aria-label="Switch to light mode"type="radio"name="__palette"id="__palette_1">
<labelclass="md-header__button md-icon"title="Switch to light mode"for="__palette_2"hidden>
<inputclass="md-option"data-md-color-media="(prefers-color-scheme: light)"data-md-color-scheme="default"data-md-color-primary="indigo"data-md-color-accent="blue"aria-label="Switch to dark mode"type="radio"name="__palette"id="__palette_2">
<labelclass="md-header__button md-icon"title="Switch to dark mode"for="__palette_1"hidden>
<ahref="https://github.com/TRaSH-/Guides/edit/master/docs/Hardlinks/How-to-setup-for/Synology.md"title="Edit this page"class="md-content__button md-icon">
<p>Being I don't have a Synology myself and I kind of hate the Synology GUI for the dockers, I'm doing this with the use of docker-compose through a terminal.</p>
<p>This is faster then the GUI and after installing, it shows up in the Docker GUI.</p>
<p>Thanks to faxity for the initial compose that I used to create the Synology Guide.</p>
<p>And a very big thanks to <ahref="https://www.buymeacoffee.com/bokkoman"rel="noopener noreferrer"target="_blank">Bokkoman</a> and <ahref="https://github.com/BaukeZwart"rel="noopener noreferrer"target="_blank">BZwart</a> that updated this Guide for DSM 7 and also offered their help on discord as Synology Support Team.</p>
<p>This page will provide you with guidance on how to install several Docker images to your Synology system. We highly recommend to read the full guide, that way you have a better understanding of what you do, in case you later decide to make changes.</p>
<summary>Automated script (<strong><imgalt="‼"class="twemoji"src="https://twemoji.maxcdn.com/v/latest/svg/203c.svg"title=":bangbang:"/>Use this script at your own risk<imgalt="‼"class="twemoji"src="https://twemoji.maxcdn.com/v/latest/svg/203c.svg"title=":bangbang:"/></strong>) - [CLICK TO EXPAND]</summary>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>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.</p>
<p>The script is new and only tested on Synology DSM7.</p>
<p><strong><imgalt="‼"class="twemoji"src="https://twemoji.maxcdn.com/v/latest/svg/203c.svg"title=":bangbang:"/> We are not held reliable if anything breaks on your system. Use at your own risk <imgalt="‼"class="twemoji"src="https://twemoji.maxcdn.com/v/latest/svg/203c.svg"title=":bangbang:"/></strong></p>
</div>
<p>To get this working you will need to enable terminal access (SSH).</p>
<p>To enable this on your Synology take a look <ahref="#ssh"rel="noopener noreferrer"target="_blank">HERE</a>.</p>
<p>When you enabled the terminal access (SSH) run the following commands and follow the onscreen questions.</p>
<p>You need to install Docker from the <code>Package Center</code>. This should also create a share named <code>docker</code>, check File Station if it is present.</p>
<h2id="create-the-main-share">Create the main share<aclass="headerlink"href="#create-the-main-share"title="Permanent link">¶</a></h2>
<divclass="admonition attention">
<pclass="admonition-title">Attention</p>
<p>To get Hardlinks and Atomic-Moves working with your Synology you will need to make use of <strong>ONE</strong> share with subfolders.</p>
</div>
<p>We will use a new share named <code>data</code> (lowercase) for all your library media.</p>
<p>Later in this guide, we will fill this share with subfolders.</p>
<p>In this screen you will be able to select which Shares this user will have access to, click <code>No Access</code> on the top, this will deny all access.</p>
<p>Now only select <code>Read/Write</code> on the shares <code>docker</code> and <code>data</code>.</p>
<p>Then use a program like <ahref="https://www.putty.org/"rel="noopener noreferrer"target="_blank">Putty</a> to SSH into your Synology.</p>
<p>Enter the login information of a Synology user account that has admin priveliges, as only members of the 'administrators' user group are able to use SSH.</p>
<p>If you get a popup asking if you want to trust the key,
Just press <code>OK</code> or <code>ACCEPT</code></p>
<h3id="puid-and-pgid">PUID and PGID<aclass="headerlink"href="#puid-and-pgid"title="Permanent link">¶</a></h3>
<p>In order for the Docker container to access the shares on the Synology, we need to know the user ID (PUID) and group ID (PGID) from the <code>docker</code> user we just created.</p>
<p>Go into your terminal app, login to your synology ssh.</p>
<p>Once logged in type <code>id $user</code>. Change $user to the newly created username <code>docker</code>.</p>
<p>For this example we're going to make use of the share called <code>data</code>.</p>
<p>On the host (Synology) terminal you will need to add <code>/volume1/</code> before it. So <code>/volume1/data</code></p>
<p>The <code>data</code> folder has sub-folders for <code>torrents</code> and <code>usenet</code> and each of these have sub-folders for <code>tv</code>, <code>movie</code> and <code>music</code> downloads to keep things neat. The <code>library</code> folder has nicely named <code>tv</code>, <code>movies</code> and <code>music</code> sub-folders, this is your library and what you’d pass to Plex, Emby or JellyFin.</p>
<p>These subfolders you need to create your self.</p>
<p><em>I'm using lower case on all folder on purpose, being Linux is case sensitive.</em></p>
<h3id="breakdown-of-the-folder-structure">Breakdown of the Folder Structure<aclass="headerlink"href="#breakdown-of-the-folder-structure"title="Permanent link">¶</a></h3>
<p>The reason why we use <code>/data/torrents</code> for the torrent client is because it only needs access to the torrent files. In the torrent software settings, you’ll need to reconfigure paths and you can sort into sub-folders like <code>/data/torrents/{tv|movies|music}</code>.</p>
<p>The reason why we use <code>/data/usenet</code> for the usenet client is because it only needs access to the usenet files. In the usenet software settings, you’ll need to reconfigure paths and you can sort into sub-folders like <code>/data/usenet/{tv|movies|music}</code>.</p>
<p>Sonarr, Radarr and Lidarr gets access to everything because the download folder(s) and media folder will look like and be one file system. Hard links will work and moves will be atomic, instead of copy + delete.</p>
<p>Plex, Emby, JellyFin and Bazarr only needs access to your media library, which can have any number of sub folders like Movies, Kids Movies, TV, Documentary TV and/or Music as sub folders.</p>
<p><strong>Don't forget to look at the <ahref="/Hardlinks/Examples/">Examples</a> how to setup the paths inside the applications.</strong></p>
<hr/>
<h3id="create-the-needed-subfolder">Create the needed subfolder<aclass="headerlink"href="#create-the-needed-subfolder"title="Permanent link">¶</a></h3>
<p>Here we will create the needed subfolders for your media library and also for your preferred download client.
If you use both then run both commands</p>
<h4id="if-you-use-usenet">If you use usenet<aclass="headerlink"href="#if-you-use-usenet"title="Permanent link">¶</a></h4>
<p>Now we are ready to move to the installation of containers.</p>
<p>For this, we need two files:</p>
<ol>
<li><code>docker-compose.yml</code></li>
<li><code>.env</code></li>
</ol>
<p>We will start with downloading the <code>docker-compose.yml</code> file</p>
<p>Download this <ahref="https://raw.githubusercontent.com/TRaSH-/Guides-Synology-Templates/main/docker-compose/docker-compose.yml"rel="noopener noreferrer"target="_blank">docker-compose.yml</a> to your <code>/volume1/docker/appdata</code> location so you got your important stuff together. Or use the command below:</p>
<h3id="whats-included-and-whats-not-included">Whats included and Whats not included<aclass="headerlink"href="#whats-included-and-whats-not-included"title="Permanent link">¶</a></h3>
<detailsclass="question">
<summary>What's included and What's not included - [CLICK TO EXPAND]</summary>
<p>This docker-compose file will have the following docker containers included.</p>
<ul>
<li>Radarr</li>
<li>Sonarr</li>
<li>Bazarr (Subtitle searcher and downloader)</li>
<li>Plex</li>
</ul>
<p>What's not included (and where are the download clients?).</p>
<p>I didn't add a download client to it, because it depends on what you prefer (usenet/torrent) and which client you prefer, so I created a new <ahref="https://github.com/TRaSH-/Guides-Synology-Templates/tree/main/templates"rel="noopener noreferrer"target="_blank">Repository</a> on Github where I provide and maintain some templates that are ready to use with the main <code>docker-compose.yml</code>.</p>
<p>The only thing you need to do is copy/paste what's inside the <code>.yml</code> file in to the main <code>docker-compose.yml</code>, the template also has the command what you need to use to create the <ahref="#appdata">appdata</a> folder that we explained earlier.</p>
</details>
<p>Second we will download the <code>.env</code> file</p>
<p>Download this <ahref="https://raw.githubusercontent.com/TRaSH-/Guides-Synology-Templates/main/docker-compose/.env"rel="noopener noreferrer"target="_blank">.env</a> to your <code>/volume1/docker/appdata</code> location so you got your important stuff together. Or use this command:</p>
<p><imgalt="‼"class="twemoji"src="https://twemoji.maxcdn.com/v/latest/svg/203c.svg"title=":bangbang:"/> MAKE SURE THE FILE KEEPS THE ORIGINAL NAME <code>.env</code> WITH THE DOT BEFORE IT <imgalt="‼"class="twemoji"src="https://twemoji.maxcdn.com/v/latest/svg/203c.svg"title=":bangbang:"/></p>
</div>
<hr/>
<h3id="changes-and-preparations">Changes and preparations<aclass="headerlink"href="#changes-and-preparations"title="Permanent link">¶</a></h3>
<p>If you need to edit docker-compose.yml or the .env file we advise to use <ahref="https://notepad-plus-plus.org/"rel="noopener noreferrer"target="_blank">Notepad++</a> or <ahref="https://code.visualstudio.com/"rel="noopener noreferrer"target="_blank">Visual Studio Code</a></p>
<p>The <code>.env</code> file we downloaded holds the variables/information you need to change in order for everything to work. I added explanations in the <code>.env</code> file.</p>
<ol>
<li>DOCKERCONFDIR (only change this if you know what you're doing and decide to use another path than this guide used)</li>
<li>DOCKERDATADIR (only change this if you know what you're doing and decide to use another path than this guide used)</li>
<li>PUID/PGID (this info you got earlier from <ahref="#puid-and-pgid">HERE</a></li>
<li>TZ (Change to your timezone, can be found <ahref="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"rel="noopener noreferrer"target="_blank">HERE</a></li>
<li>Install and Create a task scheduler for Pullio, so your containers stay up to date.</li>
</ol>
<divclass="admonition info">
<p>The <code>.env</code> 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.</p>
</div>
<hr/>
<h4id="pullio-auto-update-docker-compose-the-correct-way">Pullio - Auto update docker-compose the correct way<aclass="headerlink"href="#pullio-auto-update-docker-compose-the-correct-way"title="Permanent link">¶</a></h4>
<p>Pullio allows you to automatically update your containers. And send you a notification through various means. In my setup, I use a Discord Webhook.</p>
<p>For Pullio to work, you will need to create in your Task Scheduler a "Scheduled Task" that runs for example at 4am at night with root privileges.</p>
<p><code>Control Panel</code>><code>Task Scheduler</code>> click <code>Create</code>> choose <code>Scheduled task - user defined script</code></p>
<p>Give the task a name so you know what it does. Choose user <code>root</code>.</p>
<p>In the <code>Schedule</code> tab choose whenever you want it to check for updates.</p>
<p>At <code>Task Settings</code> tab, add the following line in the Run Command section:</p>
<p>It can be frustrating to test the script if no docker image updates are available, for that you can run command <code>sudo pullio --debug</code> and the script will behave as if an update is available. If you have set to receive notifications, you should receive them.</p>
<p>More info about Pullio <ahref="https://hotio.dev/pullio/"rel="noopener noreferrer"target="_blank">HERE</a></p>
<p>Now we need to make sure that the newly created files and folders have the correct permissions.</p>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>If you're using a different user than <code>docker</code> (the user generated in the beginning), then you need to change the <code>docker:users</code> part in the commands below!!!</p>
<p>If you copy files from a different library into the newly created library, you need to rerun these commands. !!!</p>
</div>
<hr/>
<h2id="run-the-docker-compose">Run the Docker Compose<aclass="headerlink"href="#run-the-docker-compose"title="Permanent link">¶</a></h2>
<divclass="admonition important">
<pclass="admonition-title">Important</p>
<p>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 !!!
If you had previous installed apps, make a backup of their config folders.</p>
</div>
<p>When you did all the above steps you only need to run the following commands:</p>
<divclass="highlight"><pre><span></span><code>sudo docker-compose up -d
</code></pre></div>
<p>You will notice that all the images will be downloaded, after that the containers will be started. If you get a error then look at the error what it says and try to fix it. If you still got issues then put your used docker-compose.yml on <ahref="https://0bin.net/"rel="noopener noreferrer"target="_blank">0bin</a> and join the guides-discord <ahref="https://trash-guides.info/discord"rel="noopener noreferrer"target="_blank">here</a> and provide the pastebin link with the error, have patience because of timezone differences.</p>
<hr/>
<p><strong>Don't forget to look at the <ahref="/Hardlinks/Examples/">Examples</a> how to setup the paths inside your applications.</strong></p>
<divclass="admonition attention">
<pclass="admonition-title">Attention</p>
<p>If you need to do any changes, only edit the <code>docker-compose.yml</code> file. To activate the changes, run the command <code>sudo docker-compose -f /volume1/docker/appdata/docker-compose.yml up -d</code> again.</p>
<p>Any changes you do/did in the GUI will be reverted when you run the docker-compose command.</p>
<p>Just don't use the GUI, only for information purposes !!!</p>
<summary>docker-compose commands - [CLICK TO EXPAND]</summary>
<ul>
<li><code>sudo docker-compose up -d</code> (This Docker-compose command helps builds the image, then creates and starts Docker containers. The containers are from the services specified in the compose file. If the containers are already running and you run docker-compose up, it recreates the container.)</li>
<li><code>sudo docker-compose pull</code> (Pulls an image associated with a service defined in a docker-compose.yml)</li>
<li><code>sudo docker-compose down</code> (The Docker-compose down command also stops Docker containers like the stop command does. But it goes the extra mile. Docker-compose down, doesn’t just stop the containers, it also removes them.)</li>
<li><code>sudo docker system prune -a --volumes --force</code> (Remove all unused containers, networks, images (both dangling and unreferenced), and optionally, volumes.)</li>
</ul>
</details>
<hr/>
<divclass="admonition help">
<pclass="admonition-title">Questions or Suggestions?</p>
<p>If you have questions or suggestions click the chat badge to join the Discord Support Channel where you can ask your questions directly and get live support.</p>
<scriptid="__config"type="application/json">{"base":"../../..","features":["navigation.instant","navigation.tabs","navigation.top"],"translations":{"clipboard.copy":"Copy to clipboard","clipboard.copied":"Copied to clipboard","search.config.lang":"en","search.config.pipeline":"trimmer, stopWordFilter","search.config.separator":"[\\s\\-]+","search.placeholder":"Search","search.result.placeholder":"Type to start searching","search.result.none":"No matching documents","search.result.one":"1 matching document","search.result.other":"# matching documents","search.result.more.one":"1 more on this page","search.result.more.other":"# more on this page","search.result.term.missing":"Missing","select.version.title":"Select version"},"search":"../../../assets/javascripts/workers/search.22074ed6.min.js"}</script>