<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Synology on Tom Burkert</title><link>https://blog.burkert.me/tags/synology/</link><description>Recent content in Synology on Tom Burkert</description><image><title>Tom Burkert</title><url>https://blog.burkert.me/assets/</url><link>https://blog.burkert.me/assets/</link></image><generator>Hugo -- 0.148.0</generator><language>en-us</language><lastBuildDate>Tue, 18 Nov 2025 22:17:30 +0100</lastBuildDate><atom:link href="https://blog.burkert.me/tags/synology/index.xml" rel="self" type="application/rss+xml"/><item><title>My e-reader workflow for staying off my phone</title><link>https://blog.burkert.me/posts/e-reader-workflow/</link><pubDate>Tue, 18 Nov 2025 22:17:30 +0100</pubDate><guid>https://blog.burkert.me/posts/e-reader-workflow/</guid><description>&lt;p>The mission is simple: spend less time looking at my phone. I&amp;rsquo;ve made &lt;a href="https://blog.burkert.me/posts/maybe_i_dont_need_to_know_everything/" target="_blank" rel="noopener">several adjustments&lt;/a> to my information diet and to how I &lt;a href="https://blog.burkert.me/posts/in_praise_of_syndication/" target="_blank" rel="noopener">consume content online&lt;/a>, but many of these changes made me even more tethered to my phone. So I set out to read more on my e-reader instead of constantly staring at my phone.&lt;/p>
&lt;h2 id="put-the-phone-down">Put the phone down&lt;/h2>
&lt;p>First, a brief detour into my browsing and reading habits. I subscribe to a lot of feeds (check out my &lt;a href="https://blog.burkert.me/blogroll/" target="_blank" rel="noopener">blogroll&lt;/a>!) and going through my RSS reader gives me a similar dopamine hit to scrolling on social media - except I&amp;rsquo;m mostly learning something new rather than just being entertained. But it also means I spend a lot of time staring at my phone and reading articles on it, which is definitely not a good way to read anything, and it does not &lt;em>feel&lt;/em> great either. Besides, you&amp;rsquo;re one notification away from being pulled out of your reading.&lt;/p></description><content:encoded><![CDATA[<p>The mission is simple: spend less time looking at my phone. I&rsquo;ve made <a href="https://blog.burkert.me/posts/maybe_i_dont_need_to_know_everything/" target="_blank" rel="noopener">several adjustments</a> to my information diet and to how I <a href="https://blog.burkert.me/posts/in_praise_of_syndication/" target="_blank" rel="noopener">consume content online</a>, but many of these changes made me even more tethered to my phone. So I set out to read more on my e-reader instead of constantly staring at my phone.</p>
<h2 id="put-the-phone-down">Put the phone down</h2>
<p>First, a brief detour into my browsing and reading habits. I subscribe to a lot of feeds (check out my <a href="https://blog.burkert.me/blogroll/" target="_blank" rel="noopener">blogroll</a>!) and going through my RSS reader gives me a similar dopamine hit to scrolling on social media - except I&rsquo;m mostly learning something new rather than just being entertained. But it also means I spend a lot of time staring at my phone and reading articles on it, which is definitely not a good way to read anything, and it does not <em>feel</em> great either. Besides, you&rsquo;re one notification away from being pulled out of your reading.</p>
<p>The allure of the phone is strong: everything is at hand and frictionless. If I want to replace it with something else, it has to be similarly easy to use. This rules out using a computer, since I don&rsquo;t always have one with me and the startup time is considerable even on modern machines. I guess that leaves me with the only option: printing everything on paper and reading that way.</p>
<p>Okay, I&rsquo;m kidding, but the solution is a bit like paper: it&rsquo;s an e-ink reader. I currently have a <a href="https://pocketbook.ch/en-ch/catalog/e-readers/pocketbook-verse-pro-passion-red-ch" target="_blank" rel="noopener">Pocketbook Verse Pro</a> and I love reading on it. The goal would be to have an easy way of taking anything noteworthy (and usually long-form) and transferring it to my e-reader. Most importantly, this is not a Pocketbook-specific solution: in fact it will work on any reader with <a href="https://github.com/koreader/koreader/wiki" target="_blank" rel="noopener">KOReader</a> installed, meaning it could be your Kobo or Kindle too.</p>
<h2 id="it-sounds-like-a-lot-of-hassle">It sounds like a lot of hassle</h2>
<p>It does, but let me explain. Once everything is set up, this is actually a very smooth experience. Frictionless.</p>
<p>There are two major sources of friction:</p>
<ol>
<li>Getting the content into the e-reader</li>
<li>Removing the content from the e-reader once finished (keeping things tidy)</li>
</ol>
<p>Conveniently, both problems are solved by <a href="https://wallabag.org/" target="_blank" rel="noopener">Wallabag</a>, which will be familiar if you know Pocket or Instapaper. Wallabag is an open-source &ldquo;read it later&rdquo; app, and it is by design self-hosting-friendly, even though you can use it as an online service directly from <a href="https://wallabag.it/en/" target="_blank" rel="noopener">wallabag.it</a> too. It will serve as the home for all content worthy of proper reading and thus be the backbone of this setup. And because KOReader already integrates with Wallabag, receiving and archiving articles is quite seamless.</p>
<h2 id="the-one-tap-solution">The one-tap solution</h2>
<p>The end state looks like this: I am going through my RSS feeds on my phone, and if I see something long-form that I&rsquo;m interested in, I tap on the &ldquo;Star&rdquo; button and move on until I have enough articles to read. In a few minutes, I can pick up my e-reader, sync new articles and start reading said articles. During the next sync, the already finished articles will be removed from my device (unless I mark them as not finished).</p>
<p>The one remaining missing piece is a Python script that periodically fetches newly starred (&ldquo;favourited&rdquo; in FreshRSS speak) articles from FreshRSS and pushes them to Wallabag. Below you will find both instructions on how to set the whole pipeline up, and the code for the script.</p>
<p>The way the script works is by connecting to FreshRSS to fetch favourited articles, comparing it to a local list of already processed articles, and adding the new ones to your Wallabag instance to be picked up by KOReader. It&rsquo;s a really simple script that ties this all together. It will also keep producing rotating <code>sync.log</code> files to make any potential troubleshooting easier.</p>
<p>Below is a breakdown of what happens under the hood:<br>
<img alt="Diagram of FreshRSS to Wallabag to KOReader solution" loading="lazy" src="/images/freshrss-wallabag-sync.jpg#center"></p>
<h2 id="setting-up-the-pipeline">Setting up the pipeline</h2>
<h3 id="pre-requisites">Pre-requisites</h3>
<ul>
<li>A server or computer (with Python 3 installed) to run the script periodically.</li>
<li><a href="https://github.com/FreshRSS/FreshRSS" target="_blank" rel="noopener">FreshRSS</a> 1.27 or newer with <a href="https://freshrss.github.io/FreshRSS/en/developers/06_Fever_API.html" target="_blank" rel="noopener">Fever API enabled</a></li>
<li><a href="https://github.com/wallabag/wallabag" target="_blank" rel="noopener">Wallabag</a> 2.6.13 or newer</li>
<li><a href="https://github.com/koreader/koreader/wiki" target="_blank" rel="noopener">KOReader</a> on your e-reader</li>
</ul>
<h3 id="freshrss-setup">FreshRSS setup</h3>
<p>First, you have to <a href="https://freshrss.github.io/FreshRSS/en/users/06_Mobile_access.html" target="_blank" rel="noopener">enable API access</a> in your FreshRSS instance. Make note of your user&rsquo;s API password. You can verify if the Fever API is enabled by going to <a href="https://foo.bar/p/api/" target="_blank" rel="noopener">https://foo.bar/p/api/</a>, assuming <code>https://foo.bar/</code> is the root path to your FreshRSS instance.</p>
<h3 id="wallabag-setup">Wallabag setup</h3>
<p>Next, you have to set up API keys to access your Wallabag instance. Log in to Wallabag and go to <strong>API clients management</strong> section, where you need to <strong>create a new client</strong>. I personally created separate clients for my Python script as well as for my KOReader and Wallabagger extension (see below), but you could reuse the same client credentials if you prefer. Note down the Client ID and Client secret.</p>
<h3 id="sync-script-setup">Sync script setup</h3>
<p>The script for syncing articles between FreshRSS and Wallabag can be found in <a href="https://github.com/Wohma/freshrss-wallabag-sync-python" target="_blank" rel="noopener">this GitHub repo</a>. Download the .py file and the config.json.example to your server, put them in the same folder, rename the latter to config.json and update its values. You should also <code>chmod 0600</code> the config.json file or otherwise make sure that it&rsquo;s safe from prying eyes, since it will store your API credentials.</p>
<blockquote>
<p>Tom, you dummy, why not just use a .env file? Everyone knows that&rsquo;s where secrets go!</p></blockquote>
<p>Yes, and you&rsquo;d typically load it using python-dotenv — a module you&rsquo;d install via pip, which may not even be installed on your machine. Writing my own parser for dotenv files would unnecessarily inflate the length of this script and could lead to unforeseen bugs on different systems. The goal here was to make this as portable as possible, requiring nothing but a Python interpreter, which is almost universally available. This is simply the path of least resistance, and as long as you keep the permissions tight, it is as safe as a .env file.</p>
<p>Okay, now as long as you&rsquo;ve edited your config correctly, you can try running the script to see if you can connect to both APIs. You should see something like this:</p>
<pre tabindex="0"><code>[2025-11-25 23:30:02] INFO: Starting FreshRSS → Wallabag sync
[2025-11-25 23:30:02] INFO: Previously synced: 0 articles
[2025-11-25 23:30:02] INFO: Found 0 starred articles in FreshRSS
[2025-11-25 23:30:02] INFO: No new starred articles to sync. All up to date!
</code></pre><p>Now it&rsquo;s time to go to FreshRSS, mark an article as favourite, and re-run the script to see if it gets synced to Wallabag.</p>
<blockquote>
<p>Tom, I see you&rsquo;re storing the previously synced article IDs in a local json file. That&rsquo;s kind of dumb!</p></blockquote>
<p>It is! But also it&rsquo;s beautifully simple and functional. A setup using SQLite would surely be more scalable, but how many articles will you favourite per year? Dozens? Hundreds? This probably gives the script centuries before it starts becoming a problem. Let&rsquo;s not overengineer things.</p>
<p>Now that your script is up and running, don&rsquo;t forget to add it to your cron, or a similar solution to periodically run it. I&rsquo;m using Synology&rsquo;s Task Scheduler and have set the frequency to 15 minutes.</p>
<h3 id="koreader-setup">KOReader setup</h3>
<p>Now that articles are getting beamed up to Wallabag, it&rsquo;s time to set up your e-reader. KOReader supports Wallabag natively, and it&rsquo;s easy to set it up using the <a href="https://github.com/koreader/koreader/wiki/Wallabag" target="_blank" rel="noopener">official wiki</a>. I highly recommend saving the empty settings and editing the Lua file on your computer. Typing all the credentials on the e-reader keyboard is no fun.</p>
<p>Once you have Wallabag set up, syncing should download the articles:</p>
<p><img alt="e-reader screen with KOReader Wallabag sync status" loading="lazy" src="/images/e-reader-wallabag.jpg#center"></p>
<p>I also highly recommend going to Wallabag settings in KOReader, open the section <strong>Remote mark-as-read settings</strong> and enable the following options:</p>
<ul>
<li>Mark finished articles as read</li>
<li>Mark 100% read articles as read</li>
<li>Auto-upload article statuses when downloading</li>
</ul>
<p>This will automatically delete any read articles from your e-reader and mark them as read in Wallabag whenever you sync. You do not have to manually clean anything up - brilliant!</p>
<h2 id="bonus-wallabagger-setup">[Bonus] Wallabagger setup</h2>
<p>Now that we have a pipeline that feeds our e-reader, we might as well use it in other useful ways. <a href="https://github.com/wallabag/wallabagger" target="_blank" rel="noopener">Wallabagger</a> is a Chrome and Firefox extension that saves articles directly to your Wallabag instance. This gives you freedom to shoot any articles you got sent or found in newsletters etc. straight to your e-ink device.</p>
<p>When you install Wallabagger, you have to set it up to connect to your Wallabag instance (hit <strong>Check URL</strong>) and then provide Wallabag client credentials. You should also tick the option <strong>Retrieve content from the browser by default when saving page</strong>, otherwise Wallabagger will only save the link itself and some metadata.</p>
<h2 id="support-open-source">Support open-source!</h2>
<p>All of this is possible only thanks to open-source developers of the above applications. While you can subscribe to Wallabag&rsquo;s <a href="https://wallabag.it/en/#pricing" target="_blank" rel="noopener">hosted solution</a> and support them that way, I suspect many of my readers will dabble in self-hosting.</p>
<p>Below are links to the Liberapay accounts where you can support the applications:</p>
<ul>
<li><a href="https://liberapay.com/wallabag/" target="_blank" rel="noopener">Wallabag</a></li>
<li><a href="https://liberapay.com/KOReader/" target="_blank" rel="noopener">KOReader</a></li>
<li><a href="https://liberapay.com/FreshRSS/" target="_blank" rel="noopener">FreshRSS</a></li>
</ul>
]]></content:encoded></item><item><title>Setting Up Pi-Hole on Synology NAS DS218play</title><link>https://blog.burkert.me/posts/setting-up-pi-hole-on-synology-nas-ds218play/</link><pubDate>Tue, 11 Feb 2025 22:37:22 +0200</pubDate><guid>https://blog.burkert.me/posts/setting-up-pi-hole-on-synology-nas-ds218play/</guid><description>&lt;h2 id="intro">Intro&lt;/h2>
&lt;p>As part of my journey towards higher privacy while using internet, I decided to set up &lt;a href="https://pi-hole.net/" target="_blank" rel="noopener">Pi-hole&lt;/a> on my &lt;a href="https://www.synology.com/products/DS218play" target="_blank" rel="noopener">Synology NAS DS218play&lt;/a>. If you are reading this article, you probably don&amp;rsquo;t need the following explanation, but just in case: Pi-hole is perhaps the most popular DNS sinkhole, which aims to block ads, trackers and malicious sites for all devices on your local network.&lt;/p>
&lt;p>Now, your NAS is one of the best candidates for running Pi-hole since it is typically on 24/7 and connected via high-speed wired connection to your router. Since I already was an owner of Synology NAS, I started googling how to set up Pi-hole on my device. There are &lt;a href="https://www.synology.com/products/DS218play" target="_blank" rel="noopener">plenty&lt;/a> &lt;a href="https://mariushosting.com/how-to-install-pi-hole-on-your-synology-nas/" target="_blank" rel="noopener">of&lt;/a> &lt;a href="https://www.youtube.com/watch?v=bPs2M-GvRtQ" target="_blank" rel="noopener">howto&amp;rsquo;s&lt;/a> &lt;a href="https://github.com/markdumay/synology-pihole" target="_blank" rel="noopener">which&lt;/a> &lt;a href="https://erulezz.dev/synology/pi-hole-installation-on-synology-nas-with-docker/" target="_blank" rel="noopener">describe&lt;/a> &lt;a href="https://kevquirk.com/how-to-setup-pi-hole-on-a-synology-nas/" target="_blank" rel="noopener">the&lt;/a> &lt;a href="https://drfrankenstein.co.uk/pihole-in-docker-on-a-synology-nas/" target="_blank" rel="noopener">process&lt;/a>, but they have one fatal flaw: they rely on the &lt;em>Docker&lt;/em> (or &lt;em>Container Manager&lt;/em>, as it was later renamed to) Synology package to be installed and used for the setup. And this is where it starts to get interesting: Docker is not officially supported on ARM-based Synology NASes (such as the &lt;em>j&lt;/em> and &lt;em>play&lt;/em> models), supposedly &lt;a href="https://community.synology.com/enu/forum/17/post/90211" target="_blank" rel="noopener">due to insufficient performance of their CPUs&lt;/a>. This means you will not find the packages in the Package Manager and will not be able to install it the usual way.&lt;/p></description><content:encoded><![CDATA[<h2 id="intro">Intro</h2>
<p>As part of my journey towards higher privacy while using internet, I decided to set up <a href="https://pi-hole.net/" target="_blank" rel="noopener">Pi-hole</a> on my <a href="https://www.synology.com/products/DS218play" target="_blank" rel="noopener">Synology NAS DS218play</a>. If you are reading this article, you probably don&rsquo;t need the following explanation, but just in case: Pi-hole is perhaps the most popular DNS sinkhole, which aims to block ads, trackers and malicious sites for all devices on your local network.</p>
<p>Now, your NAS is one of the best candidates for running Pi-hole since it is typically on 24/7 and connected via high-speed wired connection to your router. Since I already was an owner of Synology NAS, I started googling how to set up Pi-hole on my device. There are <a href="https://www.synology.com/products/DS218play" target="_blank" rel="noopener">plenty</a> <a href="https://mariushosting.com/how-to-install-pi-hole-on-your-synology-nas/" target="_blank" rel="noopener">of</a> <a href="https://www.youtube.com/watch?v=bPs2M-GvRtQ" target="_blank" rel="noopener">howto&rsquo;s</a> <a href="https://github.com/markdumay/synology-pihole" target="_blank" rel="noopener">which</a> <a href="https://erulezz.dev/synology/pi-hole-installation-on-synology-nas-with-docker/" target="_blank" rel="noopener">describe</a> <a href="https://kevquirk.com/how-to-setup-pi-hole-on-a-synology-nas/" target="_blank" rel="noopener">the</a> <a href="https://drfrankenstein.co.uk/pihole-in-docker-on-a-synology-nas/" target="_blank" rel="noopener">process</a>, but they have one fatal flaw: they rely on the <em>Docker</em> (or <em>Container Manager</em>, as it was later renamed to) Synology package to be installed and used for the setup. And this is where it starts to get interesting: Docker is not officially supported on ARM-based Synology NASes (such as the <em>j</em> and <em>play</em> models), supposedly <a href="https://community.synology.com/enu/forum/17/post/90211" target="_blank" rel="noopener">due to insufficient performance of their CPUs</a>. This means you will not find the packages in the Package Manager and will not be able to install it the usual way.</p>
<p>There are many users asking how to install Docker (or even specifically <a href="https://www.reddit.com/r/pihole/comments/kw2xqv/pihole_on_synology_ds218play_no_docker/" target="_blank" rel="noopener">Pi-Hole</a>) on the DS218play and the answer is always the same - unsupported, not available, you&rsquo;re out of luck, you will need to upgrade to the <em>plus</em> model (which uses x86 CPUs) or get a Raspberry Pi.</p>
<p>That is not entirely true, though, and that&rsquo;s why you&rsquo;re likely here. The setup requires a little bit of technical skills and bravery, but it is not an overly complicated process. It does need to be said though that <strong>the Docker support is indeed unofficial, one could even say hacky, and you are doing this at your own risk</strong>. On the upside, the Realtek RTD1296 CPU in the DS218play is perfectly capable of running a simple app such as Pi-hole in Docker (the CPU barely registers usage from multiple local network devices), and can probably run even more complex apps, so the argument related to the CPU&rsquo;s performance is not entirely based on reality - it probably has more to do with Synology not wanting to maintain packages for multiple architectures, especially if moving to the + line is such a good upsell for them.</p>
<p>Also, while I can give you no guarantees on this, the how-to is likely to work on some other Synology models (such as DS220j, DS223j, DS118, DS218, DS418 - basically anything that has <em>aarch64</em> CPU model listed <a href="https://nascompares.com/2020/03/02/plex-synology-nas-performance-list-2020-edition/" target="_blank" rel="noopener">here</a>). Furthermore, based on my cursory Google research, changing the architecture in below scripts from <code>aarch64</code> to <code>armhf</code> might allow you to use it for the ARMv7 models (such as DS218j, DS216j or DS416) as well.</p>
<h2 id="prerequisites">Prerequisites</h2>
<p>OK, now that you have been warned and given necessary context, let&rsquo;s see what we will need:</p>
<ul>
<li>Access to the Synology NAS using a privileged user (can be your regular user but should be in the administrators group - i.e. the main account you use to manage the NAS using DSM</li>
<li>DSM version 7.2.x (tested on 7.2.1, likely works on all 7.x.x)</li>
<li>Enabled SSH access (see below)</li>
<li>Internet access (duh)</li>
<li>An SSH client (<a href="https://www.chiark.greenend.org.uk/~sgtatham/putty/" target="_blank" rel="noopener">PuTTY</a> is a great one if you&rsquo;re on Windows, but you can also <a href="https://www.howtogeek.com/336775/how-to-enable-and-use-windows-10s-built-in-ssh-commands/" target="_blank" rel="noopener">install an ssh client from Windows;</a> Linux and Mac usually comes with a command-line SSH client)</li>
</ul>
<h3 id="enabling-ssh-access-to-your-nas">Enabling SSH access to your NAS</h3>
<p>Your Synology NAS may not have a remote terminal access enabled. This is how you enable it:</p>
<ol>
<li>Open <strong>Control Panel</strong>.</li>
<li>Go to <strong>Terminal &amp; SNMP</strong>.</li>
<li>Check the <strong>Enable SSH service</strong> checkbox.</li>
<li>Done!</li>
</ol>
<p>In case the port is set to anything else than the usual port 22, you should make a mental note of that number.</p>
<h2 id="step-by-step-instructions">Step-by-step instructions</h2>
<h3 id="connecting-and-gaining-root-access">Connecting and gaining root access</h3>
<ol>
<li>Use your SSH client to connect to the NAS. You will need to specify the NAS&rsquo;s IP Address - if you do not know it, you can find it out in <strong>Control Panel</strong> → <strong>Network</strong> → <strong>Network Interface</strong>. Mine is 192.168.0.101 and let&rsquo;s say the main user account is &ldquo;tom&rdquo;.</li>
</ol>
<p><code>ssh tom@192.168.0.101 </code><br>
If you are using a different port than 22, add the <code>-p</code> parameter, e.g.:<br>
<code>ssh tom@192.168.0.101 -p 22345</code> <br>
2. You might be prompted to accept the host&rsquo;s key the first time you connect. Accept it.<br>
3. Now enter the password for tom&rsquo;s account - this is the same as you use to log in into DSM using your browser.<br>
4. Now you should be remotely connected to your NAS, but we need to get the system administrator (<code>root</code>) privileges. On DSM, simply type <code>sudo -i</code>  and use the same password as in step 3.<br>
5.  Now the command line should say something like <code>root@nas</code> (or whatever hostname you chose after the @ sign).</p>
<h3 id="docker-installation">Docker installation</h3>
<ol>
<li>Navigate to you main user&rsquo;s home directory.<br>
<code>cd /volume1/homes/tom/</code><br>
Note that you will need to adjust the username and potentially the volume number based on your system&rsquo;s settings.</li>
<li>Grab the file below and save it to your desktop computer. Let&rsquo;s call the file <code>get-docker.sh</code></li>
</ol>
<pre tabindex="0"><code>#!/bin/bash
set -e

ARCH=aarch64
DOCKER_VERSION=20.10.9
COMPOSE_VERSION=2.5.1
DOCKER_DIR=/volume1/@docker

echo &#34;Downloading docker $DOCKER_VERSION-$ARCH&#34;
curl &#34;https://download.docker.com/linux/static/stable/$ARCH/docker-$DOCKER_VERSION.tgz&#34; | tar -xz -C /usr/local/bin --strip-components=1

echo &#34;Creating docker working directory $DOCKER_DIR&#34;
mkdir -p &#34;$DOCKER_DIR&#34;

echo &#34;Creating docker.json config file&#34;
mkdir -p /usr/local/etc/docker
cat &lt;&lt;EOT &gt; /usr/local/etc/docker/docker.json
{
  &#34;storage-driver&#34;: &#34;vfs&#34;,
  &#34;iptables&#34;: false,
  &#34;bridge&#34;: &#34;none&#34;,
  &#34;data-root&#34;: &#34;$DOCKER_DIR&#34;
}
EOT

echo &#34;Creating docker startup script&#34;
cat &lt;&lt;&#39;EOT&#39; &gt; /usr/local/etc/rc.d/docker.sh
#!/bin/sh
# Start docker daemon

NAME=dockerd
PIDFILE=/var/run/$NAME.pid
DAEMON_ARGS=&#34;--config-file=/usr/local/etc/docker/docker.json --pidfile=$PIDFILE&#34;

case &#34;$1&#34; in
    start)
        echo &#34;Starting docker daemon&#34;
        # ulimit -n 4096  # needed for influxdb (uncomment if your limit is lower)
        /usr/local/bin/dockerd $DAEMON_ARGS &amp;
        ;;
    stop)
        echo &#34;Stopping docker daemon&#34;
        kill $(cat $PIDFILE)
        ;;
    *)
        echo &#34;Usage: &#34;$1&#34; {start|stop}&#34;
        exit 1
