<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator><link href="https://ryan.malesevich.me/feed.xml" rel="self" type="application/atom+xml" /><link href="https://ryan.malesevich.me/" rel="alternate" type="text/html" /><updated>2026-07-18T06:56:56-05:00</updated><id>https://ryan.malesevich.me/feed.xml</id><entry><title type="html">Configure Tailscale and Caddy for your Homelab on TrueNAS</title><link href="https://ryan.malesevich.me/blog/2026/07/18/tailscale-caddy-homelab-truenas.html" rel="alternate" type="text/html" title="Configure Tailscale and Caddy for your Homelab on TrueNAS" /><published>2026-07-18T06:50:00-05:00</published><updated>2026-07-18T06:50:00-05:00</updated><id>https://ryan.malesevich.me/blog/2026/07/18/tailscale-caddy-homelab-truenas</id><content type="html" xml:base="https://ryan.malesevich.me/blog/2026/07/18/tailscale-caddy-homelab-truenas.html"><![CDATA[<p>This post assumes that you have:</p>

<ul>
  <li>Homelab running <a href="https://www.truenas.com">TrueNAS</a></li>
  <li>Installed <a href="https://apps.truenas.com/catalog/tailscale_community/">Tailscale through the TrueNAS App Catalog</a> and have connected it to your Tailscale network</li>
  <li>Installed Caddy through a Custom App and have a Caddyfile that you can update</li>
</ul>

<p>Tailscale has been installed on my Homelab since day one. It was only used when connecting from my primary computer through SMB when I was not physically connected to my network. Caddy has always been used as my reverse proxy, but everything was routed through a custom domain name. I put on precautions, but the fact of the matter is that I made my services accessible to the public internet and I am not an expert. With the news of recent foundational models becoming better at finding software vulnerabilities<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>, I’ve grown more uncomfortable. Finally, I decided to utilize the protections of my Tailnet and move access to the applications on my Homelab through Tailscale.</p>

<p>Setting this up isn’t too complicated. It requires configuring a few settings on the Tailscale Admin Console, configuring Tailscale on your TrueNAS to generate SSL certificates, and then configuring Caddy to act as a reverse proxy through the Tailnet.</p>

<h2 id="configure-the-tailscale-admin-console">Configure the Tailscale Admin Console</h2>

<p>Access the DNS on the <a href="https://login.tailscale.com/admin/dns">Tailscale Admin Console</a> and do the following:</p>

<ul>
  <li>Make note of your Tailnet DNS name (tailXXXXX.ts.net)</li>
  <li>Enable MagicDNS</li>
  <li>Enable HTTPS</li>
</ul>

<h2 id="configure-tailscale-on-your-truenas">Configure Tailscale on your TrueNAS</h2>

<p>With MagicDNS enabled, you will be able to access each of your machines through its SERVERNAME as a subdomain of your DNS. Make note of the address for future steps. It will look like SERVERNAME.tailXXXXX.ts.net.</p>

<p>Under normal operation Caddy will handle the SSL certifications if you’re using your own domain. However, with Tailscale we will need to configure the Tailscale application to handle the certificate creation and re-issues and then within Caddy we’ll point to the certificate files. I chose to create a folder that is mounted to both my Tailscale and Caddy applications. It doesn’t really matter where you physically store it on your TrueNAS, but it made more sense for me to create a certs directory in my Caddy Application Data mount.</p>

<p>Create the folder first.</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir</span> /mnt/SSDPool/Application_Data/Caddy/certs
</code></pre></div></div>

<p>Update the Tailscale application by adding a Host Path volume that mounts to the /certs folder and is pointed to the folder created in the previous step.</p>

<p>You’ll create the certification files first manually. Once it’s working, we’ll set it up to run as a daily cron job because Tailscale will not handle the expiration automatically. Open the Shell linked to the Tailscale container and run this command:</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd </span>certs
tailscale cert SERVERNAME.tailXXXX.ts.net
</code></pre></div></div>

