<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>sngrs</title><link>https://sng.rs/</link><description>A personal blog about technology and other interests</description><language>en-us</language><lastBuildDate>Fri, 28 Feb 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://sng.rs/index.xml" rel="self" type="application/rss+xml"/><item><title>Fixing my mic for calls</title><pubDate>Tue, 27 Oct 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/fixing-my-mic-for-calls/</guid><description>&lt;p&gt;A friend told me I was too loud on Discord and that the ends of my sentences got cut off. My mic goes through DeepFilterNet (DFN) in a PipeWire filter-chain and then through EasyEffects, so I looked into the chain to find the source of the issues.&lt;/p&gt;
&lt;h2 id="preparation"&gt;Preparation&lt;/h2&gt;
&lt;p&gt;I started by listening in realtime to changes I made, but I noticed I couldn&amp;rsquo;t really focus on listening while I was also speaking. So instead of talking into the mic, I recorded a raw take once and ran it through the chain offline. This way I could change one thing and listen again.&lt;/p&gt;
&lt;h2 id="source-of-clipping"&gt;Source of clipping&lt;/h2&gt;
&lt;p&gt;Changing settings in EasyEffects changed nothing to the clipping. DeepFilterNet cuts off quiet speech as noise, so I added a gain boost in front of it. DeepFilterNet also adds gain of its own. Together with the rest of my chain, that was the &amp;ldquo;too loud&amp;rdquo; and maybe the cut-off ends as well. So I added a trim right after DFN that takes that gain back out.&lt;/p&gt;
&lt;h2 id="tuning-the-eq"&gt;Tuning the EQ&lt;/h2&gt;
&lt;p&gt;The gate turned out to be redundant, DFN already handles the noise, and the compressor did nothing but add latency. The EQ was what made my voice boom. I threw out the gate and the compressor and kept a high-pass at 80 Hz and a bit of low end.&lt;/p&gt;
&lt;h2 id="discord"&gt;Discord&lt;/h2&gt;
&lt;p&gt;On the Discord side: input sensitivity on manual, noise suppression and automatic gain control off. The chain does that already.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/Rikorose/DeepFilterNet"&gt;DeepFilterNet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/wwmm/easyeffects"&gt;EasyEffects&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Hold-to-talk dictation on sway and WoW chat</title><pubDate>Sun, 25 Oct 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/hold-to-talk-dictation-on-sway-and-wow-chat/</guid><description>&lt;p&gt;In World of Warcraft I chat while my hands are on the movement keys, but I felt like it sometimes interrupts the flow of what I&amp;rsquo;m doing too much. So I wired up a dictation tool using whisper.cpp.&lt;/p&gt;
&lt;h2 id="the-key"&gt;The key&lt;/h2&gt;
&lt;p&gt;My Voyager (a ZSA keyboard) sends F13 from a combo. That&amp;rsquo;s keycode &lt;code&gt;XF86Tools&lt;/code&gt; in xkb, bound in sway:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;bindsym XF86Tools exec ~/.local/bin/dictate start
bindsym --release XF86Tools exec ~/.local/bin/dictate stop
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;start&lt;/code&gt; runs &lt;code&gt;parec&lt;/code&gt; into a wav. &lt;code&gt;stop&lt;/code&gt; sends SIGINT to that earlier process, and posts the wav to the ASR server (whisper.cpp) so it gets transcribed. The server uses whisper-server&amp;rsquo;s &lt;code&gt;/inference&lt;/code&gt; contract.&lt;/p&gt;
&lt;h2 id="dictating-to-world-of-warcraft"&gt;Dictating to World of Warcraft&lt;/h2&gt;
&lt;p&gt;I picked &lt;code&gt;wtype&lt;/code&gt;, designed for Wayland, but I couldn&amp;rsquo;t get it to interface with WoW. So I switched to &lt;code&gt;ydotool&lt;/code&gt;, which does work.&lt;/p&gt;
&lt;p&gt;In WoW, typing without an input field could do all sorts of things in the game: if the input field is not open, every inputted character can hit a keybind. So when the focused window is &lt;code&gt;wowb.exe&lt;/code&gt;, &lt;code&gt;dictate&lt;/code&gt; puts the text on the clipboard, has ydotool press Enter, Ctrl+V, Enter, and restores the old clipboard.&lt;/p&gt;
&lt;h2 id="tweaking-it-for-game-specific-uses"&gt;Tweaking it for game-specific uses&lt;/h2&gt;
&lt;p&gt;A sentence that starts with a channel word (party, say, yell, etc.) becomes a chat command, e.g.:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;ldquo;party, hello&amp;rdquo; is &lt;code&gt;/p Hello&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;guild anyone up?&amp;rdquo; is &lt;code&gt;/g Anyone up?&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;emote dance&amp;rdquo; is &lt;code&gt;/dance&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;slash reload&amp;rdquo; is &lt;code&gt;/reload&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I added a mapping table which is a dict of the recurring mishearings, e.g.: killed, gilt and guilt all mean guild, incense means instance, remote and mode mean emote.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/ggml-org/whisper.cpp"&gt;whisper.cpp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ReimuNotMoe/ydotool"&gt;ydotool&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/atx/wtype"&gt;wtype&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.zsa.io/voyager"&gt;ZSA Voyager&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Moving my off-site backup from B2 to a Hetzner Storage Box</title><pubDate>Sat, 24 Oct 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/moving-my-off-site-backup-from-b2-to-a-hetzner-storage-box/</guid><description>&lt;p&gt;My NAS runs borgmatic into a local borg repo, and a TrueNAS cloud sync task pushed that repo to Backblaze B2 for about $2 a month. When I checked what was in it, the Longhorn backups, Forgejo&amp;rsquo;s repos, the TrueNAS config and my desktop were all missing.&lt;/p&gt;
&lt;h2 id="hetzner-instead-of-b2"&gt;Hetzner instead of B2&lt;/h2&gt;
&lt;p&gt;A BX11 Storage Box is €3.87 a month for 1 TB, in the EU, and runs borg itself, so borgmatic writes to it over SSH as a second repository next to the local one. I moved borgmatic to a custom compose app on TrueNAS declared in my homelab repo. A generator turns it into a backup doc, so it is easy to check what is backed up.&lt;/p&gt;
&lt;p&gt;My desktop still backs up to the NAS over the LAN, and the NAS uploads the desktop&amp;rsquo;s borg repo off site as one more source.&lt;/p&gt;
&lt;h2 id="verification"&gt;Verification&lt;/h2&gt;
&lt;p&gt;After each run borgmatic pushes a success timestamp, the archive count and the Storage Box usage to VictoriaMetrics. Alerts fire on a missed night, on archives disappearing while backups still succeed, and at 90% full Hetzner Storage Box. The weekly repository check runs on Hetzner&amp;rsquo;s side, a monthly spot check reads back 1% of the repo, and the full data check runs quarterly.&lt;/p&gt;
&lt;h2 id="disaster-recovery"&gt;Disaster Recovery&lt;/h2&gt;
&lt;p&gt;My password store lives on the cluster, backed up to the NAS. In case of disaster it would leave the archive&amp;rsquo;s keys inside the archive.&lt;/p&gt;
&lt;p&gt;So I made three LUKS USB sticks, each with a passphrase and YubiKey slots enrolled. A script fills them with the borg passphrase, the key exports, a separate SSH key for the Storage Box, its pinned host key, the borgmatic image, a standalone borg binary and the runbook. A script on the stick opens a borg shell against the repo at Hetzner.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://torsion.org/borgmatic/"&gt;borgmatic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.borgbackup.org/"&gt;BorgBackup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.hetzner.com/storage/storage-box/"&gt;Hetzner Storage Box&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Reducing my system's boot time</title><pubDate>Fri, 23 Oct 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/halving-my-boot-time-and-finally-seeing-the-yubikey-prompt/</guid><description>&lt;p&gt;My desktop took about a minute from power button to login prompt, which I figured was a bit slow for my machine. I was able to cut it down to about half a minute.&lt;/p&gt;
&lt;h3 id="analysis"&gt;Analysis&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;systemd-analyze blame&lt;/code&gt; blamed &lt;code&gt;NetworkManager-wait-online.service&lt;/code&gt; for 13 seconds. That is a distraction, my login manager (ly) does not wait for it. I later found that &lt;code&gt;journalctl -b -o short-monotonic&lt;/code&gt; shows what actually blocks the login prompt.&lt;/p&gt;
&lt;p&gt;Three of the four LUKS volumes are unlocked in parallel with a keyfile and took ~10 seconds each. Their slots used Argon2id, so they are fighting for memory bandwidth. Only home is required by &lt;code&gt;local-fs.target&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;LUKS2 allows a different KDF per slot, which I could use to remove the memory bandwidth usage. The passphrase slot keeps Argon2id, the keyfile slots get PBKDF2:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo cryptsetup luksConvertKey --key-file /etc/crypt-automount/keyfile &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; --pbkdf pbkdf2 --pbkdf-force-iterations &lt;span style="color:#ae81ff"&gt;1000&lt;/span&gt; /dev/disk/by-uuid/&amp;lt;uuid&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="fido2"&gt;FIDO2&lt;/h3&gt;
&lt;p&gt;I have a Yubikey and typing the LUKS passphrase took another couple of seconds. Systemd can unlock LUKS2:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo pacman -S libfido2
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo systemd-cryptenroll --fido2-device&lt;span style="color:#f92672"&gt;=&lt;/span&gt;auto --fido2-with-client-pin&lt;span style="color:#f92672"&gt;=&lt;/span&gt;no /dev/disk/by-uuid/&amp;lt;uuid&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add &lt;code&gt;rd.luks.options=fido2-device=auto,token-timeout=15s&lt;/code&gt; to the kernel command line and rebuild the initrd. The passphrase stays as fallback when no key is detected.&lt;/p&gt;
&lt;h3 id="missing-unlock-prompt"&gt;Missing unlock prompt&lt;/h3&gt;
&lt;p&gt;After enrolling a Yubikey, boot showed a blinking cursor and nothing else. Apparently, &amp;ldquo;Please confirm presence on security token to unlock&amp;rdquo; only goes to the journal. &lt;code&gt;systemd.show_status=1&lt;/code&gt; shows it but buries it in unit output.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;src/shared/libfido2-util.c&lt;/code&gt; systemd hands that message to Plymouth. So I installed Plymouth to improve my UX, on Arch:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo pacman -S plymouth
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# HOOKS=(base systemd plymouth ... sd-encrypt ...), add splash to the cmdline&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo mkinitcpio -P
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="the-bios"&gt;The BIOS&lt;/h3&gt;
&lt;p&gt;I assumed 15 seconds of firmware would be AM5 memory training. I updated the BIOS firmware, enabled Memory Context Restore and Power Down Enable, disabled CSM, and cold booted. Firmware went from 15.3 to 14.0 seconds.&lt;/p&gt;
&lt;h3 id="result"&gt;Result&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;stage&lt;/th&gt;
&lt;th&gt;before&lt;/th&gt;
&lt;th&gt;after&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;firmware&lt;/td&gt;
&lt;td&gt;15.3s&lt;/td&gt;
&lt;td&gt;14.0s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;loader + kernel&lt;/td&gt;
&lt;td&gt;3.7s&lt;/td&gt;
&lt;td&gt;3.8s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;initrd&lt;/td&gt;
&lt;td&gt;10.0s&lt;/td&gt;
&lt;td&gt;8.3s, of which 5.2s is the touch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;userspace to login&lt;/td&gt;
&lt;td&gt;25.3s&lt;/td&gt;
&lt;td&gt;8.2s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;total&lt;/td&gt;
&lt;td&gt;54.3s&lt;/td&gt;
&lt;td&gt;34.3s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Linux&amp;rsquo;s share went from 36 seconds to 14.&lt;/p&gt;
&lt;h3 id="see-also"&gt;See also&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/systemd/systemd/blob/v262/src/shared/libfido2-util.c"&gt;systemd libfido2-util.c&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/systemd/systemd/issues/38324"&gt;systemd issue #38324&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;man crypttab&lt;/code&gt;, &lt;code&gt;fido2-device=&lt;/code&gt; and &lt;code&gt;token-timeout=&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Replacing Proton with Stalwart</title><pubDate>Sun, 18 Oct 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/replacing-proton-with-stalwart/</guid><description>&lt;p&gt;I&amp;rsquo;ve moved my mail, calendars and contacts off Proton. The main reason is that I didn&amp;rsquo;t want a subscription anymore. That alone rules out every hosted provider with a custom domain. I also wanted real IMAP (instead of Proton Bridge), calendars that sync on Arch and GrapheneOS, and wanted to keep the ability to invite people to events and answer invitations from my mail clients. Stalwart does all of that in one binary, so it went into the cluster.&lt;/p&gt;
&lt;h2 id="stalwart-in-my-environment"&gt;Stalwart in my environment&lt;/h2&gt;
&lt;p&gt;Stalwart offers IMAP, JMAP, SMTP, ManageSieve, CalDAV with scheduling, and CardDAV. That replaced three things: the protonmail-bridge pod, neodav (my own CalDAV/CardDAV server) and Proton Calendar.&lt;/p&gt;
&lt;p&gt;Only incoming mail via SMTP is public. The rest is only available over WireGuard.&lt;/p&gt;
&lt;h2 id="inbound-through-caddy"&gt;Inbound through Caddy&lt;/h2&gt;
&lt;p&gt;My edge VPS is mostly stateless and runs, amongst other apps, Caddy and CrowdSec in Docker Compose. Inbound mail is a &lt;code&gt;layer4&lt;/code&gt; block in the Caddyfile that proxies raw TCP 25 to Stalwart with PROXY protocol v2. Stalwart receives the connection, so SPF, DMARC and reverse-IP checks all run against the real sender.&lt;/p&gt;
&lt;p&gt;My first design was a DNAT of port 25 into a WireGuard sidecar, because I wrongly assumed a proxy would lose the sender address. The VPS had an unscoped &lt;code&gt;POSTROUTING -o wg0 -j MASQUERADE&lt;/code&gt; rule that would have made every sender on earth look like &lt;code&gt;10.99.0.1&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;A WireGuard sidecar in the Stalwart pod peers with the VPS&amp;rsquo;s wg-easy, only routing destination port 25. Two things broke:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the pod picks its source address before the fwmark re-routes it, so WireGuard dropped everything until I added an SNAT rule,&lt;/li&gt;
&lt;li&gt;wg-easy&amp;rsquo;s &lt;code&gt;FORWARD ACCEPT&lt;/code&gt; lives in legacy iptables while the host&amp;rsquo;s nft FORWARD policy is DROP. A drop in either backend wins.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Mail-tester gave 10/10 on the first try. Microsoft 365 put the test mail in the inbox. Gmail put it in spam with &amp;ldquo;similar to messages identified as spam in the past&amp;rdquo;, which for a two-line mail from a never-seen IP is sadly expected.&lt;/p&gt;
&lt;h2 id="backup-mx"&gt;Backup MX&lt;/h2&gt;
&lt;p&gt;I nearly skipped making a backup MX, figuring senders would retry for several days. Firefox Relay forwards over SES and gives up after about 14 hours, then pauses every mask for a day. Microsoft 365 expires a message after 24 hours.&lt;/p&gt;
&lt;p&gt;So there is a Postfix on the NAS now, as a TrueNAS custom app, and Caddy has it as a second upstream with &lt;code&gt;lb_policy first&lt;/code&gt; and a health check. One MX record, one IP. Postfix relays its queue into a second Stalwart listener on a separate port. That port expects no PROXY header and isn&amp;rsquo;t matched by the SenderAuth rules, so relayed mail doesn&amp;rsquo;t get scored as coming from the NAS.&lt;/p&gt;
&lt;h2 id="clients"&gt;Clients&lt;/h2&gt;
&lt;p&gt;I use &lt;code&gt;aerc&lt;/code&gt; on my Arch Linux (by the way) machines, which has &lt;code&gt;:accept&lt;/code&gt;, &lt;code&gt;:accept-tentative&lt;/code&gt; and &lt;code&gt;:decline&lt;/code&gt; built in and composes the iMIP reply itself. Stalwart then files the event into the calendar server-side. On my phone it&amp;rsquo;s the Bulwark Android app, which syncs contacts and calendars both ways with the GrapheneOS apps. Push notifications are handled by JMAP push together with UnifiedPush, delivered through the ntfy I already run. Webmail is a Bulwark server, which is built for Stalwart.&lt;/p&gt;
&lt;h2 id="the-import"&gt;The import&lt;/h2&gt;
&lt;p&gt;Mail was imported with vandelay, exported from the Proton Bridge over IMAP and imported over JMAP. The first run failed on Stalwart&amp;rsquo;s upload quota, 1000 files and 50MB per window.&lt;/p&gt;
&lt;p&gt;Calendars were exported out of Proton. Before upload I stripped all &lt;code&gt;ATTENDEE&lt;/code&gt; lines from the &lt;code&gt;.ics&lt;/code&gt; files. Otherwise, I think Stalwart would have sent an invitation to all people for every event I&amp;rsquo;d ever been in.&lt;/p&gt;
&lt;p&gt;Contacts came from neodav first. Then I compared against Proton&amp;rsquo;s own &lt;code&gt;.vcf&lt;/code&gt; export and added what neodav had missed.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://stalw.art/"&gt;Stalwart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bulwarkmail.com/"&gt;Bulwark&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aerc-mail.org/"&gt;aerc&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/stalwartlabs/vandelay"&gt;vandelay&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mholt/caddy-l4"&gt;Caddy layer4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ntfy.sh/"&gt;ntfy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>WoW voice chat versus Mullvad on Linux</title><pubDate>Wed, 14 Oct 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/wow-voice-chat-versus-mullvad-on-linux/</guid><description>&lt;p&gt;I play World of Warcraft on Linux, through Battle.net running under &lt;code&gt;umu-run&lt;/code&gt; with GE-Proton. It mostly just works. Two things didn&amp;rsquo;t: a voice chat error that popped up every 30 seconds, and a launch that took forever. Both turned out to be the same bug, and the cause wasn&amp;rsquo;t Wine or Blizzard, but my VPN config.&lt;/p&gt;
&lt;h2 id="the-symptoms"&gt;The symptoms&lt;/h2&gt;
&lt;p&gt;Every 30 seconds the chat window showed me:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Lost connection to the voice chat service (VoiceError: 17)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;On top of that, hitting Play took 1.5 to 2.5 minutes before the game window showed up. I&amp;rsquo;d initially assumed that was just a Wine issue. After the fix it takes about 20 seconds.&lt;/p&gt;
&lt;h2 id="whats-actually-going-on"&gt;What&amp;rsquo;s actually going on&lt;/h2&gt;
&lt;p&gt;The Blizzard client and its voice proxy (&lt;code&gt;Utils/WowVoiceProxyT.exe&lt;/code&gt;) use a trick to wake up their own threads: they open a TCP socket on loopback and connect it to itself. Writing a byte to it wakes up whatever thread is waiting on the other end.&lt;/p&gt;
&lt;p&gt;Both directions of the flow share the exact same address. Linux&amp;rsquo;s connection tracking (conntrack) follows TCP sequence numbers and windows per direction, and with both directions looking identical it gets confused. The first segment goes through. Every segment after that gets marked &lt;code&gt;INVALID&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Normally that&amp;rsquo;s harmless, because nothing drops invalid packets on loopback. Mullvad&amp;rsquo;s nftables rules do drop them. So:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The voice proxy never wakes up to accept the game&amp;rsquo;s connection. The game gives up, retries, and 30 seconds later we get VoiceError 17 again.&lt;/li&gt;
&lt;li&gt;The game&amp;rsquo;s own network thread stalls in the same way, until some retransmit happens to slip through. I suspect this causes the slow launch.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="reproducing-it-without-the-game"&gt;Reproducing it without the game&lt;/h2&gt;
&lt;p&gt;A self-connected socket in Python:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;import&lt;/span&gt; socket
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;s &lt;span style="color:#f92672"&gt;=&lt;/span&gt; socket&lt;span style="color:#f92672"&gt;.&lt;/span&gt;socket()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;s&lt;span style="color:#f92672"&gt;.&lt;/span&gt;bind((&lt;span style="color:#e6db74"&gt;&amp;#34;127.0.0.1&amp;#34;&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;))
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;s&lt;span style="color:#f92672"&gt;.&lt;/span&gt;connect(s&lt;span style="color:#f92672"&gt;.&lt;/span&gt;getsockname())
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;s&lt;span style="color:#f92672"&gt;.&lt;/span&gt;settimeout(&lt;span style="color:#ae81ff"&gt;3&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; i &lt;span style="color:#f92672"&gt;in&lt;/span&gt; (&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;):
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; s&lt;span style="color:#f92672"&gt;.&lt;/span&gt;send(&lt;span style="color:#e6db74"&gt;b&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;x&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;try&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; print(i, s&lt;span style="color:#f92672"&gt;.&lt;/span&gt;recv(&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;))
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;except&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;TimeoutError&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; print(i, &lt;span style="color:#e6db74"&gt;&amp;#34;dropped&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With Mullvad connected, the first send arrives and the second doesn&amp;rsquo;t. The invalid counter in &lt;code&gt;/proc/net/stat/nf_conntrack&lt;/code&gt; climbs.&lt;/p&gt;
&lt;h2 id="the-fix"&gt;The fix&lt;/h2&gt;
&lt;p&gt;Set conntrack to be liberal about TCP window tracking:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;echo &lt;span style="color:#e6db74"&gt;&amp;#39;net.netfilter.nf_conntrack_tcp_be_liberal = 1&amp;#39;&lt;/span&gt; | sudo tee /etc/sysctl.d/99-conntrack-liberal.conf
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo sysctl --system
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With &lt;code&gt;nf_conntrack_tcp_be_liberal&lt;/code&gt; set, conntrack only marks out-of-window RST segments as invalid, so the self-connected socket&amp;rsquo;s traffic stops being dropped. Voice chat connects and the game launches in about 20 seconds.&lt;/p&gt;
&lt;h2 id="not-just-mullvad"&gt;Not just Mullvad&lt;/h2&gt;
&lt;p&gt;There are Blizzard and Lutris forum threads blaming firewalld for the same VoiceError. Any firewall that drops &lt;code&gt;ctstate invalid&lt;/code&gt; will cause the issue this resolves.&lt;/p&gt;</description></item><item><title>Reverse-engineering the IKEA IDÅSEN desk, in Go</title><pubDate>Tue, 25 Aug 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/reverse-engineering-the-ikea-id%C3%A5sen-desk-in-go/</guid><description>&lt;p&gt;My IDÅSEN desk came with a LINAK DPG1C panel and a phone app I didn&amp;rsquo;t want to rely on. There are Go projects that already control this desk, but I wanted to figure out the protocol myself and write it up. This is a log of that process, compressed.&lt;/p&gt;
&lt;p&gt;The result is a small Go CLI, &lt;a href="https://git.sng.rs/ks/desk"&gt;&lt;code&gt;desk&lt;/code&gt;&lt;/a&gt;, with &lt;code&gt;height&lt;/code&gt;, &lt;code&gt;up&lt;/code&gt;/&lt;code&gt;down&lt;/code&gt;/&lt;code&gt;stop&lt;/code&gt;, &lt;code&gt;move 1.05&lt;/code&gt;, &lt;code&gt;sit&lt;/code&gt;/&lt;code&gt;stand&lt;/code&gt;, and &lt;code&gt;save&lt;/code&gt;. It uses &lt;code&gt;tinygo.org/x/bluetooth&lt;/code&gt; on Linux, which talks to the desk through BlueZ.&lt;/p&gt;
&lt;h2 id="pairing-and-the-sleep-problem"&gt;Pairing and the sleep problem&lt;/h2&gt;
&lt;p&gt;I paired the desk once with &lt;code&gt;bluetoothctl&lt;/code&gt; while holding its connect button. I had some issues with connecting to the desk, but I think i just made some mistakes with the app. I thought it needed physical action to wake it for input, but that doesn&amp;rsquo;t seem to be the case.&lt;/p&gt;
&lt;h2 id="the-gatt-layout"&gt;The GATT layout&lt;/h2&gt;
&lt;p&gt;A quick dump of the services showed the desk&amp;rsquo;s own name (&lt;code&gt;Desk 8742&lt;/code&gt;) plus four LINAK services. The interesting part:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;service&lt;/th&gt;
&lt;th&gt;characteristic&lt;/th&gt;
&lt;th&gt;role&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;99fa0001&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;99fa0002&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;control: where move commands go&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;99fa0001&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;99fa0003&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;read/notify: errors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;99fa0010&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;99fa0011&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;read/write/notify: DPG config commands&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;99fa0020&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;99fa0021&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;read/notify: height and speed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;99fa0030&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;99fa0031&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;write: also a command sink&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The character flags (from BlueZ&amp;rsquo;s &lt;code&gt;GattCharacteristic1.Flags&lt;/code&gt;) told me which ones were writable vs notifiable, which narrowed the search.&lt;/p&gt;
&lt;h2 id="height-announcements"&gt;Height announcements&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;99fa0021&lt;/code&gt; is the service that communicates with 4-byte packets. The desk only announces changes, so I had to move it with the physical buttons to capture data. Once I had a stream the format fell out:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[height_lo][height_hi][speed_lo][speed_hi] little-endian u16 pairs
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;height is a 16-bit value, monotonic with the desk&amp;rsquo;s movement&lt;/li&gt;
&lt;li&gt;speed is signed: 0 when stopped, positive up, negative down&lt;/li&gt;
&lt;li&gt;the magnitude of the speed is the same both directions, which is a nice sanity check&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A calibration run: drive to the top and bottom. Top was &lt;code&gt;6500&lt;/code&gt;, bottom was &lt;code&gt;0&lt;/code&gt;. The IDÅSEN travels 62 to 127 cm, which maps nicely in the range the calibration found. &lt;code&gt;meters = (6200 + raw)/10000&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="sending-movement"&gt;Sending movement&lt;/h2&gt;
&lt;p&gt;The first few attempts wrote single bytes (&lt;code&gt;0x01&lt;/code&gt;, &lt;code&gt;0x47&lt;/code&gt;) to &lt;code&gt;99fa0002&lt;/code&gt; and nothing happened. The commands turned out to be two bytes:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;write 99fa0002: 47 00 # move up
write 99fa0002: 46 00 # move down
write 99fa0002: ff 00 # stop
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Each command alone moves the desk for about a second before it stops itself, so continuous movement means re-sending the same command roughly every 400 ms. The app does that while watching the announced height, and sends &lt;code&gt;ff 00&lt;/code&gt; the moment it crosses the target, so a full move comes out as one smooth motion. &lt;code&gt;99fa0011&lt;/code&gt; is for config commands and they need a &lt;code&gt;7f&lt;/code&gt; header (&lt;code&gt;7f &amp;lt;command&amp;gt; 00&lt;/code&gt; for a read, &lt;code&gt;7f &amp;lt;command&amp;gt; 80 &amp;lt;data&amp;gt;&lt;/code&gt; to write), which is how the memory positions are programmed.&lt;/p&gt;
&lt;p&gt;I did not discover &lt;code&gt;47&lt;/code&gt;/&lt;code&gt;46&lt;/code&gt;/&lt;code&gt;ff&lt;/code&gt; purely from the desk. The reverse-engineering community had already mapped these controllers, and I used that as a source of hypotheses, then confirmed the two-byte framing live. The height and speed decode, the unit calibration, and the sleep behavior I got from the desk itself.&lt;/p&gt;
&lt;h2 id="the-app"&gt;The app&lt;/h2&gt;
&lt;p&gt;The app is small: a config file with the MAC and two named positions, a decode function I wrote tests for using the real captured packets, and a thin BLE layer. &lt;code&gt;move&lt;/code&gt; subscribes to &lt;code&gt;99fa0021&lt;/code&gt; and stops the moment it crosses the target position.&lt;/p&gt;
&lt;p&gt;Config at &lt;code&gt;~/.config/desk/config.yaml&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;mac_address&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;E4:D2:80:3C:49:36&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;positions&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;sit&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0.72&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;stand&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;1.05&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>GitOps for my edge VPS</title><pubDate>Tue, 14 Jul 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/gitops-for-my-edge-vps/</guid><description>&lt;p&gt;My cluster is GitOps&amp;rsquo;d end to end: I merge to &lt;code&gt;main&lt;/code&gt; and ArgoCD picks it up. My edge VPS didn&amp;rsquo;t have this. It runs the public-facing stack (Caddy, Authelia, CrowdSec) on Docker Compose. So updating it meant SSHing in to scp a config and &lt;code&gt;docker compose up&lt;/code&gt; by hand. I wanted the same there.&lt;/p&gt;
&lt;h2 id="the-loop"&gt;The loop&lt;/h2&gt;
&lt;p&gt;A systemd timer runs a reconcile script every ~15 minutes. It basically does &lt;code&gt;git fetch&lt;/code&gt; + &lt;code&gt;reset --hard origin/main&lt;/code&gt;, rsyncs an allowlist of tracked files into &lt;code&gt;/opt/&amp;lt;svc&amp;gt;/&lt;/code&gt;, and then, for services whose files actually changed, runs &lt;code&gt;docker compose pull &amp;amp;&amp;amp; up -d&lt;/code&gt;. Renovate runs as a Forgejo Action and opens the image-bump PRs.&lt;/p&gt;
&lt;h2 id="the-allowlist"&gt;The allowlist&lt;/h2&gt;
&lt;p&gt;The sync uses an explicit allowlist: only files named in the map are written. Secrets, &lt;code&gt;.env&lt;/code&gt; files, etc. are not in there. Deleting a file from git does not delete it from the box currently.&lt;/p&gt;
&lt;h2 id="compiling-caddy"&gt;Compiling Caddy&lt;/h2&gt;
&lt;p&gt;Caddy required some more work, because it has to be compiled. It&amp;rsquo;s not a container here but a custom &lt;code&gt;xcaddy&lt;/code&gt; build with the Layer 4 and CrowdSec modules compiled.&lt;/p&gt;
&lt;p&gt;The reconcile there compares the running binary&amp;rsquo;s module versions against the pinned versions in &lt;code&gt;BUILD.txt&lt;/code&gt;, and on a diff it rebuilds Caddy inside a &lt;code&gt;golang&lt;/code&gt; container, runs &lt;code&gt;caddy validate&lt;/code&gt; on the candidate against the live Caddyfile, swaps &lt;code&gt;/usr/bin/caddy&lt;/code&gt;, and restarts, keeping a &lt;code&gt;.bak&lt;/code&gt;, and rolling back if Caddy doesn&amp;rsquo;t come back up. A merged Renovate bump to &lt;code&gt;BUILD.txt&lt;/code&gt; then rebuilds and redeploys itself.&lt;/p&gt;
&lt;h2 id="what-stays-manual"&gt;What stays manual&lt;/h2&gt;
&lt;p&gt;Not everything auto-applies on the VPS. The Caddyfile itself, the systemd units, and the reconcile&amp;rsquo;s own timer/service are excluded. I&amp;rsquo;m still a little afraid that updating those could cause downtime.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://caddyserver.com/"&gt;Caddy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/caddyserver/xcaddy"&gt;xcaddy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/renovatebot/renovate"&gt;Renovate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.authelia.com/"&gt;Authelia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.crowdsec.net/"&gt;CrowdSec&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Unattended OS upgrades on a DietPi k3s cluster</title><pubDate>Mon, 06 Jul 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/unattended-os-upgrades-on-a-dietpi-k3s-cluster/</guid><description>&lt;p&gt;My cluster mostly updates itself: ArgoCD syncs the manifests and Renovate keeps the image tags current. The one thing I still SSH&amp;rsquo;d in to do was patch the nodes&amp;rsquo; own OS. Now I handed that off too, with the system-upgrade-controller running a monthly &lt;code&gt;apt full-upgrade&lt;/code&gt; Plan and &lt;code&gt;unattended-upgrades&lt;/code&gt; applying security fixes in between.&lt;/p&gt;
&lt;h2 id="the-setup"&gt;The setup&lt;/h2&gt;
&lt;p&gt;K3s itself tracks the &lt;code&gt;stable&lt;/code&gt; channel via system-upgrade-controller (SUC). Security packages are handled continuously by &lt;code&gt;unattended-upgrades&lt;/code&gt;. Once a month a second SUC Plan drains one node at a time, runs &lt;code&gt;apt-get full-upgrade&lt;/code&gt; in a chroot of the host, and reboots the node into the new kernel. A CronJob bumps the Plan&amp;rsquo;s version on the first Sunday of the month so it re-runs.&lt;/p&gt;
&lt;h2 id="the-node-didnt-reboot"&gt;The node didn&amp;rsquo;t reboot&lt;/h2&gt;
&lt;p&gt;DietPi disables &lt;code&gt;systemd-logind&lt;/code&gt; by default. This makes &lt;code&gt;systemctl reboot&lt;/code&gt; fail with &lt;code&gt;login1.service failed to load&lt;/code&gt;. So the drain succeeds, the upgrade runs, and then the node just sits there, cordoned, never coming back.&lt;/p&gt;
&lt;p&gt;The fix is &lt;code&gt;systemctl --force reboot&lt;/code&gt;, which bypasses logind. I changed the Plan&amp;rsquo;s self-reboot and kured&amp;rsquo;s &lt;code&gt;rebootCommand&lt;/code&gt; to it.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/rancher/system-upgrade-controller"&gt;system-upgrade-controller&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/kubereboot/kured"&gt;kured&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wiki.debian.org/UnattendedUpgrades"&gt;unattended-upgrades&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dietpi.com/"&gt;DietPi&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Replacing Pangolin with Caddy</title><pubDate>Tue, 21 Apr 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/replacing-pangolin-with-caddy/</guid><description>&lt;p&gt;This was meant to be a quick swap of Newt, the Pangolin tunnel agent running in my cluster, for a tinier WireGuard pod I wrote in 30 lines of shell. It turned into an end-to-end teardown of Pangolin itself, replaced with Caddy, Authelia and CrowdSec on the VPS. This is the long version.&lt;/p&gt;
&lt;h2 id="why-i-wanted-newt-gone"&gt;Why I wanted Newt gone&lt;/h2&gt;
&lt;p&gt;Newt worked, but it was the chubbiest pod in my cluster relative to what it did, and it leaked memory on top of that, getting OOMKilled often. On a Raspi5 node every MiB matters. I started looking at whether I could replace it with something simpler.&lt;/p&gt;
&lt;h2 id="what-newt-actually-does"&gt;What Newt actually does&lt;/h2&gt;
&lt;p&gt;Pangolin ran on a small VPS. Public traffic hit Traefik there, and resources were forwarded over a WireGuard tunnel to a Newt agent inside the target network. Newt registered with Pangolin and acted as the L3/L7 bridge between the VPS-side WG network and cluster services.&lt;/p&gt;
&lt;p&gt;Functionally, the VPS just needed to reach things inside the cluster. WireGuard already did that; Newt was a convenience layer with a control plane on top. I already ran a similar stripped-down pod, &lt;code&gt;pangolin-ssh&lt;/code&gt;: &lt;code&gt;wg-quick&lt;/code&gt; + &lt;code&gt;socat&lt;/code&gt;, about 32 MiB, so I could SSH back to the VPS from inside the cluster. I figured I could build the inverse.&lt;/p&gt;
&lt;h2 id="the-gateway-pod"&gt;The gateway pod&lt;/h2&gt;
&lt;p&gt;The new pod was modelled exactly on &lt;code&gt;pangolin-ssh&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An init container set &lt;code&gt;net.ipv4.ip_forward=1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A main container based on &lt;code&gt;alpine:3.21&lt;/code&gt; brought up the WG interface with &lt;code&gt;wg-quick&lt;/code&gt; and configured iptables.&lt;/li&gt;
&lt;li&gt;A SealedSecret held &lt;code&gt;wg0.conf&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;No Service: it was purely a receiver of inbound traffic from the VPS over WG.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The entrypoint was dead simple:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#!/bin/sh
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;set -e
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;apk add --no-cache wireguard-tools iptables &amp;gt;/dev/null 2&amp;gt;&amp;amp;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cp /etc/wireguard/wg0.conf /tmp/wg0.conf
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;wg-quick down /tmp/wg0.conf 2&amp;gt;/dev/null &lt;span style="color:#f92672"&gt;||&lt;/span&gt; true
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;wg-quick up /tmp/wg0.conf
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;iptables -A FORWARD -i wg0 -o eth0 -j ACCEPT
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;iptables -A FORWARD -i eth0 -o wg0 -m state --state RELATED,ESTABLISHED -j ACCEPT
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;echo &lt;span style="color:#e6db74"&gt;&amp;#34;WireGuard tunnel up, forwarding wg0 -&amp;gt; cluster service network&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;exec sleep infinity
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The MASQUERADE on &lt;code&gt;eth0&lt;/code&gt; is the trick: packets arriving on &lt;code&gt;wg0&lt;/code&gt; get SNAT&amp;rsquo;d to the pod&amp;rsquo;s IP when forwarded out, so Cilium handles them like any other intra-cluster traffic. Return traffic finds its way back via conntrack.&lt;/p&gt;
&lt;p&gt;On the VPS side, in wg-easy, I added a new peer with &lt;code&gt;Server Allowed IPs = 10.43.0.0/16&lt;/code&gt; (the cluster service CIDR). wg-easy adds a kernel route for that prefix automatically when the interface comes up, no PostUp hook required.&lt;/p&gt;
&lt;p&gt;After bringing it all up, from the VPS:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ dig +short @10.43.0.10 coredns.kube-system.svc.cluster.local
10.43.0.10
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;End-to-end working. The VPS can now reach any cluster service directly.&lt;/p&gt;
&lt;h2 id="adding-tcp-to-coredns"&gt;Adding TCP to CoreDNS&lt;/h2&gt;
&lt;p&gt;For DNS responses larger than 512 bytes, the VPS needs TCP/53 to CoreDNS. The CoreDNS Helm chart supports it via a &lt;code&gt;use_tcp: true&lt;/code&gt; flag on the zone:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;servers&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#f92672"&gt;zones&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#f92672"&gt;zone&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;use_tcp&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;port&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;53&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;helm template&lt;/code&gt; showed the chart correctly produced two Service ports, &lt;code&gt;udp-53&lt;/code&gt; and &lt;code&gt;tcp-53&lt;/code&gt;, so I committed the change and synced.&lt;/p&gt;
&lt;p&gt;Except the live Service still showed only UDP/53.&lt;/p&gt;
&lt;h2 id="the-puzzle"&gt;The puzzle&lt;/h2&gt;
&lt;p&gt;This is where things got stuck.&lt;/p&gt;
&lt;p&gt;ArgoCD reported the app as &lt;code&gt;Synced&lt;/code&gt;, the diff &lt;code&gt;comparedTo&lt;/code&gt; had &lt;code&gt;use_tcp: true&lt;/code&gt;, and Helm rendered both ports locally. But the Service object in the cluster wasn&amp;rsquo;t getting the TCP entry. The sync result message was telling: &lt;code&gt;service/coredns unchanged&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The cause turned out to be a Server-Side Apply ownership conflict. &lt;code&gt;kubectl get svc coredns -n kube-system --show-managed-fields&lt;/code&gt; showed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;manager: helm&lt;/code&gt; owned &lt;code&gt;f:ports&lt;/code&gt; from a 2025 install, with the entry only for the UDP port.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;manager: argocd-controller&lt;/code&gt; owned the metadata fields but &lt;strong&gt;not&lt;/strong&gt; &lt;code&gt;f:ports&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Service had originally been applied directly by Helm before ArgoCD took over, and ArgoCD&amp;rsquo;s client-side &lt;code&gt;kubectl apply&lt;/code&gt; couldn&amp;rsquo;t modify the field that another manager owned. The TCP addition silently dropped, and ArgoCD&amp;rsquo;s diff, which compares against &lt;code&gt;last-applied-configuration&lt;/code&gt; rather than checking field ownership, thought everything was fine.&lt;/p&gt;
&lt;p&gt;I tried to patch the Service to add the TCP port:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;kubectl patch svc coredns -n kube-system --type=strategic -p \
&amp;#39;{&amp;#34;spec&amp;#34;:{&amp;#34;ports&amp;#34;:[{&amp;#34;name&amp;#34;:&amp;#34;udp-53&amp;#34;,...,&amp;#34;protocol&amp;#34;:&amp;#34;UDP&amp;#34;,...},{&amp;#34;name&amp;#34;:&amp;#34;tcp-53&amp;#34;,...,&amp;#34;protocol&amp;#34;:&amp;#34;TCP&amp;#34;,...}]}}&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is where I learned that &lt;code&gt;Service.spec.ports&lt;/code&gt; uses &lt;code&gt;port&lt;/code&gt; as its strategic-merge key, not &lt;code&gt;port&lt;/code&gt; + &lt;code&gt;protocol&lt;/code&gt;. The two entries with &lt;code&gt;port: 53&lt;/code&gt; got deduplicated, the TCP one won, &lt;strong&gt;UDP/53 was dropped&lt;/strong&gt;, and cluster DNS broke for any pod doing fresh UDP lookups.&lt;/p&gt;
&lt;p&gt;The fix was to use a JSON patch instead, which doesn&amp;rsquo;t dedupe:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;kubectl patch svc coredns -n kube-system --type=json -p \
&amp;#39;[{&amp;#34;op&amp;#34;:&amp;#34;replace&amp;#34;,&amp;#34;path&amp;#34;:&amp;#34;/spec/ports&amp;#34;,&amp;#34;value&amp;#34;:[
{&amp;#34;name&amp;#34;:&amp;#34;udp-53&amp;#34;,&amp;#34;port&amp;#34;:53,&amp;#34;protocol&amp;#34;:&amp;#34;UDP&amp;#34;,&amp;#34;targetPort&amp;#34;:53},
{&amp;#34;name&amp;#34;:&amp;#34;tcp-53&amp;#34;,&amp;#34;port&amp;#34;:53,&amp;#34;protocol&amp;#34;:&amp;#34;TCP&amp;#34;,&amp;#34;targetPort&amp;#34;:53}
]}]&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then I added &lt;code&gt;ServerSideApply=true&lt;/code&gt; to the CoreDNS Application&amp;rsquo;s &lt;code&gt;syncOptions&lt;/code&gt; so ArgoCD takes proper field ownership going forward. After the next sync, &lt;code&gt;argocd-controller&lt;/code&gt; owns &lt;code&gt;f:ports&lt;/code&gt; and Helm&amp;rsquo;s stale entry no longer wins.&lt;/p&gt;
&lt;p&gt;Two takeaways I&amp;rsquo;m writing down so I don&amp;rsquo;t forget:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Don&amp;rsquo;t strategic-merge &lt;code&gt;Service.spec.ports&lt;/code&gt;&lt;/strong&gt; when two entries share the same port number. JSON patch or SSA, always.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;When ArgoCD takes over a Helm-installed resource&lt;/strong&gt;, set &lt;code&gt;ServerSideApply=true&lt;/code&gt; from day one. Otherwise the original manager keeps owning fields and ArgoCD&amp;rsquo;s writes silently no-op.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="the-half-fix"&gt;The half-fix&lt;/h2&gt;
&lt;p&gt;The plumbing worked, the gateway pod was up, the VPS could reach the cluster service CIDR, CoreDNS spoke UDP and TCP, Pangolin could in principle resolve &lt;code&gt;*.svc.cluster.local&lt;/code&gt; and target services directly without Newt.&lt;/p&gt;
&lt;p&gt;Except: I still had to wire a DNS forwarder on the VPS, repoint every Pangolin resource from Newt → cluster hostnames, make sure a cluster outage didn&amp;rsquo;t also take out DNS for non-cluster targets, and then tear Newt down. Two self-inflicted SSH lockouts in, the remaining value felt small against the risk. &lt;strong&gt;One rule those taught me: always have an emergency SSH path before touching network plumbing, firewalled at the hosting provider by default and openable on demand.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Sitting with that, the real question changed. Not &lt;em&gt;is the gateway pod worth it?&lt;/em&gt;, but &lt;em&gt;is Pangolin worth it?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;What I actually used Pangolin for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A reverse proxy. Traefik does that.&lt;/li&gt;
&lt;li&gt;A forward-auth gate (Pangolin calls it &lt;code&gt;badger&lt;/code&gt;) for some private endpoints. Any SSO would do that.&lt;/li&gt;
&lt;li&gt;CrowdSec wiring. That&amp;rsquo;s a community Traefik plugin, not a Pangolin feature.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Pangolin&amp;rsquo;s resource UI and identity layer are real, but I&amp;rsquo;m one person with a small pile of resources. I&amp;rsquo;m not going to outgrow a text file. And Newt was on the teardown list either way.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;d also noticed a pattern putting me off: more of what I&amp;rsquo;d reach for sat behind a &amp;ldquo;supporter&amp;rdquo; tier or commercial edition. Nothing wrong with a project needing revenue, but the homelab had started to feel like a dashboard that was also a sales funnel. That was the final nudge.&lt;/p&gt;
&lt;p&gt;I started researching what plain Caddy would look like.&lt;/p&gt;
&lt;h2 id="the-target-stack"&gt;The target stack&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caddy&lt;/strong&gt; on the VPS, custom-built with &lt;code&gt;xcaddy&lt;/code&gt; so &lt;code&gt;caddy-l4&lt;/code&gt; and &lt;code&gt;caddy-crowdsec-bouncer&lt;/code&gt; are compiled in, a single binary owns HTTP, TLS, L4 forwarding, and bouncer decisions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Authelia&lt;/strong&gt; in one container for forward-auth.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CrowdSec&lt;/strong&gt; kept as-is. Only the bouncer changed, from Traefik plugin to Caddy module.&lt;/li&gt;
&lt;li&gt;The gateway pod from earlier stays and becomes load-bearing: every VPS → cluster packet goes through it.&lt;/li&gt;
&lt;li&gt;Newt, gerbil, Pangolin, Traefik: gone.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I dumped Pangolin&amp;rsquo;s resource table out of its SQLite to get the real inventory: a roughly-even mix of public and gated HTTP routes, plus a handful of L4 listeners (Forgejo SSH and the wg-easy UDP pools). That became the Caddyfile source of truth.&lt;/p&gt;
&lt;p&gt;Pre-flight went fine. &lt;code&gt;xcaddy build&lt;/code&gt;, Authelia secrets, a staged &lt;code&gt;Caddyfile.cutover&lt;/code&gt; under &lt;code&gt;/opt/replacement/&lt;/code&gt;. Validated. Authelia came up on &lt;code&gt;127.0.0.1:9091&lt;/code&gt;. CrowdSec got a bouncer key for the Caddy module.&lt;/p&gt;
&lt;p&gt;Cutover itself was one command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cd /opt/pangolin &lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt; docker compose stop pangolin gerbil traefik
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cp /opt/replacement/Caddyfile.cutover /etc/caddy/Caddyfile
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;systemctl restart caddy
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is where things turned into a series of smaller puzzles.&lt;/p&gt;
&lt;h2 id="puzzle-1-caddy-l4-doesnt-use-cluster-dns"&gt;Puzzle 1: caddy-l4 doesn&amp;rsquo;t use cluster DNS&lt;/h2&gt;
&lt;p&gt;My first Caddyfile pointed the L4 block at &lt;code&gt;forgejo-ssh.forgejo.svc.cluster.local:22&lt;/code&gt; and the two wg-easy UDP services similarly. That&amp;rsquo;s how the HTTP routes work: &lt;code&gt;reverse_proxy&lt;/code&gt; with &lt;code&gt;transport http { resolvers 10.43.0.10 }&lt;/code&gt; happily resolves cluster service names via CoreDNS.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;caddy-l4&lt;/code&gt;&amp;rsquo;s &lt;code&gt;proxy&lt;/code&gt; directive uses the system resolver, which on the VPS is Hetzner&amp;rsquo;s public DNS. Nothing &lt;code&gt;.cluster.local&lt;/code&gt; resolves. I replaced the hostnames with ClusterIPs resolved via &lt;code&gt;dig @10.43.0.10&lt;/code&gt; and baked them into the Caddyfile. ClusterIPs for stable Services don&amp;rsquo;t drift in practice.&lt;/p&gt;
&lt;h2 id="puzzle-2-my-own-vpn-quietly-ate-the-lan"&gt;Puzzle 2: my own VPN quietly ate the LAN&lt;/h2&gt;
&lt;p&gt;A while after the cutover, I noticed my laptop couldn&amp;rsquo;t reach &lt;code&gt;192.168.1.9&lt;/code&gt;, the cluster LB VIP, even though I could ping my router. Another PC on the LAN worked fine.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ ip route | grep 192.168.1
192.168.1.0/24 dev wg_home ... metric 53 ← wins
192.168.1.0/24 dev wlp0s20f3 ... metric 600
192.168.1.1 dev wlp0s20f3 ... metric 50 ← why the gateway still pings
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I keep a wg-easy peer on my laptop pointing at my LAN-only home tunnel so I can reach the LAN from outside. That UDP port used to be forwarded by Pangolin&amp;rsquo;s L4; with Pangolin stopped and Caddy&amp;rsquo;s L4 block still commented out (I&amp;rsquo;d staged it but not uncommented it during cutover), the peer had no live endpoint. WireGuard kept the interface up anyway, and the route kept winning over the LAN route, so anything LAN-ward disappeared into a dead tunnel. The &lt;code&gt;/32&lt;/code&gt; route to the router was metric 50 and specifically hardcoded, which is why it still worked and misled me.&lt;/p&gt;
&lt;p&gt;Taking the tunnel down restored LAN access. Uncommenting the L4 block in the Caddyfile, filling in the ClusterIPs, and reloading Caddy restored the tunnel: the two wg-easy UDP pools plus TCP/22 for Forgejo SSH.&lt;/p&gt;
&lt;h2 id="puzzle-3-reaching-truenas-via-the-cluster"&gt;Puzzle 3: reaching TrueNAS via the cluster&lt;/h2&gt;
&lt;p&gt;I moved LanguageTool off the cluster last week, it lives on my TrueNAS on the LAN now, fronted by an ExternalName Service. Pangolin/Newt made this work by accident: requests landed on Newt inside the cluster, resolved the ExternalName, and egressed to the LAN out of the cluster node&amp;rsquo;s NIC.&lt;/p&gt;
&lt;p&gt;From Caddy-on-VPS this doesn&amp;rsquo;t work. The VPS → cluster WG tunnel only covers the Service CIDR; the ExternalName resolves to a LAN IP the VPS has no route to.&lt;/p&gt;
&lt;p&gt;First attempt: a selector-less Service with manually specified Endpoints pointing at the fixed LAN IP. The theory: kube-proxy should DNAT ClusterIP traffic to an off-cluster IP, and the node&amp;rsquo;s masquerade rule for cluster-CIDR sources hides the return path.&lt;/p&gt;
&lt;p&gt;In practice, Cilium&amp;rsquo;s kube-proxy-replacement doesn&amp;rsquo;t program that case when the source is external (traffic arriving from the WG tunnel). TCP connects succeed against the ClusterIP but no response ever comes back. I eliminated other possibilities before accepting that I was hitting an unsupported path.&lt;/p&gt;
&lt;p&gt;What worked: a tiny nginx pod inside the &lt;code&gt;languagetool&lt;/code&gt; namespace, reverse-proxying to the TrueNAS host. The pod is a normal in-cluster egress source, the node masquerade fires the normal way for pod-originated external traffic, and the VPS just talks to this new ClusterIP like any other service. Two &lt;code&gt;Deployment&lt;/code&gt;/&lt;code&gt;ConfigMap&lt;/code&gt;/&lt;code&gt;Service&lt;/code&gt; files and one kustomization entry. I might look into fixing this later.&lt;/p&gt;
&lt;p&gt;Next trap: the nginx pod returned 502 on every request and logged &lt;code&gt;unexpected A record in DNS response&lt;/code&gt; every 5 seconds. I was using a runtime &lt;code&gt;resolver&lt;/code&gt; directive (so nginx resolves the upstream on each request rather than caching forever), and CoreDNS&amp;rsquo;s AAAA response was parsing wrong somewhere inside nginx. &lt;code&gt;ipv6=off&lt;/code&gt; on the resolver directive: problem gone.&lt;/p&gt;
&lt;h2 id="puzzle-4-authelias-missing-subcommand"&gt;Puzzle 4: Authelia&amp;rsquo;s missing subcommand&lt;/h2&gt;
&lt;p&gt;My compose had &lt;code&gt;test: [&amp;quot;CMD&amp;quot;, &amp;quot;authelia&amp;quot;, &amp;quot;healthcheck&amp;quot;]&lt;/code&gt; as the Docker healthcheck. I lifted it from an example I don&amp;rsquo;t remember. Current Authelia (4.39 at time of writing) doesn&amp;rsquo;t have a &lt;code&gt;healthcheck&lt;/code&gt; subcommand anymore, it returns &lt;code&gt;unknown command&lt;/code&gt; and the container stays stuck at &lt;code&gt;unhealthy&lt;/code&gt;, even though Authelia itself is happily gating requests.&lt;/p&gt;
&lt;p&gt;The image ships &lt;code&gt;/app/healthcheck.sh&lt;/code&gt;. It reads &lt;code&gt;/app/.healthcheck.env&lt;/code&gt; (which Authelia writes at startup) and runs &lt;code&gt;wget&lt;/code&gt; against &lt;code&gt;localhost:9091/api/health&lt;/code&gt;. &lt;code&gt;test: [&amp;quot;CMD&amp;quot;, &amp;quot;/app/healthcheck.sh&amp;quot;]&lt;/code&gt; and the container turns &lt;code&gt;healthy&lt;/code&gt; on the next interval.&lt;/p&gt;
&lt;h2 id="puzzle-5-the-crowdsec-log-split"&gt;Puzzle 5: the CrowdSec log split&lt;/h2&gt;
&lt;p&gt;One more. &lt;code&gt;crowdsecurity/caddy-logs&lt;/code&gt; was erroring on every log line with &lt;code&gt;UnmarshalJSON: unexpected end of JSON input&lt;/code&gt;. Cause: my Caddyfile had a single &lt;code&gt;log default&lt;/code&gt; block that captured everything, HTTP access logs, reverse_proxy warnings, tls cache maintenance, admin API chatter, and dumped it all into &lt;code&gt;access.log&lt;/code&gt;. CrowdSec expects that file to be pure HTTP access log JSON. One buffered, partially-flushed runtime line was enough to poison the parser.&lt;/p&gt;
&lt;p&gt;Split the logger:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-caddyfile" data-lang="caddyfile"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;log default {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;output&lt;/span&gt; &lt;span style="color:#e6db74"&gt;file&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;/var/log/caddy/runtime.log&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;exclude&lt;/span&gt; &lt;span style="color:#e6db74"&gt;http.log.access&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;log access {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;include&lt;/span&gt; &lt;span style="color:#e6db74"&gt;http.log.access&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;output&lt;/span&gt; &lt;span style="color:#e6db74"&gt;file&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;/var/log/caddy/access.log&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;format&lt;/span&gt; &lt;span style="color:#e6db74"&gt;json&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then &lt;code&gt;access.log&lt;/code&gt; went empty. Because Caddy doesn&amp;rsquo;t emit HTTP access logs unless a site explicitly asks for them. I have shared &lt;code&gt;(public)&lt;/code&gt; and &lt;code&gt;(gated)&lt;/code&gt; snippets that every site imports, adding &lt;code&gt;log&lt;/code&gt; to each snippet enables access logging for every route for free, and &lt;code&gt;crowdsecurity/caddy-logs&lt;/code&gt; immediately started parsing clean access entries again.&lt;/p&gt;
&lt;h2 id="can-i-actually-see-whats-happening"&gt;Can I actually see what&amp;rsquo;s happening?&lt;/h2&gt;
&lt;p&gt;With the proxy swapped and everything serving, a question I&amp;rsquo;d been half-answering with &lt;code&gt;cscli decisions list&lt;/code&gt; and tailing access.log kept nagging: &lt;em&gt;what&amp;rsquo;s actually hitting my edge, what&amp;rsquo;s getting blocked, is the blocklist doing anything useful?&lt;/em&gt; Fine tools for firefighting. Terrible for pattern recognition.&lt;/p&gt;
&lt;p&gt;The cluster already runs Victoria Metrics and Grafana. Caddy has a native Prometheus endpoint on its admin API once &lt;code&gt;metrics&lt;/code&gt; goes into the &lt;code&gt;servers&lt;/code&gt; block; CrowdSec exposes its own on &lt;code&gt;:6060&lt;/code&gt;. A single &lt;code&gt;vmagent&lt;/code&gt; on the VPS scrapes both and remote-writes to Victoria Metrics in the cluster, the gateway WG tunnel already routes &lt;code&gt;10.43.0.0/16&lt;/code&gt;, so writing to a cluster ClusterIP is free.&lt;/p&gt;
&lt;p&gt;Logs are the other half. Loki runs in single-binary mode in the cluster, Promtail tails &lt;code&gt;access.log&lt;/code&gt; on the VPS and pushes to Loki through the same tunnel. Caddy&amp;rsquo;s access log is JSON with &lt;code&gt;remote_ip&lt;/code&gt;, &lt;code&gt;method&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, &lt;code&gt;uri&lt;/code&gt;, &lt;code&gt;status&lt;/code&gt;, &lt;code&gt;tls&lt;/code&gt;, etc., Loki&amp;rsquo;s &lt;code&gt;| json&lt;/code&gt; pipe turns that into queryable fields at read time without a separate ingest pipeline.&lt;/p&gt;
&lt;p&gt;Ten metric panels and three log panels later, there&amp;rsquo;s a purpose-built dashboard: request rate, latency percentiles, CrowdSec decisions, AppSec rule hits, top source IPs and paths, a live tail. I can now actually answer &lt;em&gt;what should I block&lt;/em&gt;. Or, more usefully, stop pre-blocking and start recognizing the shape of who&amp;rsquo;s showing up.&lt;/p&gt;
&lt;h2 id="the-tidy"&gt;The tidy&lt;/h2&gt;
&lt;p&gt;All that refactoring had left the VPS filesystem a mess I still needed to clean up.&lt;/p&gt;
&lt;p&gt;So: surgery, one directory per compose project.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/opt/
├── authelia/
├── caddy/ # just the CrowdSec API key env for the systemd drop-in
├── crowdsec/ # engine + web-ui + config + GeoLite MMDBs + the refresher script
├── promtail/
├── vmagent/
└── wg-ssh/ # renamed from wg-pangolin-ssh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The WG peer container&amp;rsquo;s old name (&lt;code&gt;wg-pangolin-ssh&lt;/code&gt;) was the most persistent Pangolin-era reference on the box, so that went too. Moved the bind-mounted state, updated the systemd &lt;code&gt;EnvironmentFile&lt;/code&gt; path and the cron entry, restarted. &lt;code&gt;/opt/pangolin/&lt;/code&gt; and &lt;code&gt;/opt/replacement/&lt;/code&gt; both &lt;code&gt;rm -rf&lt;/code&gt;&amp;rsquo;d at the end.&lt;/p&gt;
&lt;h2 id="configs-in-git"&gt;Configs in git&lt;/h2&gt;
&lt;p&gt;Pangolin owned my proxy configs via its admin interface, so they weren&amp;rsquo;t in the repo. With Caddy, the configs are text and go in git:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;edge-gateway/
├── caddy/{Caddyfile,BUILD.txt,caddy.service.d/}
├── authelia/{docker-compose.yml,configuration.yml.tpl,build-config.sh}
├── crowdsec/{docker-compose.yml,acquis-*.yaml,update-geolite-db.sh}
├── wg-ssh/docker-compose.yml
├── vmagent/{docker-compose.yml,config/}
└── promtail/{docker-compose.yml,config/}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The Caddy binary isn&amp;rsquo;t tracked (reproducible from the module list in &lt;code&gt;BUILD.txt&lt;/code&gt;). Runtime state (SQLite databases, ACME cert storage) isn&amp;rsquo;t. Secret provisioning is documented outside the repo.&lt;/p&gt;
&lt;h2 id="merging-the-tunnel-pods"&gt;Merging the tunnel pods&lt;/h2&gt;
&lt;p&gt;Two pangolin-ish strings still in the repo: &lt;code&gt;ns/pangolin-ssh/&lt;/code&gt; (the SSH tunnel peer) and &lt;code&gt;ns/pangolin-gateway/&lt;/code&gt; (the Service-CIDR tunnel peer). Both were &amp;ldquo;WG client to the edge gateway with forwarding rules&amp;rdquo;, close enough that one pod could do both. Merged into &lt;code&gt;ns/edge-gateway/&lt;/code&gt;, one &lt;code&gt;wg-quick up&lt;/code&gt;, iptables forwards from the gateway side, socat forwarding the SSH port through the tunnel from the SSH side. SealedSecrets are bound to &lt;code&gt;{namespace, name}&lt;/code&gt;, so I pulled the plain &lt;code&gt;wg0.conf&lt;/code&gt; out of the old namespace with &lt;code&gt;kubectl get secret&lt;/code&gt; and re-sealed it for the new one.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/fosrl/pangolin"&gt;Pangolin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/fosrl/newt"&gt;Newt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/wg-easy/wg-easy"&gt;wg-easy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/coredns/helm"&gt;CoreDNS Helm chart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kubernetes.io/docs/reference/using-api/server-side-apply/"&gt;Kubernetes Server-Side Apply&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://caddyserver.com/"&gt;Caddy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mholt/caddy-l4"&gt;caddy-l4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/hslatman/caddy-crowdsec-bouncer"&gt;caddy-crowdsec-bouncer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/caddyserver/xcaddy"&gt;xcaddy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.authelia.com/"&gt;Authelia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.crowdsec.net/"&gt;CrowdSec&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.cilium.io/en/stable/network/kubernetes/kubeproxy-free/"&gt;Cilium kube-proxy replacement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.victoriametrics.com/vmagent/"&gt;Victoria Metrics vmagent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://grafana.com/oss/loki/"&gt;Grafana Loki&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://grafana.com/docs/loki/latest/send-data/promtail/"&gt;Promtail&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Managing dev secrets with pass</title><pubDate>Fri, 10 Apr 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/managing-dev-secrets-with-pass/</guid><description>&lt;p&gt;I had credentials hardcoded in my Go project&amp;rsquo;s config, with defaults baked right into the binary. The LDAP admin password was sitting in &lt;code&gt;config.go&lt;/code&gt; for anyone to read. Not great, even for a personal project. Here&amp;rsquo;s how I replaced that with &lt;code&gt;pass&lt;/code&gt;, the standard Unix password manager.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;func&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Load&lt;/span&gt;() &lt;span style="color:#f92672"&gt;*&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;Config&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;Config&lt;/span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;LdapPassword&lt;/span&gt;: &lt;span style="color:#a6e22e"&gt;getEnv&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;LDAP_PASSWORD&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;lt;some secret value&amp;gt;&amp;#34;&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That default value ends up in git history, container images, and the compiled binary. The env var override exists but nobody uses it because the default just works.&lt;/p&gt;
&lt;h2 id="setting-up-pass"&gt;Setting up pass&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;pass&lt;/code&gt; stores passwords as GPG-encrypted files under &lt;code&gt;~/.password-store/&lt;/code&gt;. It needs a GPG key to encrypt with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;gpg --gen-key
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pass init &amp;lt;email&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then store the secret:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pass generate --no-symbols myproject/ldap-password &lt;span style="color:#ae81ff"&gt;32&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;--no-symbols&lt;/code&gt; flag avoids shell escaping headaches with characters like &lt;code&gt;'&lt;/code&gt;, &lt;code&gt;{&lt;/code&gt;, and &lt;code&gt;&amp;amp;&lt;/code&gt; in env vars.&lt;/p&gt;
&lt;h2 id="wiring-it-into-a-project"&gt;Wiring it into a project&lt;/h2&gt;
&lt;p&gt;The config now requires the env var to be set, no fallback:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;func&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;requireEnv&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;env&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;string&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;string&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;v&lt;/span&gt; &lt;span style="color:#f92672"&gt;:=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;os&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Getenv&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;env&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;v&lt;/span&gt; &lt;span style="color:#f92672"&gt;==&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;log&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Fatalf&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;Required environment variable %s is not set&amp;#34;&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;env&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;v&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A &lt;code&gt;.env&lt;/code&gt; file (gitignored) holds the actual values, and Docker Compose picks it up automatically. The &lt;code&gt;justfile&lt;/code&gt; generates it from &lt;code&gt;pass&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-just" data-lang="just"&gt;env:
@pass show myproject/ldap-password &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 || pass generate --no-symbols myproject/ldap-password 32
@echo &amp;#34;LDAP_PASSWORD=$(pass myproject/ldap-password)&amp;#34; &amp;gt; .env
@echo &amp;#34;.env written&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This creates the password if it doesn&amp;rsquo;t exist yet, so a fresh clone just needs &lt;code&gt;just env&lt;/code&gt; to get going.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;docker-compose.yml&lt;/code&gt;, both the app and the LDAP server reference the same variable:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;services&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;app&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;environment&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#ae81ff"&gt;LDAP_PASSWORD=${LDAP_PASSWORD}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;lldap&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;environment&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#ae81ff"&gt;LLDAP_LDAP_USER_PASS=${LDAP_PASSWORD}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="syncing-across-machines"&gt;Syncing across machines&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;pass&lt;/code&gt; has built-in git support:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pass git init
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pass git remote add origin ssh://git@git.example.com/user/password-store.git
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pass git push -u origin main
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Every &lt;code&gt;pass insert&lt;/code&gt; or &lt;code&gt;pass generate&lt;/code&gt; auto-commits, but doesn&amp;rsquo;t push. To sync automatically, add a &lt;code&gt;post-commit&lt;/code&gt; hook:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cat &amp;gt; ~/.password-store/.git/hooks/post-commit &lt;span style="color:#e6db74"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;#!/bin/sh
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;git pull --rebase &amp;amp;&amp;amp; git push
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;chmod +x ~/.password-store/.git/hooks/post-commit
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now every &lt;code&gt;pass&lt;/code&gt; operation will pull any remote changes and push the new commit.&lt;/p&gt;
&lt;p&gt;On a new machine, clone the repo into &lt;code&gt;~/.password-store/&lt;/code&gt; and import the GPG key:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;gpg --import private-key.asc
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;gpg --edit-key &amp;lt;email&amp;gt; &lt;span style="color:#75715e"&gt;# trust -&amp;gt; 5 (ultimate)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I keep the GPG private key backed up in my password manager, and the password store in a private git repo. The encrypted files are safe to push since they&amp;rsquo;re useless without the GPG key.&lt;/p&gt;
&lt;h2 id="the-result"&gt;The result&lt;/h2&gt;
&lt;p&gt;No more secrets in source code. Run &lt;code&gt;just env&lt;/code&gt; to pull secrets from &lt;code&gt;pass&lt;/code&gt; into &lt;code&gt;.env&lt;/code&gt;, then &lt;code&gt;docker compose up&lt;/code&gt; picks them up and injects them into containers. The app refuses to start without them. New machines just need &lt;code&gt;pass&lt;/code&gt; initialized with the GPG key and a &lt;code&gt;git clone&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="references"&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.passwordstore.org/"&gt;pass - The Standard Unix Password Manager&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wiki.archlinux.org/title/Pass"&gt;pass - ArchWiki&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gnupg.org/"&gt;GnuPG&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://just.systems/"&gt;just - A command runner&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/compose/how-tos/environment-variables/"&gt;Docker Compose environment variables&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Headscale out and WireGuard Easy in</title><pubDate>Thu, 12 Mar 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/headscale-out-and-wireguard-easy-in/</guid><description>&lt;p&gt;I&amp;rsquo;ve been running Headscale for a while to access my home network remotely. It worked, but came with friction: Tailscale clients on every device, MagicDNS quirks, and a particularly annoying bug where DNS breaks when using an exit node on Android. After chasing that issue through multiple workarounds, I decided to simplify.&lt;/p&gt;
&lt;h2 id="the-setup"&gt;The setup&lt;/h2&gt;
&lt;p&gt;I replaced Headscale with two WireGuard Easy instances running on my K3s cluster:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Mullvad tunnel&lt;/strong&gt; (port 51831): for routing all traffic (&lt;code&gt;0.0.0.0/0&lt;/code&gt;) through Mullvad VPN. This one runs wg-easy with a gluetun sidecar that manages the Mullvad WireGuard connection. This is the primary profile on my phones since Android only allows one active VPN at a time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LAN-only&lt;/strong&gt; (port 51830): for accessing &lt;code&gt;192.168.86.0/24&lt;/code&gt; when I&amp;rsquo;m away from home. AllowedIPs is set to just the LAN subnet. I switch to this one when something isn&amp;rsquo;t reachable through the Mullvad tunnel.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;On Android, switching between the two profiles is one tap. No Tailscale client needed, no MagicDNS, no exit node bugs.&lt;/p&gt;
&lt;p&gt;On my Linux machines, I import the configs that wg-easy generates through NetworkManager. I rename the downloaded config to match the interface name I want (e.g. &lt;code&gt;wg_lan.conf&lt;/code&gt; or &lt;code&gt;wg_mullvad.conf&lt;/code&gt;) and import it with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;nmcli connection import type wireguard file wg_lan.conf
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This creates a NetworkManager connection named after the file. From there I can bring it up and down with &lt;code&gt;nmcli connection up wg_lan&lt;/code&gt; or through the network manager applet. Same two-profile setup as on Android -one for LAN access, one for Mullvad.&lt;/p&gt;
&lt;h2 id="gluetun-sidecar"&gt;Gluetun sidecar&lt;/h2&gt;
&lt;p&gt;The Mullvad instance uses gluetun as a sidecar container. Gluetun connects to Mullvad via WireGuard and manages the firewall. The wg-easy container shares the network namespace, so all its traffic can be routed through gluetun&amp;rsquo;s &lt;code&gt;tun0&lt;/code&gt; interface.&lt;/p&gt;
&lt;p&gt;The deployment looks roughly like this:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Phone → wg0 (wg-easy) → tun0 (gluetun) → Mullvad → Internet
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Gluetun handles the VPN connection, firewall rules, and health checks. I set &lt;code&gt;FIREWALL_INPUT_PORTS&lt;/code&gt; to allow the WireGuard and web UI ports, and &lt;code&gt;FIREWALL_OUTBOUND_SUBNETS&lt;/code&gt; to &lt;code&gt;192.168.86.0/24&lt;/code&gt; so LAN traffic bypasses the tunnel.&lt;/p&gt;
&lt;h2 id="the-routing-puzzle"&gt;The routing puzzle&lt;/h2&gt;
&lt;p&gt;My knowledge of iptables and policy routing is limited, so I leaned on Claude to work through this part. Getting packets from wg0 to tun0 and back required three ip policy rules:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# LAN traffic from wg clients goes direct, not through the tunnel&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ip rule add from 10.8.0.0/24 to 192.168.86.0/24 lookup main priority &lt;span style="color:#ae81ff"&gt;94&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# All other wg client traffic routes to tun0 (Mullvad)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ip rule add from 10.8.0.0/24 lookup &lt;span style="color:#ae81ff"&gt;51820&lt;/span&gt; priority &lt;span style="color:#ae81ff"&gt;95&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Return traffic from tun0 routes back to wg0, not back into the tunnel&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ip rule add to 10.8.0.0/24 lookup main priority &lt;span style="color:#ae81ff"&gt;96&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The last rule was the hardest to find, and Claude had to explain this multiple times before I understood it (somewhat). Without it, gluetun&amp;rsquo;s catch-all rule (&lt;code&gt;not fwmark 0xca6c lookup 51820&lt;/code&gt;) sends return traffic back into tun0 instead of forwarding it to wg0. Packets go out but never come back, a routing loop that&amp;rsquo;s invisible unless you&amp;rsquo;re counting iptables matches.&lt;/p&gt;
&lt;h2 id="iptables-legacy-vs-iptables-nft"&gt;iptables-legacy vs iptables-nft&lt;/h2&gt;
&lt;p&gt;wg-easy uses &lt;code&gt;iptables-legacy&lt;/code&gt; for its PostUp rules. Gluetun uses &lt;code&gt;iptables-nft&lt;/code&gt;. Both backends share the kernel&amp;rsquo;s conntrack, but having MASQUERADE and FORWARD rules split across two table systems is a recipe for confusion. The solution: flush all of wg-easy&amp;rsquo;s legacy rules in a postStart hook and let gluetun&amp;rsquo;s nft rules handle everything. A ConfigMap provides the forwarding and NAT rules via gluetun&amp;rsquo;s &lt;code&gt;/iptables/post-rules.txt&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;iptables -A FORWARD -i wg0 -o tun0 -j ACCEPT
iptables -A FORWARD -i tun0 -o wg0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wg0 -d 192.168.86.0/24 -j ACCEPT
iptables -A FORWARD -o wg0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o tun0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -d 192.168.86.0/24 -j MASQUERADE
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="the-result"&gt;The result&lt;/h2&gt;
&lt;p&gt;On Android the WireGuard app is lighter than Tailscale, and on Linux the configs slot right into NetworkManager. Switching profiles is instant on both, and there&amp;rsquo;s no dependency on a coordination server. DNS just works because the WireGuard config points directly at my AdGuard Home instance.&lt;/p&gt;
&lt;p&gt;The whole thing is about 200 lines of YAML managed by ArgoCD. Compared to Headscale + Tailscale clients + exit node workarounds, it&amp;rsquo;s a significant reduction in moving parts. Even if I now have 2 wg-easy deployments.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/qdm12/gluetun"&gt;gluetun - VPN client in a thin Docker container&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/wg-easy/wg-easy"&gt;wg-easy - Easy WireGuard VPN server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mullvad.net/"&gt;Mullvad VPN&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Migrating to Pangolin</title><pubDate>Fri, 06 Mar 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/migrating-to-pangolin/</guid><description>&lt;p&gt;For a while I&amp;rsquo;ve been struggling with my dynamic IP, lack of IPv6, and blocked ports from my ISP. I decided to invest in a small VPS to work around these limitations. The VPS runs Pangolin, an identity-aware reverse proxy that tunnels traffic to services running elsewhere.&lt;/p&gt;
&lt;h2 id="setting-up-pangolin"&gt;Setting up Pangolin&lt;/h2&gt;
&lt;p&gt;I set up a Hetzner VPS with Debian, SSH&amp;rsquo;d in and started installing Pangolin. The installation script required some manual steps I didn&amp;rsquo;t expect: I had to install Docker and Docker Compose separately before running it.&lt;/p&gt;
&lt;p&gt;On the cluster side, I deployed Newt, Pangolin&amp;rsquo;s tunnel agent. It establishes an outbound connection from the cluster to the VPS, allowing Pangolin to route HTTP(S), TCP, and UDP traffic back to services on the cluster. After configuring DNS and HTTPS via Let&amp;rsquo;s Encrypt, everything was accessible through the VPS.&lt;/p&gt;
&lt;p&gt;This let me remove my edge ingress controller, the external-dns instance I had for it, and a bunch of ingress resources. It trades one type of complexity for another, but the result is cleaner.&lt;/p&gt;
&lt;h2 id="crowdsec"&gt;CrowdSec&lt;/h2&gt;
&lt;p&gt;The Pangolin installer includes CrowdSec, so I followed the community guide to configure it. The guide needed some adjustments: the Traefik bouncer plugin wasn&amp;rsquo;t registered in the static config by default, and the AppSec component required an additional acquisition config file to actually start listening.&lt;/p&gt;
&lt;p&gt;CrowdSec now protects both web traffic (via a Traefik middleware that shows a ban page) and the host itself (via a firewall bouncer on iptables), covering SSH, mail, and all other exposed ports.&lt;/p&gt;
&lt;p&gt;Overall the setup feels more secure. My local ISP no longer has any ports opened, and the ports exposed through Pangolin are better protected than before. It was a bit rough to set up, but worth it.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/fosrl/pangolin"&gt;Pangolin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/fosrl/newt"&gt;Newt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.hetzner.com/"&gt;Hetzner&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://letsencrypt.org/"&gt;Let&amp;rsquo;s Encrypt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/kubernetes-sigs/external-dns"&gt;external-dns&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/kubernetes/ingress-nginx"&gt;ingress-nginx&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.crowdsec.net/"&gt;CrowdSec&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Another day of CalDAV</title><pubDate>Mon, 02 Mar 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/another-day-of-caldav/</guid><description>&lt;p&gt;Continuing my efforts on a DAV-server, coded by Claude. Another attempt at journaling my experiences with this project. I managed to get a web UI running and added features there to help users migrate to the service.&lt;/p&gt;
&lt;p&gt;Optimized sessions, the hashing of passwords (to verify logins) is a bit slow. It probably doesn&amp;rsquo;t help that Rasberry Pi&amp;rsquo;s aren&amp;rsquo;t so powerful. So I optimized it by introducing a caching layer. This stores a key in memory based on the basic authentication, which gets invalidated when the user password changes.&lt;/p&gt;
&lt;p&gt;Implemented iMIP, Internet Message-based Interoperability Protocol (RFC 6047). It&amp;rsquo;s the standard for sending calendar invitations via email, built on top of iTIP (RFC 5546) which defines the scheduling semantics (REQUEST, REPLY, CANCEL, etc.).&lt;/p&gt;
&lt;p&gt;The frontend was generated with a-h/templ, htmx, and pico.css. It allows for management of calendars, address books, account settings, and app passwords. Claude confabulated (hallucinated) some features regarding the account/profile name which I asked it to remove.&lt;/p&gt;
&lt;p&gt;Worked on a bug where the organizer also got an invitation email for the event they created. Still had to beg for tests here.&lt;/p&gt;
&lt;p&gt;I noticed that linting wasn&amp;rsquo;t being done. I set up &lt;code&gt;golangci-lint&lt;/code&gt; to help Claude keep the code more strict. This exposed some dead code which Claude removed, but it also added a ton of &lt;code&gt;//nolint:errcheck&lt;/code&gt; comments as a quick fix. After pointing out that silencing linter warnings wasn&amp;rsquo;t ideal, it reworked those into &lt;code&gt;_ =&lt;/code&gt; assignments, justified with &amp;rsquo;the error is guaranteed to be nil'.&lt;/p&gt;
&lt;p&gt;After a while I personally checked the structure of the project and noticed that some packages were placed outside &lt;code&gt;internal&lt;/code&gt; directory. It looks like the directory structure looks a lot like the &lt;code&gt;golang-standards/project-layout&lt;/code&gt; definition. This is what the directories looked like:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;├── admin
├── api
├── caldav
├── carddav
├── cmd
│ └── neodav
├── docs
├── internal
│ ├── auth
│ ├── config
│ ├── etag
│ ├── imappoller
│ ├── itip
│ ├── logging
│ ├── mailer
│ ├── middleware
│ ├── props
│ ├── scheduler
│ ├── storage
│ ├── synctoken
│ └── user
└── web
├── session
├── static
└── templates
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Notably, &lt;code&gt;admin&lt;/code&gt;, &lt;code&gt;api&lt;/code&gt;, &lt;code&gt;caldav&lt;/code&gt;, &lt;code&gt;carddav&lt;/code&gt; seem to be misplaced, so I let Claude clean that up by moving them into &lt;code&gt;internal&lt;/code&gt;, like Claude described:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cmd/neodav/
internal/
auth/ config/ storage/ middleware/
user/ etag/ synctoken/ props/
logging/ mailer/ scheduler/ imappoller/ itip/
caldav/ ← move
carddav/ ← move
admin/ ← move
api/ ← move
web/ ← stays
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After that cleanup, I wanted an import and export feature, so I could actually migrate to (and from) this service. Claude went on its way to plan and eventually implement the feature until it thought it was done. It forgot to add tests again, so I reminded it. After deploying the new release I tried import my contacts and my calendar. Noticing that the styling was a bit off, e.g., buttons had the wrong size.&lt;/p&gt;
&lt;p&gt;I imported the contacts without issue. Then I headed into DAVx5 and tried to sync the contacts, this however didn&amp;rsquo;t work. Contacts were not synced to the device. Claude was adamant the issue was because DAVx5 needed more time to sync, so I waited an hour. This yielded no result, but Claude was very confident it was DAVx5. So I kept adjusting settings there until I had enough. Eventually I convinced Claude, however confident it was, that it could be the code it generated.&lt;/p&gt;
&lt;p&gt;Claude checked the PROPFIND code for the CardDAV endpoint and discovered that there was a bug. There were duplicate propstat blocks with both 404 and 200 status codes for the same properties, which violates the WebDAV spec and confuses clients like DAVx5. I asked Claude to fix it and write a test for it. This fixed something, but the result in DAVx5 was the same. Even a trailing slash issue hit the application at some point. There was stuff incorrect with a sync-token/collection. A few more cycles of fixing problems, taking &lt;em&gt;several frustrating hours&lt;/em&gt;, DAVx5 was eventually able to load some contacts from the service.&lt;/p&gt;
&lt;p&gt;Eventually I checked out the DAVx5 repo and had Claude investigate that, check the contacts I exported from Google. This prompts it that there are missing FN fields, card images are stored remotely. It added a repair and download feature into the import. Eventually, I got it up and running with DAVx5.&lt;/p&gt;
&lt;p&gt;At this stage the project seems pretty functional for daily use. The DAVx5 saga was a good reminder that protocol compliance issues are subtle. A server can feel like it&amp;rsquo;s working until a strict client proves otherwise. I&amp;rsquo;ll run it as my daily driver for a while and see what surfaces next.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://datatracker.ietf.org/doc/html/rfc6047"&gt;RFC 6047 - iMIP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://datatracker.ietf.org/doc/html/rfc5546"&gt;RFC 5546 - iTIP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/golang-standards/project-layout"&gt;Go project-layout&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://golangci-lint.run/"&gt;golangci-lint&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://htmx.org/"&gt;htmx&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://templ.guide/"&gt;templ&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://picocss.com/"&gt;Pico CSS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Deplatforming My Calendar: Building CalDAV with Claude Code</title><pubDate>Sat, 28 Feb 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/more-claude-coding-caldav-carddav-service/</guid><description>&lt;p&gt;I&amp;rsquo;ve been degoogling for a while and noticed I stepped by going to Proton from one walled garden into another. I use Proton&amp;rsquo;s mail and calendar these days. And even though I like the Proton products, I can&amp;rsquo;t say I&amp;rsquo;m a fan of having no access to my data outside their products. This led me to Proton Bridge, which at least offers IMAP/SMTP for their services, but no calendar/contacts. In a chat with one of my friends I figured this would be neat to vibe code (or at least heavily-assisted LLM coding). This is my attempt at journaling the process and findings.&lt;/p&gt;
&lt;h2 id="getting-started"&gt;Getting started&lt;/h2&gt;
&lt;p&gt;Before I let Claude do its thing I figured I should take note of some requirements. This was the first file of the repository, named &lt;code&gt;REQUIREMENTS.md&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# Features
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;-&lt;/span&gt; CalDAV support
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;-&lt;/span&gt; CardDAV support
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;-&lt;/span&gt; API for managing users, calendars, address books
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;-&lt;/span&gt; UNIX philosophy
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# Technical
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;-&lt;/span&gt; Golang
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;-&lt;/span&gt; go-chi
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;-&lt;/span&gt; zerolog
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;-&lt;/span&gt; works with DAVx5
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;-&lt;/span&gt; file based, no database
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I then prompted it to gather more requirements, seeing what I would like and what not. I specifically specified to do online research here. After a few minutes of going back and forth with Claude I ended up with a much larger file describing the architecture, the features for: CalDAV, CardDAV, sharing and permissions, authentication, storage, configuration, logging, observability, testing, out of scope, admin interface, and the technology stack.&lt;/p&gt;
&lt;h2 id="improving-the-scope-of-the-project"&gt;Improving the scope of the project&lt;/h2&gt;
&lt;p&gt;This would be enough to get started, but I felt insecure in relation to how secure this would end up becoming. This prompted me to generate some additional documents. I let Claude generate several documents from different perspectives for me (information security, software engineering, testing, etc.). This led Claude to spawn a couple of sub-agents which then generated: ARCHITECTURE.md, OPERATIONS.md, REQUIREMENTS.md, RFC-COMPLIANCE.md, and SECURITY.md.&lt;/p&gt;
&lt;p&gt;The architecture describes the general layout of the project. It shows which packages should be created, and what the goal of those packages is. The general API is laid out, including health checks and addition DAV-related paths. An example of a configuration TOML is included. The data model of the application is shown, and &amp;lsquo;decisions&amp;rsquo; are recorded. This goes on for a while, including migrations, building, error handling, testing, interfaces, etc.&lt;/p&gt;
&lt;p&gt;The operations document goes in depth into how set up, backup, maintain the application. And looking back as I write this, seems to quite miss the mark.&lt;/p&gt;
&lt;p&gt;The RFC-compliance document contains a table of project-related RFC&amp;rsquo;s. Claude generated priorities per RFC, and I believe this eventually helps keeping the development on track when the features become more complex.&lt;/p&gt;
&lt;p&gt;The final document is the security document and this highlighted some issues in the original design. One of the issues was that CalDAV works with basic authentication, which should definitely not be used on non-TLS connections, another was that using reverse proxy headers could also expose the service to attackers hijacking the headers, path traversal in the file system storage (e.g., using relative paths). Which triggered me to have the documents be updated based on its finding. It made a prioritized list of security-related topics, which I think helps with the overall development and (hopefully) actual security of the app.&lt;/p&gt;
&lt;h2 id="doing-the-work-the-broad-strokes-at-least"&gt;Doing the work, the broad strokes at least&lt;/h2&gt;
&lt;p&gt;Now that all the initial documentation was set up, it was time for Claude to start working on the implementation. It suggested to start with what it called the project scaffold. It ran for a while, downloaded some planned dependencies, creating the directory structure, packages, and initial command to start the app. This is where Claude came back to me, asking me to decide what to do next.&lt;/p&gt;
&lt;p&gt;I prompted it figure out what would make the most sense. It then started working on implementing CalDAV, and after that CardDAV. It took multiple interactions, stopping it from endlessly searching &lt;code&gt;~/.cache/go&lt;/code&gt; for more information on packages it had just downloaded itself. I also continuously had to beg for it to create tests for the code it generated.&lt;/p&gt;
&lt;p&gt;This process of Claude eventually stopping and asking me to tell it what to do led me to something that seemed like it could work. There was an API, CalDAV and CardDAV routes, and a CLI interface. But it hadn&amp;rsquo;t taken into account that I wanted to host this on Kubernetes. So after a bit of fussing I got it set up on my cluster and was able to do some requests.&lt;/p&gt;
&lt;h2 id="integrating-with-the-real-world"&gt;Integrating with the real world&lt;/h2&gt;
&lt;p&gt;After a while I decided I would like to test it for real. So I took out my phone, loaded up DAVx5 and attempted to connect. This failed right away because the basic authentication was enabled for all HTTP routes. After some tweaking I got a step further, discovering that even though I support non-email usernames it could lead to issues when I would invite people to my calendar events.&lt;/p&gt;
&lt;p&gt;After that fix, DAVx5 showed that the calendar and contacts could be loaded from my service. So that was good! Except, I didn&amp;rsquo;t have an app that could read the calendar data. I tried out Fossify Calendar, but that didn&amp;rsquo;t have an option to add guests to the calendar events. So I opted for Etar. &lt;strong&gt;UPDATE: I thought Fossify Calendar didn&amp;rsquo;t have that feature, but I was using it wrong. The local calendar doesn&amp;rsquo;t support it, but synced calendars do support adding attendees.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;After installing Etar, I could create events without issue. Then I figured I could use Google Contacts (which I already had installed) to create users in the address book that DAVx5 arranged for my phone.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;All in all I was amazed how well Claude developed the features I asked for. I still mostly worry about security and maintainability. It took me a whole day to get to this point, which somehow feels like it took longer than I would expect. There was still a lot of hand-holding with Claude, but that could be my controlling personality. Coding like this feels more exhausting than doing it myself, hopefully I&amp;rsquo;ll get used to it more.&lt;/p&gt;
&lt;h2 id="whats-next"&gt;What&amp;rsquo;s next&lt;/h2&gt;
&lt;p&gt;In the coming period I&amp;rsquo;m planning to implement more of the API, a user-facing website to manage passwords, calendars and address books, an admin user interface, and sending guests invitation mails. After that I might open source the project to see what others think of it.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/ProtonMail/proton-bridge"&gt;Proton Mail Bridge&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/anthropics/claude-code"&gt;Claude Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.davx5.com/"&gt;DAVx5&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Etar-Group/Etar-Calendar"&gt;Etar Calendar&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/FossifyOrg/Calendar"&gt;Fossify Calendar&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Degoogling Find My Device and notifications</title><pubDate>Tue, 24 Feb 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/degoogling-find-my-device-and-notifications/</guid><description>&lt;p&gt;Degoogling has been a bit of a mission for me for a while now, which unfortunately means making sacrifices. Notifications and find-my-phone, for example, tend to be deeply tied to the Google ecosystem. However, the open source community has devised solutions. Better yet, it took less than an hour to set up.&lt;/p&gt;
&lt;h2 id="notifications"&gt;Notifications&lt;/h2&gt;
&lt;p&gt;I assume that Google created Google Play Services, probably among many other reasons, to improve the battery life of mobile devices. Offloading aggregation of notifications, and only having to maintain a single connection to receive notifications surely drains the battery less than having multiple connections polling or receiving notifications. But this comes with the privacy-related drawback that Google is aware of at least part of the notifications the device is getting. This has been a well-known fact in the privacy community, and I think it makes perfect sense to have notifications decentralized, which led me to UnifiedPush.&lt;/p&gt;
&lt;p&gt;UnifiedPush is a project that defines an open standard for decentralized push notifications. It (still) requires a server in the middle, but since it can be self-hosted, you&amp;rsquo;re the man in the middle. The server receives the notifications and pushes them to a notification client (like a phone).&lt;/p&gt;
&lt;p&gt;I easily set up &lt;em&gt;ntfy&lt;/em&gt; on my cluster and installed the Android client on my phone. This required some additional steps because the notification service defaults to a public, shared URL. Changing that to my own server created a truly private place for my notifications. Setting up ntfy for notifications gave me a second degoogled service almost for free: Find My Device.&lt;/p&gt;
&lt;h2 id="find-my-device"&gt;Find My Device&lt;/h2&gt;
&lt;p&gt;Google offers a find-my-phone feature on their platform. Not very private at all. This is where &lt;em&gt;FMD&lt;/em&gt; is recommended online. It comes with a bunch of features, like making the device ring, flashing the torchlight, showing the device&amp;rsquo;s GPS and/or cell tower location, remote factory reset, and more.&lt;/p&gt;
&lt;p&gt;Setup on the cluster was very easy, and registration from the Android app is a breeze. To get the features from the FMD server working properly, UnifiedPush is required. The app detects &lt;em&gt;ntfy&lt;/em&gt; automatically and generates a notifications topic to send commands through.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gitlab.com/fmd-foss/fmd-android"&gt;FMD Android&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ntfy.sh/"&gt;ntfy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://unifiedpush.org/"&gt;UnifiedPush&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Getting rid of Onlink's graphical glitches on Linux</title><pubDate>Sun, 18 Jan 2026 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/blog-onlink-mod-for-uplink/</guid><description>&lt;p&gt;I discovered that setting the &lt;code&gt;LIBGL_ALWAYS_SOFTWARE=1&lt;/code&gt; environment variable in Steam&amp;rsquo;s launch options completely eliminates the graphical glitches that plagued the Onlink mod for Uplink on Linux. After struggling with libsdl issues and Wine rendering problems, this fix made Onlink work without graphical glitches.&lt;/p&gt;
&lt;p&gt;The mod is supposed to run natively on Linux, but many users hit issues with dependencies or weird artifacts when running the Windows version through Wine. The software rendering approach bypasses these hardware acceleration issues entirely.&lt;/p&gt;
&lt;h2 id="setup-onlink"&gt;Setup Onlink&lt;/h2&gt;
&lt;p&gt;Download the Linux version and extract both &lt;code&gt;data.dat&lt;/code&gt; and &lt;code&gt;onlink&lt;/code&gt; to the Uplink directory. Make the executable runnable with &lt;code&gt;chmod +x onlink&lt;/code&gt;, then edit &lt;code&gt;run_steam.sh&lt;/code&gt; to point to &lt;code&gt;./onlink&lt;/code&gt; instead of &lt;code&gt;./uplink.bin.x86&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In Steam&amp;rsquo;s launch options, add:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;LIBGL_ALWAYS_SOFTWARE=1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It&amp;rsquo;s working when the title screen shows &amp;ldquo;Onlink&amp;rdquo; without glitches. The performance impact is negligible since Uplink isn&amp;rsquo;t graphically demanding, but the compatibility improvement is huge.&lt;/p&gt;
&lt;h2 id="references"&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://steamcommunity.com/app/1510/discussions/0/600772666094287867/"&gt;Steam Community Discussion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://forums.introversion.co.uk/viewtopic.php?t=62789"&gt;Introversion Forums Download&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ferrousmoon.com/onlink.tar.gz"&gt;Linux Download (0.2.5)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ferrousmoon.com/onlink-0.2.6-b1.tar.gz"&gt;Linux Download (0.2.6-b1)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.ferrousmoon.com/wiki/index.php/Onlink_guide"&gt;Onlink Wiki (archived)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>From Seafile to copyparty</title><pubDate>Tue, 02 Dec 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/switching-from-seafile-to-copyparty/</guid><description>&lt;p&gt;For years, Seafile was my go-to solution for file hosting. It all started when I got sick of Google&amp;rsquo;s ecosystem. I wanted a solution that would offer me a neat (enough) user interface. Seafile works pretty well, and it&amp;rsquo;s quite easy to set up, but it has some downsides, which led me to leave it for alternatives.&lt;/p&gt;
&lt;p&gt;My beef with Seafile is that it stores its data in a custom storage format, making me dependent on whatever Seafile offers for interfacing with my files. There&amp;rsquo;s also the issue that I had Seafile&amp;rsquo;s libraries get corrupted because of a system reboot (I&amp;rsquo;m not completely sure what caused the issue, to be honest). So I had some specific requirements: just a regular filesystem and a bunch of ways to integrate with it.&lt;/p&gt;
&lt;p&gt;Those requirements led me to copyparty, which does not look great at all. However, it does offer direct access to files without requiring some kind of interpreter. It offers WebDAV for integrating with it remotely (yes, Seafile does this too, but it feels tacked on). What I also like is that it is pretty fast.&lt;/p&gt;
&lt;p&gt;Now, for that copyparty frontend, that&amp;rsquo;s not something I have gotten used to (yet). So I looked around for an alternative frontend. A WebDAV-powered frontend seemed to make the most sense to me. This is where I found Filestash, which can be the frontend for a bunch of backends, including WebDAV, but S3, FTP, Git, and more are supported as well. It has a nice feature where the authentication can be passed through to the backend, keeping the frontend really simple.&lt;/p&gt;
&lt;p&gt;The Filestash + copyparty combo might not be the prettiest, but it gives me something Seafile didn&amp;rsquo;t: independence regarding my files. My files sit on a normal filesystem, accessible through multiple protocols. If copyparty dies tomorrow, my data isn&amp;rsquo;t trapped. That is worth living with a less polished interface. For self-hosting, that matters more than it should. Once you&amp;rsquo;ve experienced data corruption and/or felt the weight of vendor dependency, a plain filesystem starts looking pretty beautiful.&lt;/p&gt;
&lt;h2 id="references"&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/9001/copyparty"&gt;copyparty&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mickael-kerjean/filestash"&gt;Filestash&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Opening links in several different browsers</title><pubDate>Wed, 26 Nov 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/opening-links-in-several-different-browsers/</guid><description>&lt;p&gt;Some websites don&amp;rsquo;t seem to work in Firefox, like GitLab. I just can&amp;rsquo;t log in to it anymore because Cloudflare is stuck in a perpetual loop of checking whether I&amp;rsquo;m human. So I&amp;rsquo;ve had to resort to using Chromium for GitLab. As an avid keyboard enthusiast, I had to undertake several extra steps to open a link in the right browser, but with &lt;code&gt;mimeo&lt;/code&gt; (together with &lt;code&gt;xdg-utils-mimeo&lt;/code&gt;) I solved it.&lt;/p&gt;
&lt;p&gt;After installing, I created &lt;code&gt;~/.config/mimeo/associations.txt&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/usr/bin/chromium %U
^https?://(www\.)?gitlab\.com(/.*|$)
/usr/bin/firefox -P personal %U
^https?://(.*\.)?sng\.rs(/.*|$)
/usr/bin/firefox -P work %U
^https?://
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note that the rule order matters, as soon as a match is found it will be executed.&lt;/p&gt;
&lt;p&gt;Now to check whether this works (&lt;code&gt;--command&lt;/code&gt; or &lt;code&gt;-c&lt;/code&gt; to print the command that would be executed):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ mimeo -c &lt;span style="color:#e6db74"&gt;&amp;#34;https://gitlab.com&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;/usr/bin/chromium https://gitlab.com
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ mimeo -c &lt;span style="color:#e6db74"&gt;&amp;#34;https://sng.rs&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;/usr/bin/firefox -P personal https://sng.rs
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ mimeo -c &lt;span style="color:#e6db74"&gt;&amp;#34;https://wiki.archlinux.org&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;/usr/bin/firefox -P work https://wiki.archlinux.org
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now &lt;code&gt;xdg-open&lt;/code&gt; will open links in the specified browser using this setup, thanks to &lt;code&gt;xdg-utils-mimeo&lt;/code&gt;, which patches the tools to make use of &lt;code&gt;mimeo&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="references"&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://xyne.dev/projects/mimeo/"&gt;mimeo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aur.archlinux.org/packages/xdg-utils-mimeo"&gt;xdg-utils-mimeo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Claude Code and Dragons</title><pubDate>Mon, 27 Oct 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/claude-code-and-dragons/</guid><description>&lt;p&gt;In the past, I&amp;rsquo;ve used Claude Code with mixed results. The tool has improved a great deal in the meantime. I still prefer developing the most essential functionalities by hand instead of using Claude Code. However, I found a fun way to use Claude Code in a way it wasn&amp;rsquo;t intended! One of my hobbies is playing TTRPGs (tabletop role-playing games) and CRPGs (computer/console role-playing games), which both tend to have limitations that the LLM-powered Claude Code does not.&lt;/p&gt;
&lt;p&gt;TTRPGs require other people to be available at the time you want to play, and they require a person to &amp;ldquo;prep&amp;rdquo; (prepare) a session. CRPGs don&amp;rsquo;t have that limitation, but they are limited to what the developers programmed into them. I think that LLMs are great for generating text, but they eventually lose track of the context, which, in my experience, makes the story grind to a halt.&lt;/p&gt;
&lt;p&gt;Claude Code doesn&amp;rsquo;t have those limitations, and it offers something that most other interactions with LLMs don&amp;rsquo;t: a file backend. This backend is great for keeping track of everything a DM (dungeon master, also often known as a GM: game master) would need to manage a session, story, or campaign.&lt;/p&gt;
&lt;p&gt;To get started with this project, I figured it would be useful to have the d20 SRD available. There&amp;rsquo;s already a GitHub repository that has this, and in Markdown to boot! I created an empty directory and prompted Claude Code to plan a directory structure it could use to run a campaign for the user. This generated an extensive file structure and content, very much directed at the d20 system, I think, but I figure it is easy to change that.&lt;/p&gt;
&lt;p&gt;Claude Code didn&amp;rsquo;t understand that I wanted it to run the game, so I let it generate CLAUDE.md for itself and expand on the features, which added some slash commands. After spending a couple of hours and $15, I think it is at a point where it is quite user-friendly and stable. I have made the project available to the public:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git clone https://git.sng.rs/ks/claude-dm.git
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Start Claude DM by running &lt;code&gt;claude&lt;/code&gt;. There are a couple of custom commands to help the user manage the game state: &lt;code&gt;/new-campaign&lt;/code&gt;, &lt;code&gt;/save&lt;/code&gt;, &lt;code&gt;/continue&lt;/code&gt;, &lt;code&gt;/exit&lt;/code&gt;, &lt;code&gt;/campaigns&lt;/code&gt;, and &lt;code&gt;/game-help&lt;/code&gt; for more commands.&lt;/p&gt;
&lt;p&gt;It will take some time to get from starting a new campaign to actually playing because Claude Code will have to generate a campaign, interactively create a character for the player, and create locations and NPCs (non-player characters), etc. That will, sadly, give some spoilers regarding the game.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve had a lot of fun playing with Claude Code as a DM!&lt;/p&gt;
&lt;p&gt;Final note: a friend of mine suggested using &lt;code&gt;/model&lt;/code&gt; to set the model to &lt;code&gt;haiku&lt;/code&gt; for increased speed and lower costs. This seems to work well, but I can imagine that it might drift from the rules a bit. I think it&amp;rsquo;s great, at least!&lt;/p&gt;
&lt;h2 id="resources"&gt;Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://git.sng.rs/ks/claude-dm"&gt;My Claude DM project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/OldManUmby/DND.SRD.Wiki"&gt;Dungeons and Dragons SRD in Markdown&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Setting Up a Reverse Proxy for Kubernetes Migration</title><pubDate>Sat, 26 Jul 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/setting-up-a-reverse-proxy-for-kubernetes-migration/</guid><description>&lt;p&gt;Migrating my old server to Kubernetes has been on my mind for a while. The last couple of months were spent on setting up the general structure of my cluster. I got a bunch of neat tools set up on the cluster, like: ArgoCD, Cilium, External DNS, NGINX Ingress Controller and a ton more. I also figured out how I could do some GitOps, with an App of Apps and an ApplicationSet for some neat Kustomize stuff to boot. That meant that it was time to get stuff hosted on there, except for one issue: I have just the one IP available, and I have a server and a cluster serving websites.&lt;/p&gt;
&lt;p&gt;At first, I checked out CloudFlare&amp;rsquo;s &lt;em&gt;cloudflared&lt;/em&gt;, which is nice, but it does have several limitations. It doesn&amp;rsquo;t allow WebSocket POSTs, and in my opinion it&amp;rsquo;s not great for non-HTTP(S)-related tasks (e.g., SSH). So I checked what I could do with the cluster I had available. At this point I&amp;rsquo;m not yet fully familiar with all that&amp;rsquo;s available in this ecosystem, so I figured that I could do something with an NGINX reverse proxy.&lt;/p&gt;
&lt;p&gt;Considering I already had NGINX Ingress Controller set up, I figured it would be wise to see if I could solve this with an Ingress. I was only used to configuring Ingresses to use Services that use labels to send traffic to Deployments/Statefulsets/etc. A quick search yielded some neat options, including a helpful blog post by Kristina Devochko that had exactly what I needed. I could link a Service to an Endpoints resource or EndpointSlice, or I could change the Service&amp;rsquo;s type to &lt;em&gt;ExternalName&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;I created a proxy service that routes traffic to an external service (&lt;code&gt;legacy-server.example.com&lt;/code&gt;) using the &lt;code&gt;ExternalName&lt;/code&gt; service type:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;apiVersion&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;v1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;kind&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;Service&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;metadata&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;name&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;legacy-server&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;spec&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;type&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;ExternalName&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;externalName&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;legacy-server.example.com&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that the &lt;code&gt;externalName&lt;/code&gt; points to a DNS name, not an IP address.&lt;/p&gt;
&lt;p&gt;The Ingress handles the traffic and sends it to the service. Many hosts can be added, even wildcards (which might be a security issue by exposing too many services):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;apiVersion&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;networking.k8s.io/v1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;kind&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;Ingress&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;metadata&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;annotations&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;nginx.ingress.kubernetes.io/backend-protocol&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;HTTPS&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;name&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;legacy-server&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;namespace&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;proxy-legacy-server&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;spec&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;rules&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#f92672"&gt;host&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;example.com&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;http&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;paths&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#f92672"&gt;backend&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;service&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;name&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;legacy-server&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;port&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;number&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;443&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;path&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;pathType&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;Prefix&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#f92672"&gt;host&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;registry.example.com&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;http&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;paths&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#f92672"&gt;backend&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;service&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;name&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;legacy-server&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;port&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;number&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;443&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;path&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;pathType&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;Prefix&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;tls&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#f92672"&gt;hosts&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#ae81ff"&gt;example.com&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#ae81ff"&gt;registry.example.com&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;secretName&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;example-com-tls&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that this example assumes the &lt;code&gt;legacy-server&lt;/code&gt; endpoint expects traffic on port &lt;code&gt;443&lt;/code&gt; using the &lt;code&gt;HTTPS&lt;/code&gt; protocol. If HTTPS isn&amp;rsquo;t needed, remove the annotation and update the port to match the service&amp;rsquo;s expected port.&lt;/p&gt;
&lt;p&gt;Now that this part is sorted, I can gradually migrate services to the cluster without impacting DNS or requiring third-party services, and I can easily revert to the legacy setup if things go awry.&lt;/p&gt;
&lt;h1 id="links"&gt;Links&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.kristhecodingunicorn.com/post/kubernetes-service-to-proxy-to-external-services/"&gt;Using Kubernetes Service for proxying to external services&lt;/a&gt; - Kristina Devochko&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kubernetes.io/docs/concepts/services-networking/service/#externalname"&gt;Kubernetes Services with type ExternalName&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Alacritty's daemon mode</title><pubDate>Sun, 13 Jul 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/alacrittys-daemon-mode/</guid><description>&lt;p&gt;Occasionally I try to find alternatives for electron apps because I think that electron just uses too much RAM. This led me to a little Signal Desktop (an electron app) alternative called &lt;em&gt;gurk&lt;/em&gt;, which uses significantly less RAM. On my machine Signal Desktop takes about 1GB RAM and gurk just 40MB. That&amp;rsquo;s an enormous reduction of memory usage, but not a completely fair comparison. Why? Because gurk requires a terminal to run in, which in my case is Alacritty.&lt;/p&gt;
&lt;h3 id="so-what-about-alacritty"&gt;So what about Alacritty?&lt;/h3&gt;
&lt;p&gt;Alacritty takes about 200MB RAM on my machine per process, which I think is a bit high in itself. Especially considering I use that terminal emulator for a ton of different things. Looking into the GitHub issues of Alacritty, I couldn&amp;rsquo;t find an easy way to reduce the memory usage. There were some mentions of video card drivers and fonts influencing the memory usage, but I&amp;rsquo;ll check that out later as I discovered something else.&lt;/p&gt;
&lt;p&gt;Checking the Alacritty documentation, I spotted an argument called &lt;code&gt;--daemon&lt;/code&gt;. It turns out that the terminal emulator can run multiple windows of itself in a single daemon process. This should cut down the relative memory usage of Alacritty depending on how many terminal windows I use at a given time.&lt;/p&gt;
&lt;h4 id="memory-usage-comparison"&gt;Memory Usage Comparison&lt;/h4&gt;
&lt;p&gt;Before (3 separate Alacritty instances):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Process 1: ~200MB&lt;/li&gt;
&lt;li&gt;Process 2: ~200MB&lt;/li&gt;
&lt;li&gt;Process 3: ~200MB&lt;/li&gt;
&lt;li&gt;Total: ~600MB&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After (daemon mode with 3 windows):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Single daemon process: ~250MB&lt;/li&gt;
&lt;li&gt;Total: ~250MB&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This quickly makes running Alacritty in daemon mode much more efficient than running separate instances. I suppose crashes of Alacritty or other cases where the service can&amp;rsquo;t start could be a nuisance, but I have had no issues with Alacritty so far.&lt;/p&gt;
&lt;h3 id="setting-up-the-daemon-using-systemd"&gt;Setting up the daemon using systemd&lt;/h3&gt;
&lt;p&gt;Create &lt;code&gt;~/.config/systemd/user/alacritty.service&lt;/code&gt; with the following contents:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-systemd" data-lang="systemd"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;[Unit]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;Description&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;Alacritty Daemon&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;Before&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;graphical-session.target&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;After&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;graphical-session-pre.target&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;PartOf&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;graphical-session.target&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;StartLimitIntervalSec&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;30&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;StartLimitBurst&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;[Service]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;ExecStart&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;alacritty --daemon --socket %t/alacritty.sock&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;Restart&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;on-failure&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;RestartSec&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;5s&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;[Install]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;WantedBy&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;graphical-session-pre.target&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then run:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;systemctl --user daemon-reload
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;systemctl --user enable alacritty.service --now
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s all to set up the daemon. Then finally to start using it, create new Alacritty windows with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;alacritty msg create-window
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And to start an application right away, like gurk:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;alacritty msg create-window --command gurk
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="troubleshooting"&gt;Troubleshooting&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;If the daemon fails to start, check &lt;code&gt;journalctl --user -u alacritty.service&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Ensure the socket directory exists: &lt;code&gt;mkdir -p &amp;quot;$XDG_RUNTIME_DIR&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://signal.org/"&gt;Signal - Messaging service&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/boxdot/gurk-rs"&gt;gurk - TUI signal client&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://alacritty.org/"&gt;Alacritty - Terminal Emulator&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>On LLM-powered coding</title><pubDate>Fri, 27 Jun 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/on-llm-powered-coding/</guid><description>&lt;p&gt;Each new iteration of LLMs gets its coding capabilities &amp;lsquo;upgraded&amp;rsquo;, &amp;rsquo;enhanced&amp;rsquo; and more with great results from some software engineering scoring system. Everytime I see this I get excited and curious, but it always ends in disappointment for me. I find it a bit difficult to describe why exactly, but I&amp;rsquo;ll try to get some of my thoughts written up here.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve had some great successes with LLMs in my work. It is great at finding bugs in my work when I give it some of my code and logs, and at the very least: very fast. It is also very strong at generating configuration files based on examples. This is also where I find that Claude Code is quite strong.&lt;/p&gt;
&lt;p&gt;However, when I need more work done, I feel like I&amp;rsquo;m doing solo development with an annoying neighbour. This Claude guy keeps talking about stuff that is not important. Just like the other day when I was developing a gRPC service which uses long-lived connections for streaming data between clients that are connected to it. It worked great when I directly connected to the port, but as soon as I hooked it up to my local development setup it failed.&lt;/p&gt;
&lt;p&gt;The local development setup routes traffic through Traefik and Docker networks as much as possible. This gives the local environment many of the features that I use in the Kubernetes environments. That is, stuff like: hostname resolving for hooking up related services (dnsmasq), https (with mkcert for a self-signed certificate), authentication (with Keycloak and OAuth2 Proxy), and more services. I use a custom tool that orchestrates the different dependencies per project, so it is admittedly a bit difficult to give the LLM the full context of development. But I think that&amp;rsquo;s the case in any environment, not just mine.&lt;/p&gt;
&lt;p&gt;Given the complexity went from &lt;code&gt;client using gRPC to connect to server&lt;/code&gt; to basically &lt;code&gt;client using HTTP2+gRPC to connect to server&lt;/code&gt; I figured it would be quite easy to solve this. My initial prompts gave Claude the idea I should test using &lt;code&gt;grpcurl&lt;/code&gt; in order to test the connection. I followed its instructions, but that didn&amp;rsquo;t work. So I fired up Claude Code and let it fiddle around a bit.&lt;/p&gt;
&lt;p&gt;Claude tried to use &lt;code&gt;grpcurl&lt;/code&gt;, but couldn&amp;rsquo;t even get the arguments of the command right. Later I discovered that the suggested tool could not handle the HTTP2-layer in the connection, and the gRPC server needs to enable reflection in order to be used with clients like this. Claude added some middlewares to the &lt;code&gt;docker-compose.yaml&lt;/code&gt; file to try to solve the issue with the client. The tools it suggested would only work with directly connecting to the service, without Traefik in between, which was exactly what I was trying to prevent, because that would not be like a real-world implementation. I gave up on Claude here and went back to searching online and reading the documentation.&lt;/p&gt;
&lt;p&gt;During my investigation I found that I had to configure the Treafik loadbalancer to use the &lt;code&gt;h2c&lt;/code&gt; scheme and add some code to the client (basically &lt;code&gt;WithTransportCredentials&lt;/code&gt; combined with a server name). After that I could use my test client to connect to the gRPC server without issue, through Traefik. However, there was a new issue: after exactly 1 minute the connection between the client and the server would be dropped, unlike without Traefik. I figured this would be a good one for Claude.&lt;/p&gt;
&lt;p&gt;I asked Claude about the issue, and again it spit out some middleware for Traefik. This had no effect, and Claude once again suggested connecting directly to the gRPC server without Traefik. I prompted it some more, explaining that I must have Traefik there (because that simulates the NGINX Ingress Controller that I use on Kubernetes). That made Claude generate Golang code for the server and client. The generated code was neat and showed how to configure the client/server to handle connection age/timeouts. However, the code was clearly not going to solve the root cause of the issue as it only affected the connections through Traefik. So, I went back to doing it myself.&lt;/p&gt;
&lt;p&gt;I discovered that the Traefik endpoints can be configured with different timeouts, not unlike the timeouts that Claude generated, but in this case for Traefik itself. I configured the timeouts to &lt;code&gt;0s&lt;/code&gt; and solved my issue. Now I have a functional local setup for the service, but I can&amp;rsquo;t say how much added value Claude was here.&lt;/p&gt;
&lt;p&gt;For some reason I often seem to end up at a place where my main takeaways for using LLMs are: sometimes they can be great, and sometimes it is just a nuisance. But I can&amp;rsquo;t seem to determine which side it is going to end up before I realize that the LLM has become an obstacle instead of a tool for my use case.&lt;/p&gt;
&lt;p&gt;I keep returning to a thought that by how I suspect that LLMs trained, they are unable to generate code for problems that are closer to real life. I reckon that a lot of tutorials, blog posts, quickstart guides, and other types of documentation/forums/etc. are the bulk of the training data, and thus lacking more architectural components. So maybe: real-life implementations require much more context than LLMs can handle?&lt;/p&gt;</description></item><item><title>Git URL shorthands</title><pubDate>Wed, 14 May 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/git-url-shorthands/</guid><description>&lt;p&gt;Just the other day I found myself logging into my personal GitLab just to fetch a URL for &lt;code&gt;git clone&lt;/code&gt;. I figured I could make a shell alias, but it seems that Git has something neat that works just as well. To clone a personal project, I just need to type: &lt;code&gt;gcl my:&amp;lt;project&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To set up the above, one only need a small Git configuration. A simple shell alias is used for convenience. In &lt;code&gt;man git-config&lt;/code&gt; there is the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;url.&amp;lt;base&amp;gt;.insteadOf&lt;/code&gt;
Any URL that starts with this value will be rewritten to start, instead, with &amp;lt;base&amp;gt;. In cases where some site serves a large number of repositories, and serves them with multiple access methods, and some users need to use different access methods, this feature allows people to specify any of the equivalent URLs and have Git automatically rewrite the URL to the best alternative for the particular user, even for a never-before-seen repository on the site. When more than one insteadOf strings match a given URL, the longest match is used.&lt;/p&gt;
&lt;p&gt;Note that any protocol restrictions will be applied to the rewritten URL. If the rewrite changes the URL to use a custom protocol or remote helper, you may need to adjust the &lt;strong&gt;protocol.&lt;/strong&gt;*.allow config to permit the request. In particular, protocols you expect to use for submodules must be set to &lt;strong&gt;always&lt;/strong&gt; rather than the default of &lt;strong&gt;user&lt;/strong&gt;. See the description of &lt;strong&gt;protocol.allow&lt;/strong&gt; above.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This means all that is needed in &lt;code&gt;.gitconfig&lt;/code&gt; is:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-gitconfig" data-lang="gitconfig"&gt;[url &amp;#34;ssh://user@git.example.com:1234/path/&amp;#34;]
insteadOf = &amp;#34;my:&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And to complement it, an alias for the rc-file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;alias gcl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;git clone&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Using the shorthand for the URL will result in the full URL to be stored in the repository its cloned remotes:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;❯ git remote -v
*
origin ssh://user@git.example.com:1234/path/&amp;lt;project&amp;gt; (fetch)
origin ssh://user@git.example.com:1234/path/&amp;lt;project&amp;gt; (push)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This small configuration should save some time and eliminates the need to copy-paste repository URLs.&lt;/p&gt;</description></item><item><title>Long line formatting tips for Vim</title><pubDate>Sat, 19 Apr 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/long-line-formatting-tips-for-vim/</guid><description>&lt;p&gt;Earlier this week I watched a video by Sylvan Franklin on YouTube on useful Vim commands for writers. Writing documentation is something I happen to do often, so I gave it a watch. Sylvan explains how long lines can be difficult to manage in Vim. Even with &lt;code&gt;:set wrap&lt;/code&gt;, as that only makes it easier to read the long lines, not so much on navigating those lines (&lt;code&gt;gj&lt;/code&gt;/&lt;code&gt;gk&lt;/code&gt; help a smidgen there).&lt;/p&gt;
&lt;p&gt;Sylvan suggests using selecting the line (&lt;code&gt;S-v&lt;/code&gt;) and then &lt;code&gt;gq&lt;/code&gt; - which formats text - to wrap everything on separate lines, or for paragraphs &lt;code&gt;gqap&lt;/code&gt;. He struggles a bit with joining formatted lines again. I think &lt;code&gt;gq&lt;/code&gt; is great for cleaning up changes in Markdown documents when combined with joining lines, which I&amp;rsquo;ll address below. However, some configuration may be required to get this to function, and there are some small optimizations I would add.&lt;/p&gt;
&lt;h3 id="configuration"&gt;Configuration&lt;/h3&gt;
&lt;p&gt;First, some configuration as &lt;code&gt;gq&lt;/code&gt; relies on a couple of things. Meaning, &lt;code&gt;q&lt;/code&gt; has to be set in &lt;code&gt;formatoptions&lt;/code&gt;, and &lt;code&gt;gq&lt;/code&gt; will wrap the words within the set &lt;code&gt;textwidth&lt;/code&gt;. I have something like this in Neovim which continues comments, joins comments, and recognizes lists as well:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vim.opt.textwidth = 100
vim.opt.formatoptions = vim.opt.formatoptions + &amp;#34;qnjr&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="optimization"&gt;Optimization&lt;/h3&gt;
&lt;p&gt;I&amp;rsquo;d like to point out the small changes I would make to Sylvan&amp;rsquo;s suggestions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Format line: &lt;code&gt;gqq&lt;/code&gt; instead of &lt;code&gt;S-v&lt;/code&gt; followed by &lt;code&gt;gq&lt;/code&gt;. The extra &lt;code&gt;q&lt;/code&gt; will apply the operation to the line, so &lt;code&gt;S-v&lt;/code&gt; to select the line is no longer needed.&lt;/li&gt;
&lt;li&gt;A bit pedantic, but I would format paragraphs with &lt;code&gt;gqip&lt;/code&gt; instead of &lt;code&gt;gqap&lt;/code&gt;. Using &lt;code&gt;ip&lt;/code&gt; instead of &lt;code&gt;ap&lt;/code&gt; makes the intention clearer to me and leaves the cursor inside the paragraph, and aligns better with how I join lines.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Joining lines with &lt;code&gt;J&lt;/code&gt; repeatedly works, but is suboptimal as for documentation this should usually be a paragraph. Joining a paragraph with &lt;code&gt;vipJ&lt;/code&gt; will set everything back to one line, inside paragraph so it doesn&amp;rsquo;t accidentally join the paragraph with the next paragraph.&lt;/p&gt;
&lt;h3 id="markdown-docs-examples"&gt;Markdown docs examples&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s assume there is a README.md that describes the feature of a product in
short&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-md" data-lang="md"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# Introduction
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;This is a great project written in a terrific programming language and supports many cool features like: an extensive feature, and a simple feature, plus some useless things.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# Usage
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Jumping to the long line and pressing &lt;code&gt;gqq&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-md" data-lang="md"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# Introduction
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;This is a great project written in a terrific programming language and supports
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;many cool features like: an extensive feature, and a simple feature, plus some
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;useless things.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# Usage
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then edit the paragraph a bit:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-md" data-lang="md"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# Introduction
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;This project is written in a language and has
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;many cool features like: an extensive feature, and a simple feature, plus some other things that people find
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;useful.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# Usage
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Fixing this by hand can be tedious, but with &lt;code&gt;vipJ&lt;/code&gt; and &lt;code&gt;gqip&lt;/code&gt; it is cleaned up
in no time.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-md" data-lang="md"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# Introduction
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;This project is written in a language and has many cool features like: an
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;extensive feature, and a simple feature, plus some other things that people
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;find useful.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# Usage
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Happy Vimming!&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=t9FWr7cajV4"&gt;Sylvan Franklin&amp;rsquo;s YouTube video&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://neovim.io/doc/user/change.html#fo-table"&gt;Neovim docs on &lt;code&gt;fo-table&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Trino + Iceberg failing to write metadata.json solved</title><pubDate>Thu, 10 Apr 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/trino-plus-iceberg-failing-to-write-metadata.json-solved/</guid><description>&lt;p&gt;What began as a neat data processing pipeline recently hit a roadblock.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-log" data-lang="log"&gt;Query 20250409_124602_00001_tip63 failed: Failed to commit the transaction during insert: Failed to write json to file:
s3a://warehouse/medical/ergometer-76e41009d6bc4f419bd0583b32d3bdaa/metadata/00397-9f9715cd-94e9-47ba-a351-6781f75d6427.metadata.json
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: Run &lt;code&gt;ALTER TABLE &amp;lt;table&amp;gt; EXECUTE expire_snapshots(retention_threshold =&amp;gt; '7d');&lt;/code&gt;&lt;/p&gt;
&lt;h3 id="the-problem-appears"&gt;The problem appears&lt;/h3&gt;
&lt;p&gt;A while back I set up a data processing environment using Trino, Nessie, MinIO, Argo Workflows, and Argo Events. Argo Events is configured to monitor a bunch of MinIO buckets for new files to trigger a workflow in Argo Workflows. These workflows interface with MinIO and Trino in order to get the data from the uploaded files into an Apache Iceberg table, which is also located somewhere on MinIO.&lt;/p&gt;
&lt;p&gt;The data processing ran fine for a while, but eventually it ran into the issue that it could no longer process mutations. The error appeared to indicate issues with either MinIO (bucket size restrictions, quotas, ACLs) or Trino (configuration problems, incomplete Iceberg support). However, I could not reproduce any write issues in MinIO like that, nor could I find clear issues on Trino&amp;rsquo;s GitHub that seemed to align with the problems I saw.&lt;/p&gt;
&lt;h3 id="initial-troubleshooting"&gt;Initial troubleshooting&lt;/h3&gt;
&lt;p&gt;In order to keep the development team working on the data pipeline, a &amp;rsquo;temporary&amp;rsquo; workaround maintained the existing setup. The workaround for this was to create a new table, copy the data into the new table, then rename and remove the original table.&lt;/p&gt;
&lt;p&gt;Because this set-up was only running on a non-production environment the workaround was enough until there was an actual solution to the error above. Weeks turned into months, with the same workaround applied whenever the error appeared. Each troubleshooting attempt focused on MinIO or Trino configuration reinforcing my assumptions. Trino was updated to the latest version each time, but it changed nothing. Eventually, I gave up.&lt;/p&gt;
&lt;h3 id="pivot-to-spark"&gt;Pivot to Spark?&lt;/h3&gt;
&lt;p&gt;After months of applying the same workaround, I had given up on the architecture. Spending hours working on this issue every time I saw it appear in order to hopefully find a solution was not a feasible approach for production, and that moment slowly came into sight. A reliable solution was necessary, not a recurring fix. So I decided to abandon Trino/Iceberg completely in favor of Apache Spark using the Kubeflow Operator. All scripts and workflows had to be reworked.&lt;/p&gt;
&lt;p&gt;During the installation of Spark Operator and creating SparkApplication objects I ran into the usual hurdles for setting up stuff on Kubernetes (arranging netpols and service configuration for webhooks, configuring a service account with the correct permissions, nothing special). Then, during one of my coffee breaks, I came across a neat blog on Hacker News called &amp;ldquo;Best Programmers&amp;rdquo;.&lt;/p&gt;
&lt;h3 id="back-to-the-beginning"&gt;Back to the beginning&lt;/h3&gt;
&lt;p&gt;The blog is describing programmers, and I&amp;rsquo;ll just twist that a bit so it applies to other subjects as well. From the blog:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;An expert goes in (after reading the reference!) and sits down to write a config for the tool of which they understand every single line and can explain it to a colleague. That leaves no room for doubt!
&amp;hellip;
Everyone gets stuck at times. The best know how to get unstuck. They simplify problems until they become digestible. That’s a hard skill to learn and requires a ton of experience.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This made me wonder, did I really try to understand the issue? Did I understand the tools I was using? Did I try to make the issue smaller? It was quite the wake-up call for me, so I paused my work on Spark and dove back into the initial set-up. The issue had just occurred again, so I had something to work with as well.&lt;/p&gt;
&lt;p&gt;With a short list of tools in the data processing framework - even those only slightly related - I started off on trying to solve the issue now once and for all. So, in short and no particular order: Kubernetes, MinIO, Kyverno, Nessie, Cilium, Argo Workflows, Argo CD, Argo Events, Apache Iceberg, Trino. After prioritizing the list a bit, and about to look into Trino, Nessie and MinIO again. Almost making the same mistake &lt;em&gt;again&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;This pattern of continuously looking into familiar components (Trino and MinIO) and neglecting less understood parts is what might be holding me back. This is where Apache Iceberg came into view, which I had only treated like a glorified Parquet file so far, even though I had heard great things about it (snapshots, partitioning, time travel, and the like).&lt;/p&gt;
&lt;h3 id="the-real-culprit"&gt;The real culprit&lt;/h3&gt;
&lt;p&gt;Apache Iceberg is well-documented, and has a recommended maintenance section. This is where I struck gold, the first thing I read:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Each write to an Iceberg table creates a new &lt;em&gt;snapshot&lt;/em&gt;, or version, of a table. Snapshots can be used for time-travel queries, or the table can be rolled back to any valid snapshot.&lt;/p&gt;
&lt;p&gt;Snapshots accumulate until they are expired by the &lt;code&gt;expireSnapshots&lt;/code&gt; operation. Regularly expiring snapshots is recommended to delete data files that are no longer needed, and to keep the size of table metadata small.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This hinted at being a possible solution for my issue, not being able to write the metadata. I took some time to read more of the docs to understand more of how the different parts of Iceberg tables function. This is also the part where I started to appreciate Iceberg&amp;rsquo;s complexity a lot more. It was time to test this new knowledge and see what happens.&lt;/p&gt;
&lt;h3 id="testing-the-solution"&gt;Testing the solution&lt;/h3&gt;
&lt;p&gt;I was already familiar with how Trino can call Apache Iceberg its operations/procedures/functions. I already used the &lt;code&gt;add_files&lt;/code&gt; operation before in some earlier trials of the pipeline. So there I went, trying an insert first to ensure the issue was still active. Then I called the &lt;code&gt;expire_snapshots&lt;/code&gt; operation (as it is called in Trino):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;ALTER&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;TABLE&lt;/span&gt; ergometer &lt;span style="color:#66d9ef"&gt;EXECUTE&lt;/span&gt; expire_snapshots(retention_threshold &lt;span style="color:#f92672"&gt;=&amp;gt;&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;7d&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;ALTER&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;TABLE&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;EXECUTE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;rows&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;------
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;(&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;rows&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Query &lt;span style="color:#ae81ff"&gt;20250410&lt;/span&gt;_132550_00014_y2wfr, FINISHED, &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; node
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Splits: &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; total, &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; done (&lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;.&lt;span style="color:#ae81ff"&gt;00&lt;/span&gt;&lt;span style="color:#f92672"&gt;%&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;.&lt;span style="color:#ae81ff"&gt;13&lt;/span&gt; [&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;rows&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;B] [&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;rows&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&lt;/span&gt;s, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;B&lt;span style="color:#f92672"&gt;/&lt;/span&gt;s]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And an insert:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;INSERT&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;INTO&lt;/span&gt; ergometer (...) &lt;span style="color:#66d9ef"&gt;VALUES&lt;/span&gt; (...);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;INSERT&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;row&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Query &lt;span style="color:#ae81ff"&gt;20250410&lt;/span&gt;_132708_00015_y2wfr, FINISHED, &lt;span style="color:#ae81ff"&gt;3&lt;/span&gt; nodes
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Splits: &lt;span style="color:#ae81ff"&gt;22&lt;/span&gt; total, &lt;span style="color:#ae81ff"&gt;22&lt;/span&gt; done (&lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;.&lt;span style="color:#ae81ff"&gt;00&lt;/span&gt;&lt;span style="color:#f92672"&gt;%&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;.&lt;span style="color:#ae81ff"&gt;72&lt;/span&gt; [&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;rows&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;B] [&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;rows&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&lt;/span&gt;s, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;B&lt;span style="color:#f92672"&gt;/&lt;/span&gt;s]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Great! There are some loose ends I need to figure out, like proactively running the required maintenance tasks, set up monitoring, etc.&lt;/p&gt;
&lt;h3 id="lessons-learned--next-steps"&gt;Lessons learned &amp;amp; next steps&lt;/h3&gt;
&lt;p&gt;This journey refocused me to look beyond the tools I was familiar with and truly try to understand the entire stack. I treated Iceberg as a simple file format, it&amp;rsquo;s actually a complex system requiring maintenance.&lt;/p&gt;
&lt;p&gt;For production, I&amp;rsquo;m implementing (some level of) automated maintenance, scheduling &lt;code&gt;expire_snapshots&lt;/code&gt; with Argo Workflows and investigate options for monitoring.&lt;/p&gt;
&lt;p&gt;Most importantly, I&amp;rsquo;ve learned to question my assumptions when troubleshooting. Let&amp;rsquo;s see if that sticks.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://endler.dev/2025/best-programmers/"&gt;Inspiring blog via Hacker News&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://iceberg.apache.org/docs/latest/maintenance/"&gt;Official Apache Iceberg maintenance page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://trino.io/blog/2021/07/30/iceberg-concurrency-snapshots-spec"&gt;Trino on Ice series, part 3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://trino.io/docs/current/connector/iceberg.html"&gt;Trino docs on Iceberg&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Debugging Kubernetes webhook timeouts with Cilium</title><pubDate>Fri, 04 Apr 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/fixing-webhook-context-deadline-exceeded-in-kubernetes/</guid><description>&lt;p&gt;During the installation of operators and applying their CRD&amp;rsquo;s in Kubernetes I occasionally end up on some issue that looks like &lt;code&gt;Error from server (InternalError): error when creating &amp;quot;...&amp;quot;: Internal error occurred: failed calling webhook &amp;quot;...&amp;quot;: failed to call webhook: Post &amp;quot;https://...webhook...svc...?timeout=11s&amp;quot;: context deadline exceeded&lt;/code&gt;. Below a summary of observations and steps I take to solve this, as a reminder.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This guide documents my approach to solving webhook timeouts in Kubernetes clusters using Cilium for networking. Kubernetes environments can differ a lot, but the troubleshooting approach could be valuable.&lt;/p&gt;
&lt;p&gt;This also assumes some familiarity with Kubernetes admission webhooks. It focuses specifically on networking issues when webhooks time out, not other potential webhook failures.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="first-check-the-basics"&gt;First, check the basics&lt;/h2&gt;
&lt;p&gt;Before diving into network policies, verify:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Webhook pods are running (&lt;code&gt;kubectl get pods -n &amp;lt;namespace&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Basic connectivity (&lt;code&gt;kubectl logs &amp;lt;webhook-pod&amp;gt; -n &amp;lt;namespace&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="observe-and-diagnose-the-issue"&gt;Observe and diagnose the issue&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;m unsure if the following is relevant, however, clusters I work on often have Cilium and Kyverno set up to block a bunch of traffic for security reasons.&lt;/p&gt;
&lt;p&gt;Then to debug I inspect network traffic. So, when I look in Hubble (via Cilium&amp;rsquo;s port forward or Hubble UI in the browser), there are no connections being made to the kube apiserver, so no dropped or forwarded connections.&lt;/p&gt;
&lt;p&gt;Then I check if the webhook is actually functioning on its URL. So I run a pod in the namespace of the webhook and &lt;code&gt;curl -X POST https://...webhook...svc...?timeout=10s&lt;/code&gt; which should return an error (and not timeout).&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve observed that in my specific environment, the webhook service is a &lt;code&gt;ClusterIP&lt;/code&gt;, and in some cases changing service configurations can help expose networking issues for debugging purposes.&lt;/p&gt;
&lt;h2 id="fix-the-webhook"&gt;Fix the webhook&lt;/h2&gt;
&lt;p&gt;First off, ensure that the webhook service&amp;rsquo;s type is &lt;code&gt;LoadBalancer&lt;/code&gt; and set its &lt;code&gt;loadBalancerIP&lt;/code&gt; to match its &lt;code&gt;clusterIP&lt;/code&gt;. This will probably not fix the issue, but it will show the dropped connections in Hubble.&lt;/p&gt;
&lt;p&gt;Now that there are dropped connections visible in Hubble, a (Cilium) Network Policy will help solve the final step. Below an example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;apiVersion&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;cilium.io/v2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;kind&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;CiliumNetworkPolicy&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;metadata&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;name&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;ingress--kube-apiserver-operator-webhook&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;namespace&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;&amp;lt;operator-namespace&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;spec&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;endpointSelector&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;matchLabels&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;app.kubernetes.io/component&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;webhook&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;app.kubernetes.io/instance&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;&amp;lt;operator-name&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;ingress&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#f92672"&gt;fromEntities&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#ae81ff"&gt;kube-apiserver&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;toPorts&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#f92672"&gt;ports&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#f92672"&gt;port&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;lt;svc-port&amp;gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;protocol&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;TCP&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Replace the &lt;code&gt;&amp;lt;vars&amp;gt;&lt;/code&gt; and apply this to the cluster. This should now allow the webhook to run as expected.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions"&gt;CRD&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Simple GitLab CI/CD for Portainer</title><pubDate>Mon, 31 Mar 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/simple-gitlab-ci-cd-portainer/</guid><description>&lt;p&gt;Small projects I run on Portainer and for which I keep their code on GitLab all have a similar setup for CI/CD. Together with scheduled builds this makes for an easy setup keeping projects up to date on Portainer.&lt;/p&gt;
&lt;h3 id="portainer-stack"&gt;Portainer stack&lt;/h3&gt;
&lt;p&gt;The project has to be configured on Portainer already (docker-compose, environment variables, etc.). Ensure that the image field contains a tag (GitLab&amp;rsquo;s CI/CD will update the tag value):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;services&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;app&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;image&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;docker-repository/path/to/image:1.0-tag&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="gitlab-cicd"&gt;GitLab CI/CD&lt;/h3&gt;
&lt;p&gt;In GitLab a docker image has to be set up created and stored in a repository. After building a docker image, the following can be used to update Portainer with that image. I assume that &lt;code&gt;&amp;quot;${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}&amp;quot;&lt;/code&gt; is the unique image tag here. Ensure that at least something unique is used in the image tag. Something like &lt;code&gt;1.250331.15654&lt;/code&gt; could also be used, where &lt;code&gt;1&lt;/code&gt; is the major version (could be a project-wide variable), &lt;code&gt;250331&lt;/code&gt; is the date (can be generated with a bash command, &lt;code&gt;date +&amp;quot;%y%m%d&amp;quot;&lt;/code&gt;), and &lt;code&gt;15654&lt;/code&gt; is the &lt;code&gt;CI_CONCURRENT_ID&lt;/code&gt; environment variable or something.&lt;/p&gt;
&lt;p&gt;Then add the following to &lt;code&gt;gitlab-ci.yml&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;update-stack&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;stage&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;deploy&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;image&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;alpine/curl:latest&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;variables&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;API_URL&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;${API_URL}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;API_TOKEN&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;${API_TOKEN}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;STACK_ID&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;${STACK_ID}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;script&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - |&lt;span style="color:#e6db74"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; apk add jq
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; api_call() {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; local method=&amp;#34;$1&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; local endpoint=&amp;#34;$2&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; local data=&amp;#34;${3:-}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; curl -X &amp;#34;$method&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; &amp;#34;${API_URL}${endpoint}&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; -H &amp;#34;X-API-Key: ${API_TOKEN}&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; -H &amp;#34;Content-Type: application/json&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; --silent \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; ${data:+-d &amp;#34;$data&amp;#34;}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; # Fetch the stack info from Portainer
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; CURRENT_STACK=$(api_call &amp;#34;GET&amp;#34; &amp;#34;/stacks/${STACK_ID}&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; CURRENT_STACK_FILE=$(api_call &amp;#34;GET&amp;#34; &amp;#34;/stacks/${STACK_ID}/file&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; # Get the endpoint ID from the stack JSON
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; ENDPOINT_ID=$(echo &amp;#34;$CURRENT_STACK&amp;#34; | jq -r .EndpointId)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; # Find and update the matching image in the stack file content using jq
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; # This regex pattern finds any line starting with &amp;#34;image: &amp;#34; followed by your registry path and replaces it with the new image tag
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; UPDATED_STACK_FILE=$(echo &amp;#34;$CURRENT_STACK_FILE&amp;#34; | jq --arg new_image &amp;#34;${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}&amp;#34; &amp;#34;.StackFileContent | gsub(\&amp;#34;image: ${CI_REGISTRY_IMAGE}.*\&amp;#34;; \&amp;#34;image: \(\$new_image)\&amp;#34;)&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; # Create the stack update JSON
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; UPDATE_STACK=$(jq -n \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; --argjson env &amp;#34;$(echo &amp;#34;$CURRENT_STACK&amp;#34; | jq .Env)&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; --argjson content &amp;#34;$UPDATED_STACK_FILE&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; &amp;#39;{env: $env, prune: true, pullImage: true, stackFileContent: $content}&amp;#39;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; # Update the stack with the new image, causing the container to start with the new image
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; OUTPUT=$(api_call &amp;#34;PUT&amp;#34; &amp;#34;/stacks/${STACK_ID}?endpointId=${ENDPOINT_ID}&amp;#34; &amp;#34;$UPDATE_STACK&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; echo &amp;#34;$OUTPUT&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; if echo &amp;#34;$OUTPUT&amp;#34; | grep -v &amp;#34;{\&amp;#34;Id\&amp;#34;:${STACK_ID},&amp;#34;; then
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; exit 1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; fi
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; echo &amp;#34;Updated the stack with new image: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;only&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#ae81ff"&gt;main&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#ae81ff"&gt;tags&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;NB&lt;/strong&gt; I assume &lt;code&gt;stage: deploy&lt;/code&gt; matches a stage after building the docker image, and that this will run every time a pipeline is run on &lt;code&gt;main&lt;/code&gt; or when a &lt;code&gt;tag&lt;/code&gt; has been created.&lt;/p&gt;
&lt;p&gt;Finally, the environment variables required in GitLab:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;API_URL&lt;/code&gt;: has to match the URL that GitLab can access Portainer on, like: &lt;code&gt;https://my-portainer:9443/api&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;API_TOKEN&lt;/code&gt;: has to match the value of the access token, which is a &lt;em&gt;Portainer access token&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;STACK_ID&lt;/code&gt;: has to match the ID of the stack, which can be found by navigating through Portainer (where the project was set up and then get the integer from the URL). For example, in &lt;code&gt;https://my-portainer:9443/#!/2/docker/stacks/my-app?id=123&amp;amp;type=2&amp;amp;regular=true&amp;amp;orphaned=false&amp;amp;orphanedRunning=false&lt;/code&gt; the value would be &lt;code&gt;123&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This updates the project on Portainer automatically, and can be tested by manually running a pipeline on &lt;code&gt;main&lt;/code&gt; or on updating anything on the &lt;code&gt;main&lt;/code&gt; branch.&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.portainer.io/api/access"&gt;Portainer access token&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Keycloak IdP login with automatic linking</title><pubDate>Thu, 20 Mar 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/keycloak-idp-login-with-automatic-linking/</guid><description>&lt;p&gt;This guide shows how to configure Keycloak to automatically link social/external identity provider accounts without requiring users to confirm the link each time.&lt;/p&gt;
&lt;p&gt;Keycloak is a powerful tool, but sometimes I find it hard to find the proper documentation. So keeping track of this here: the authentication flows for linking accounts to brokers automatically without prompting the user for it. I required two options, auto linking with and without creating new accounts in Keycloak.&lt;/p&gt;
&lt;h2 id="automatically-link-existing-first-login-flow"&gt;Automatically link existing first login flow&lt;/h2&gt;
&lt;p&gt;This allows new users to be created automatically in Keycloak and then log in with a linked account (which links automatically).&lt;/p&gt;
&lt;p&gt;Create a new (Basic) flow with a practical name. Then create the following steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create User If Unique (Requirement: Alternative)&lt;/li&gt;
&lt;li&gt;Automatically Set Existing User (Requirement: Alternative)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;NB&lt;/strong&gt; This allows everybody that can create an account with the IdP to log in to the website using this IdP.&lt;/p&gt;
&lt;h2 id="detect-existing-user-first-login-flow"&gt;Detect existing user first login flow&lt;/h2&gt;
&lt;p&gt;This allows existing users to log in with a linked account (which links automatically).&lt;/p&gt;
&lt;p&gt;Create a new (Basic) flow with a practical new. Then create the following steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Detect Existing Broker User (Requirement: Required)&lt;/li&gt;
&lt;li&gt;Automatically Set Existing User (Requirement: Required)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;NB&lt;/strong&gt; This will not create users in Keycloak, so they have to be created via another way.&lt;/p&gt;
&lt;h2 id="set-the-login-flow-override-for-the-idp"&gt;Set the login flow override for the IdP&lt;/h2&gt;
&lt;p&gt;To get the authentication flow set up in Keycloak go to &lt;strong&gt;Identity providers&lt;/strong&gt;, select the one that should use the new flow, and look for the &lt;strong&gt;First login flow override&lt;/strong&gt; field to specify the new flow.&lt;/p&gt;
&lt;h2 id="see-also"&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.keycloak.org/docs/latest/server_admin/index.html#automatically-link-existing-first-login-flow"&gt;Keycloak: Automatically link existing first login flow&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="notes"&gt;Notes&lt;/h2&gt;
&lt;p&gt;I saw that these authentication flow options have changed a lot over the years, so I suspect this documentation could be of short value. Hopefully the authorization flow configuration becomes a bit more intuitive in the future. Or maybe I&amp;rsquo;ll just understand it better in the future and I won&amp;rsquo;t need this document anymore.&lt;/p&gt;
&lt;p&gt;My solution works for Keycloak &lt;code&gt;26.0.8&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Rambling about Claude Code</title><pubDate>Sun, 02 Mar 2025 00:00:00 +0000</pubDate><author>KS</author><guid>https://sng.rs/posts/claude-code-ramblings/</guid><description>&lt;p&gt;Last week &lt;em&gt;Anthropic released a tool called Claude Code&lt;/em&gt; (CC), which at first glance seemed pretty powerful. So I tried it for a bit, and it&amp;rsquo;s clearly not there yet when working on larger projects. At least for me.&lt;/p&gt;
&lt;h2 id="jumping-in-blindly"&gt;Jumping in blindly&lt;/h2&gt;
&lt;p&gt;I have been working on a little game for a while, and naively I figured CC would be great for iterating on it quickly. After some prompts, and about $5, the codebase turned into a pile of rubble.&lt;/p&gt;
&lt;p&gt;Code generated by CC seemed &lt;em&gt;very&lt;/em&gt; verbose to me. So much so that I got the feeling it wasn&amp;rsquo;t implementing what I asked it to generate, but that it was explaining to me how I could implement it in some ideal fantasy world. Whenever I develop something, I know I&amp;rsquo;m producing soon-to-be-legacy code, so I try to minimize the amount of work done to fit the features I want.&lt;/p&gt;
&lt;p&gt;I could still launch the game by the way, but everything that was added by CC felt entirely disconnected from the rest of the codebase. I discarded it, and quickly discovered I should have executed &lt;code&gt;/init&lt;/code&gt; to make it a bit more aware of the project.&lt;/p&gt;
&lt;p&gt;Rookie mistake on my part, I guess. It would have been nice to show some examples here. Oh well, hindsight.&lt;/p&gt;
&lt;h2 id="reassessing-my-approach"&gt;Reassessing my approach&lt;/h2&gt;
&lt;p&gt;One of my friends is also pretty smitten with AI tech, so it didn&amp;rsquo;t take long until we discussed CC over lunch. We talked about my findings with CC. One of the things I mentioned was that it felt to me like CC was generating tutorials to me, the code being too verbose for a 15k-line project. I mentioned that the generated code contained too much context, any developer would split things up in multiple files, maybe only to match the rest of the codebase that was written earlier.&lt;/p&gt;
&lt;p&gt;Mentioning the tutorials, my friend told me that could make sense. The models could be trained on tutorial data, and it could be interesting to write a blog on that topic. There was a slight issue though.&lt;/p&gt;
&lt;h2 id="i-didnt-have-a-blog-yet"&gt;I didn&amp;rsquo;t have a blog, yet&lt;/h2&gt;
&lt;p&gt;Inspired by the chat I had earlier that day, I figured I should get started on a blog, which I didn&amp;rsquo;t have yet.&lt;/p&gt;
&lt;p&gt;After some browsing I discovered &lt;em&gt;Hugo&lt;/em&gt; to be a neat framework for building this blog, which I would develop with CC. I use CC as lazily as possible, accepting pretty much any change. I know it&amp;rsquo;s possible to intervene, but I didn&amp;rsquo;t.&lt;/p&gt;
&lt;p&gt;In an empty directory, I ran &lt;code&gt;git init&lt;/code&gt;, followed by &lt;code&gt;claude&lt;/code&gt;. Then I started prompting.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt; &lt;em&gt;I want you to create a blog for me that I can self-host in Docker Compose. I found Hugo to be a fitting framework for this.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This generated the following files:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-stdout" data-lang="stdout"&gt;Makefile
README.md
blog/
blog/config.toml
blog/content/
blog/content/about/
blog/content/about/index.md
blog/content/posts/
blog/content/posts/first-post.md
blog/data/
blog/layouts/
blog/static/
blog/static/images/
blog/themes/
docker-compose.prod.yml
docker-compose.yml
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Not too bad at first glance. But when I looked into the project I found stuff like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;❯ cat Makefile
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-Makefile" data-lang="Makefile"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;.PHONY&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; dev build prod clean
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Development server
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;dev&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; docker-compose up -d
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Install Ananke theme
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;install-theme&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; docker-compose exec hugo sh -c &lt;span style="color:#e6db74"&gt;&amp;#34;cd /src &amp;amp;&amp;amp; hugo mod get github.com/theNewDynamic/gohugo-theme-ananke&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Create a new post
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;new-post&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; docker-compose exec hugo sh -c &lt;span style="color:#e6db74"&gt;&amp;#34;cd /src &amp;amp;&amp;amp; hugo new posts/&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;title&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;&lt;span style="color:#e6db74"&gt;.md&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Build static files
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;build&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; docker-compose exec hugo sh -c &lt;span style="color:#e6db74"&gt;&amp;#34;cd /src &amp;amp;&amp;amp; hugo --minify&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Run production environment
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;prod&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; docker-compose -f docker-compose.prod.yml up -d
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Stop containers
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;stop&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; docker-compose down
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Stop production containers
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;stop-prod&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; docker-compose -f docker-compose.prod.yml down
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Clean generated files
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;clean&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; rm -rf blog/public
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; rm -rf blog/resources
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It had so many extra options in there already. Same in &lt;code&gt;README.md&lt;/code&gt;. For some reason it already required a theme. However, I told myself that it&amp;rsquo;s not a big deal. I was confident I could fix that with CC.&lt;/p&gt;
&lt;p&gt;I don&amp;rsquo;t like depending on a third-party Docker image (Hugo doesn&amp;rsquo;t offer their own as far as I know), so I&amp;rsquo;d want to replace that with some logic to build my own image. It would need a &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; as well. I fired CC up again, then ran &lt;code&gt;/init&lt;/code&gt; as there was something to work with for CC.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt; &lt;em&gt;I don&amp;rsquo;t need a theme just yet. I also want to have my own Dockerfile, so I can generate a new image when I want. Also, please add a &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; to do that automatically.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This removed the theme, adds a &lt;code&gt;Dockerfile&lt;/code&gt;, &lt;code&gt;.gitlab-ci.yml&lt;/code&gt;, and expands the &lt;code&gt;Makefile&lt;/code&gt;. That looks like what I requested, but I had to verify. When I checked &lt;code&gt;Makefile&lt;/code&gt; I saw it now had &lt;code&gt;docker-build&lt;/code&gt; and &lt;code&gt;docker-run&lt;/code&gt; which both did not use &lt;code&gt;docker-compose&lt;/code&gt;, quite strange. This is where I realized that CC hadn&amp;rsquo;t updated any of the &lt;code&gt;docker-compose*.yml&lt;/code&gt; files either.&lt;/p&gt;
&lt;p&gt;Hopefully the &lt;code&gt;Dockerfile&lt;/code&gt; is better:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-Dockerfile" data-lang="Dockerfile"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;FROM&lt;/span&gt; &lt;span style="color:#e6db74"&gt;klakegg/hugo:0.101.0-ext-alpine&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;as&lt;/span&gt; &lt;span style="color:#e6db74"&gt;builder&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;WORKDIR&lt;/span&gt; &lt;span style="color:#e6db74"&gt;/src&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;COPY&lt;/span&gt; ./blog /src&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;RUN&lt;/span&gt; hugo --minify&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;FROM&lt;/span&gt; &lt;span style="color:#e6db74"&gt;nginx:alpine&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;COPY&lt;/span&gt; --from&lt;span style="color:#f92672"&gt;=&lt;/span&gt;builder /src/public /usr/share/nginx/html&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;EXPOSE&lt;/span&gt; &lt;span style="color:#e6db74"&gt;80&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;CMD&lt;/span&gt; [&lt;span style="color:#e6db74"&gt;&amp;#34;nginx&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;-g&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;daemon off;&amp;#34;&lt;/span&gt;]&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Well&amp;hellip; that&amp;rsquo;s still the same image, but it just added the results to NGINX.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; was okay, but definitely not great. It wanted to use Docker-in-Docker (dind), but I prefer &lt;em&gt;kaniko&lt;/em&gt; right now. I figured it would be weird to expect CC to guess that based off my prompt.&lt;/p&gt;
&lt;p&gt;At this stage I already looked around the Hugo docs for information on how to run it to get it sorted like I actually wanted it. Quite difficult to get that right in a quick prompt. I had more features I want to add to the project, but I didn&amp;rsquo;t want to overwhelm CC either. So, I kept it to a couple of small tasks again.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt; &lt;em&gt;I don&amp;rsquo;t want to use that Hugo image, nor do I want to use NGINX. Let&amp;rsquo;s make sure to fetch the latest version of Hugo in the Dockerfile. Also, I want to use kaniko instead of dind.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This removed the dependency on a third-party image and tried to build everything in the repository onto an &lt;code&gt;alpine:latest&lt;/code&gt; image, then copy the &lt;code&gt;public&lt;/code&gt; files to a &lt;code&gt;scratch&lt;/code&gt; image. However, it didn&amp;rsquo;t copy an executable that would be able to serve the files over HTTP.&lt;/p&gt;
&lt;p&gt;I iterated over this for a while, copying the Hugo CLI commands&amp;rsquo; help into CC, explaining I want to load documents separately from building the image (so the &lt;code&gt;hugo&lt;/code&gt; executable had to be running with &lt;code&gt;--watch&lt;/code&gt; or &lt;code&gt;--poll&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Overall, this part was quite tough for CC. Eventually I got it to a point where I could use a Docker volume to update the blog without needing to rebuild the image. But it took significantly more time than it would have if I had made this myself. Plus, CC snacked on a lot of Anthropic credits, money which I could have used for snacks myself.&lt;/p&gt;
&lt;p&gt;But! There is a part where it did work out well for me.&lt;/p&gt;
&lt;h2 id="i-dont-enjoy-front-end-work"&gt;I don&amp;rsquo;t enjoy front-end work&lt;/h2&gt;
&lt;p&gt;I work mostly in the area of DevOps and Software Engineering, so occasionally I have to create some front-end stuff. This is where CC shined for me. It was good enough to interpret my prompts for formatting RSS properly, give the blog a general simple and minimalist style. I barely had to correct CC to get what I wanted (or at least close enough, did I mention I don&amp;rsquo;t enjoy front-end work?), even for a mobile view.&lt;/p&gt;
&lt;h2 id="ramble"&gt;/Ramble&lt;/h2&gt;
&lt;p&gt;I rambled enough on what I went through. Overall, my experience with Claude Code was a mixed bag. For targeted front-end tasks where I lack expertise and interest, it proved to be a valuable assistant that saved me time and frustration.&lt;/p&gt;
&lt;p&gt;However, for architecture decisions, Docker configuration, and working with existing codebases, CC still has significant limitations in my opinion. The tool seems best suited for standalone components, simple scripts, or helping developers work in unfamiliar domains - not for complex system design or maintaining large projects.&lt;/p&gt;
&lt;p&gt;For now, I&amp;rsquo;ll keep using CC for the stuff I feel it&amp;rsquo;s good at for me, like the frontend stuff. It may get better after a while, after a few iterations from Anthropic. CC is a neat assistant but definitely not a replacement for actually knowing what you&amp;rsquo;re doing. At least I got a blog out of it!&lt;/p&gt;
&lt;p&gt;Maybe I&amp;rsquo;ll write something on the relationship between tutorials and AI-generated code in the future. I still think there is something worth exploring between how these models generate verbose, tutorial-like code and what they&amp;rsquo;re trained on. Until then, I&amp;rsquo;ll be tweaking my blog and trying not to blow more credits on CC-written Docker configs&lt;/p&gt;
&lt;h2 id="links"&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/news/claude-3-7-sonnet"&gt;Anthropic released a tool called Claude Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gohugo.io/"&gt;Hugo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/GoogleContainerTools/kaniko"&gt;kaniko&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>