esac
exit 0
EOT

chmod 755 /usr/local/etc/rc.d/docker.sh

echo &#34;Creating docker group&#34;
egrep -q docker /etc/group || synogroup --add docker root

echo &#34;Installing docker compose $COMPOSE_VERSION&#34;
curl -SL &#34;https://github.com/docker/compose/releases/download/v$COMPOSE_VERSION/docker-compose-linux-$ARCH&#34; \
     --create-dirs -o /usr/local/lib/docker/cli-plugins/docker-compose
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
chgrp -R docker /usr/local/lib/docker

echo &#34;Starting docker&#34;
/usr/local/etc/rc.d/docker.sh start

echo &#34;Done.  Please add your user to the docker group in the Synology GUI and reboot your NAS.&#34;
</code></pre><p><a href="https://gist.github.com/DaveMDS/c35d77e51e0186a4fe2e577f51a5b09a" target="_blank" rel="noopener">Credits to DaveMDS</a> <br>
_Note: The versions of Docker and Docker Compose might be outdated when you read this. If you want to use the the latest versions, check them <a href="https://download.docker.com/linux/static/stable/aarch64/" target="_blank" rel="noopener">here</a> and <a href="https://github.com/docker/compose/releases" target="_blank" rel="noopener">here</a>.  _</p>
<ol>
<li>Upload the <code>get-docker.sh</code> file to your home folder in DSM: Open <strong>File Station</strong>, navigate to your home, click on <strong>Upload</strong> and the <strong>Upload - Overwrite</strong>.</li>
<li>Now back to SSH terminal - make the script executable:<br>
<code>chmod +x ./get-docker.sh</code></li>
<li>Run the installation script:<br>
<code>./get-docker.sh</code></li>
<li>Docker should now be installed! Let&rsquo;s follow the instruction to add our user to the docker group: go to <strong>Control Panel</strong> → <strong>User &amp; Group</strong> → <strong>Group</strong> → select <code>docker</code> → <strong>Edit</strong> → <strong>Members</strong> → select the checkbox next to <code>tom</code> (your main user) → <strong>Save</strong>.</li>
<li>Reboot your NAS!</li>
</ol>
<h3 id="installing-pi-hole">Installing Pi-Hole</h3>
<ol>
<li>While your NAS rebooted, your SSH session got disconnected, so you will need to repeat steps from the above section <strong>Connecting and gaining root access</strong>.</li>
<li>Using the same process as with the <code>get-docker.sh</code> file, upload the below script and name it <code>install-pihole.sh</code>. Do not forget to change the value of the PIHOLE_PWD variable.</li>
</ol>
<pre tabindex="0"><code>#!/bin/bash