<p>If you see that it generated a Public cert and Private key, then it was successful. This certification will last 90 days.</p>

<p>Configure a Cron Job through the TrueNAS UI through System &gt; Advanced Settings. Add a Cron Job. Give it a Description that you’ll remember, set a time, and set the ‘Run As User’ to root. The TrueNAS Apps are actually run through Docker, but they are given unique names handled by TrueNAS. Regular users are also not allowed to run docker commands, so this is why you need to use root or manually run the commands with sudo. Note the nested docker command as it first looks for the Tailscale Docker name to identify the right container. Replace the SERVERNAME and Tailnet address:</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker <span class="nb">exec</span> <span class="si">$(</span>docker ps <span class="nt">--format</span> <span class="s1">'{{.Names}}'</span> | <span class="nb">grep</span> <span class="nt">-i</span> tailscale<span class="si">)</span> tailscale cert <span class="nt">--cert-file</span><span class="o">=</span>/certs/SERVERNAME.tailXXXXX.ts.net.crt <span class="nt">--key-file</span><span class="o">=</span>/certs/SERVERNAME.tailXXXXX.ts.net.key supersol.tail3942a.ts.net
</code></pre></div></div>

<p>The job can run daily as it will only renew the certification if it is close to expiration.</p>

<h2 id="configure-caddy">Configure Caddy</h2>

<p>Now we’re ready to set up Caddy. First make sure that the certs folder is mapped as a volume in your Caddy container. For consistency, I mapped the certs folder to /certs on the Caddy container.</p>

<p>Now for each application you’re running, you can add an entry into the Caddyfile. You can have multiple applications in a Caddyfile. With Tailscale, you’ll be setting up the entry with an external port that will be used with the MagicDNS address that will route to the internal address with the internal port. You won’t be able to use the same ports as they are essentially all running on your network. I chose to start at 8443 for my reverse proxy ports and am adding one per application. The internal port is dependent on the application and your Docker setup. Here is an example entry:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># APPLICATIONNAME
SERVERNAME.tailXXXXX.ts.net:YYYY {
        tls /certs/SERVERNAME.tailXXXXX.ts.net.crt /certs/SERVERNAME.tailXXXXX.ts.net.key
        reverse_proxy localhost:ZZZZ
}
</code></pre></div></div>

<p>Sub out the following:</p>

<ul>
  <li>APPLICATIONAME to add a comment</li>
  <li>SERVERNAME for the name of your TrueNAS server</li>
  <li>XXXXX for the Tailnet ID</li>
  <li>YYYY for the port you will access the application through the MagicDNS</li>
  <li>ZZZZ for the port the container is accessible through Docker</li>
</ul>

<p>Reload the Caddy application or reload the Caddyfile through this command that would be run with your user when SSH’d into the server:</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>docker <span class="nb">exec</span> <span class="si">$(</span><span class="nb">sudo </span>docker ps <span class="nt">--format</span> <span class="s1">'{{.Names}}'</span> | <span class="nb">grep</span> <span class="nt">-i</span> caddy<span class="si">)</span> caddy reload <span class="nt">--config</span> /etc/caddy/Caddyfile
</code></pre></div></div>

<p>Now access SERVERNAME.tailXXXXX.ts.net:YYYY through the web. So long as the device you’re connected to is on your Tailnet, it should work. You can test outside access by disconnecting from the Tailnet and the application won’t load. You may need to configure the application to recognize that as the new base address.</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>It’s entirely possible the claims from <a href="https://www.scientificamerican.com/article/what-is-mythos-and-why-are-experts-worried-about-anthropics-ai-model/">Anthropic are hyperbolic</a>, but the fact is read release notes for recent applications and they are full of bug fixes. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><summary type="html"><![CDATA[By utilizing Tailscale's MagicDNS, HTTPS, and Caddy you can access applications installed on your Homelab in a secure way from outside your home network. This post walks through the configuration and setup.]]></summary></entry><entry><title type="html">Python Script to Scrobble iTunes XML to Last.fm</title><link href="https://ryan.malesevich.me/blog/2025/07/03/python-script-to-scrobble-itunes-xml-to-lastfm.html" rel="alternate" type="text/html" title="Python Script to Scrobble iTunes XML to Last.fm" /><published>2025-07-03T11:49:00-05:00</published><updated>2025-07-03T11:49:00-05:00</updated><id>https://ryan.malesevich.me/blog/2025/07/03/python-script-to-scrobble-itunes-xml-to-lastfm</id><content type="html" xml:base="https://ryan.malesevich.me/blog/2025/07/03/python-script-to-scrobble-itunes-xml-to-lastfm.html"><![CDATA[<p>Today, I made my <a href="https://github.com/rmalesevich/itunes-scrobbler">itunes-scrobbler</a> repository public.</p>

<p>The repository contains a Python script that reads a legacy iTunes XML file<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup> and scrobbles music plays to <a href="https://www.last.fm">Last.fm</a>. The script is basic but functional: it caches previously scrobbled plays and only submits new ones. The README.md includes all the steps needed to get it running. If you encounter any issues, feel free to open an Issue on the repository.</p>

<p>So, why did I build this?</p>

<p>Over the past month, I’ve been working on a project I’ll write more about later. One part of that project involved buying an iPod Classic. Nostalgia is a powerful emotion, and it’s been genuinely fun rediscovering albums in the streaming era.</p>

<p>Since the iPod Classic doesn’t work with Apple Music, I didn’t want to connect it to the Music Library I’ve had on my Mac since 2004. That library contains thousands of songs I ripped from CDs, purchased from the iTunes Store, or added via Apple Music. Instead, I created a new user account on my Mac that isn’t linked to any Apple ID. This gave me a clean Music library, which I’m slowly populating with MP3s to sync with my iPod.</p>

<p>I’ve been a regular Last.fm user since 2018. When I briefly tried Spotify—a trial that didn’t stick—I decided to consolidate my listening history through Last.fm. These days, I try to scrobble all my music plays there. Naturally, I wanted my iPod play counts to show up in my Last.fm profile. So I spent a few hours and wrote this script.</p>

<p>The script works best on small or new libraries—like mine. I wouldn’t recommend running it against a large or heavily played library, as it may corrupt your Last.fm history.</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>When iTunes was replaced by Music.app, the automatic creation of the iTunes Music Library XML file was removed. This XML file was originally used by third-party apps to interact with your iTunes library. Thankfully, there’s an app called <a href="https://github.com/kylekingcdn/music-library-exporter">Music Library Exporter</a> that can generate the XML file from your current Music library—something I desperately needed for this project. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><summary type="html"><![CDATA[Today, I made my itunes-scrobbler repository public. The repository contains a Python script that reads a legacy iTunes XML file and scrobbles music plays to Last.fm. The script is basic but functional...]]></summary></entry><entry><title type="html">My Internet Home</title><link href="https://ryan.malesevich.me/blog/2025/04/25/my-internet-home.html" rel="alternate" type="text/html" title="My Internet Home" /><published>2025-04-25T12:00:00-05:00</published><updated>2025-04-25T12:00:00-05:00</updated><id>https://ryan.malesevich.me/blog/2025/04/25/my-internet-home</id><content type="html" xml:base="https://ryan.malesevich.me/blog/2025/04/25/my-internet-home.html"><![CDATA[<p>Welcome to my internet home! My name is <a href="/about.html">Ryan</a>. There are so many projects that are floating around my head and while working through them, I figured I needed a place of my own to host them. Things are spare now, but stay tuned!</p>

<p>The site is built through <a href="https://jekyllrb.com">Jekly</a> and hosted at <a href="https://www.linode.com">Akamai/Linode</a>. I don’t currently have any fancy CI/CD automations as I publish through a shell script that does the build and rsync.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[Welcome to my internet home! My name is Ryan. There are so many projects that are floating around my head and while working through them, I figured I needed a place of my own to host them. Things are spare now, but stay tuned!]]></summary></entry></feed>