IP_ADDRESS=$(ifconfig eth0 | awk &#39;/inet addr/ {gsub(&#34;addr:&#34;, &#34;&#34;, $2); print $2}&#39;)
TZ=$(realpath --relative-to /usr/share/zoneinfo /etc/localtime)
PORT=8080
PIHOLE_PWD=&#34;piholepwd&#34;

PIHOLE_BASE=&#34;${PIHOLE_BASE:-$(pwd)}&#34;
[[ -d &#34;$PIHOLE_BASE&#34; ]] || mkdir -p &#34;$PIHOLE_BASE&#34; || { echo &#34;Couldn&#39;t create storage directory: $PIHOLE_BASE&#34;; exit 1; }

echo -e &#34;Setting up pihole container at ${IP_ADDRESS}:${PORT} (timezone ${TZ})&#34;

docker run -d --name=pihole \
-e WEB_PORT=$PORT \
-e WEBPASSWORD=$PIHOLE_PWD \
-e WEB_BIND_ADDR=$IP_ADDRESS \
-e TZ=$TZ \
-e DNSMASQ_USER=root \
-e DNSMASQ_LISTENING=local \
-v /volume1/docker/pihole/dnsmasq.d:/etc/dnsmasq.d \
-v /volume1/docker/pihole/pihole:/etc/pihole \
--net=host \
--restart always \
pihole/pihole

printf &#39;Starting up pihole container &#39;
for i in $(seq 1 20); do
    if [ &#34;$(docker inspect -f &#34;{{.State.Health.Status}}&#34; pihole)&#34; == &#34;healthy&#34; ] ; then
        printf &#39; OK&#39;
        echo -e &#34;\nPi-hole running at http://${IP_ADDRESS}:${PORT}/admin/ - use password &#39;${PIHOLE_PWD}&#39; to log in.&#34;
        exit 0
    else
        sleep 3
        printf &#39;.&#39;
    fi

    if [ $i -eq 20 ] ; then
        echo -e &#34;\nTimed out waiting for Pi-hole start, consult your container logs for more info (\`docker logs pihole\`)&#34;
        exit 1
    fi
done;
</code></pre><p>The script was adapted from the <a href="https://github.com/pi-hole/docker-pi-hole/blob/master/examples/docker_run.sh" target="_blank" rel="noopener">official pi-hole example</a>.</p>
<ol>
<li>Run the Pi-hole installation script (assuming you&rsquo;re in the main user home directory again):<br>
<code>./install-pihole.sh</code></li>
<li>Downloading and setting up the pihole container may take some time. Once it is done, you should see a message like this:<br>
<code>Pi-hole running at http://192.168.0.101:8080/admin/ - use password 'piholepwd' to log in.</code></li>
<li>If everything went well, navigating to <code>http://192.168.0.101:8080/admin</code> should lead you to the Pi-Hole login screen. Success!</li>
<li>Do not forget to configure your NAS&rsquo;s IP address as the DNS server for your network - this would typically be done in the router settings, for example <a href="https://docs.pi-hole.net/routers/asus/" target="_blank" rel="noopener">like so</a>.</li>
</ol>
<h2 id="additional-considerations">Additional considerations</h2>
<ul>
<li>Since Pi-hole is now the sole resource for DNS resolution, it becomes a critical part of your network infrastructure. If the NAS or Pi-Hole itself stops working or gets disconnected, none of the clients on your network will be able to connect to the internet. This can be easily fixed by rebooting/reconnecting your NAS or simply reverting the router DNS settings to default or, for example, to Cloudflare&rsquo;s 1.1.1.1 DNS server, but you can only do that if you are physically at home (or have other means of connecting to your router).
<ul>
<li>To prevent my loved ones from undergoing the terrible torture of not having access to the internet when I&rsquo;m not at home (and also for general peace of mind), I decided to build redundancy into my Pi-Hole setup: I bought a super-cheap used Raspberry Pi 2 and added it as another Pi-Hole to my home network. I actually use the RPi2 as my primary DNS server and the NAS one as the secondary one (most routers will allow you to specify two DNS servers for your WAN), and have not had any issues with this setup so far. Knock on the wood.</li>
<li><strong>Tip:</strong> Use the <a href="https://engineerworkshop.com/blog/avoid-disaster-how-to-securely-backup-your-pihole-configuration-and-keep-your-network-running-smoothly/" target="_blank" rel="noopener">Teleporter</a> feature to easily sync settings between the two Pi-Holes.</li>
</ul>
</li>
<li>The setup above persists even through NAS reboots (docker will start automatically, and so will Pi-Hole), and it also survives DSM patches (7.2.x), but I have yet to test whether it survives minor updates (7.x.x). I will update this article with my findings once I have an opportunity to test it.
<ul>
<li>My hunch is that minor updates will be fine, but I am fairly certain that a major update (to DSM8) will likely need a docker reinstall. However, since the scripts are stored in my home folder, SSHing to the NAS and running them again will be minimal effort, should any of the DSM updates disrupt the setup.</li>
</ul>
</li>
</ul>
<h2 id="support-pi-hole">Support Pi-Hole!</h2>
<p>Pi-Hole is a wonderful project that objectively improves the digital life of many people. If it is the case for you, consider <a href="https://pi-hole.net/donate/#donate" target="_blank" rel="noopener">supporting the creators</a> - surely your privacy on the internet is worth a donation of few bucks.</p>
]]></content:encoded></item></channel></rss>