<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Engineering on mapletree.moe</title><link>https://mapletree.moe/tags/engineering/</link><description>Recent content in Engineering on mapletree.moe</description><generator>Hugo -- 0.160.1</generator><language>en-us</language><copyright>This work is licensed under the MIT0 License.</copyright><lastBuildDate>Thu, 29 Oct 2026 17:00:00 +0900</lastBuildDate><atom:link href="https://mapletree.moe/tags/engineering/index.xml" rel="self" type="application/rss+xml"/><item><title>Lifecycles are Important</title><link>https://mapletree.moe/posts/lifecycles-are-important/</link><pubDate>Thu, 29 Oct 2026 17:00:00 +0900</pubDate><author>bakayuki</author><guid>https://mapletree.moe/posts/lifecycles-are-important/</guid><description>&amp;lt;no value&amp;gt;</description><content type="text/html" mode="escaped"><![CDATA[<h1 id="oops">Oops<a href="#oops" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<p>I use a lot of object storage. Not a lot from the perspective of (insert your
favorite example tech company here), but for a private user/small community
manager, a good amount. Looking back over things, my spend this year peaked at
about 35 euro in a 30 day period, which at my current pricing is about 5.8TB.</p>
<p>Most of that goes toward the &ldquo;Tokisaki Memory Engine&rdquo; I run, which is really
just a fancy name for kopia plus a dedicated repo server, and some special
sauce that is usually lost in the weeds, like object locking, restricted keys,
etc. We even have automated daily testing of restores to <code>/dev/null</code>. Neat!</p>
<p>The main goal is to let someone get all the benefits of kopia with just an
username and password, while only giving up the same thing they give up with
most other cloud storage providers (Mainly the fact that if I really <em>really</em>
wanted to, I suppose I could look through your stuff, but it&rsquo;d be damn
obnoxious to do because of how the server works, and its built that anyone
could catch me at any time, so, why bother).</p>
<p>I migrated last year to Hetzner&rsquo;s Object Storage after B2 became VERY UNHAPPY
with how many API calls my little harness around kopia uses. The migration was
kind of in a rush, and I forgot some things!</p>
<p>This won&rsquo;t detail all the fun that I have had growing tokisaki-v4 along-side
Hetzner&rsquo;s Object Storage (which has been having its own growing pains), but
a fun little oops I just found.</p>
<h2 id="huh-thats-weird">Huh, that&rsquo;s weird<a href="#huh-thats-weird" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<p>So after fixing some earlier corruption this year and reaching out to Hetzner
and making everything kosher, I&rsquo;ve been trying to keep a close eye on things
and I noticed today that while kopia was reporting <code>75272 blobs (1.7TB)</code> under
management, the hetzner dashboard was showing <code>174782 blobs (2.5TB)</code> (!!) under
that bucket.</p>
<p>That&rsquo;s weird!</p>
<p>So I go to list any &ldquo;incomplete multipart uploads&rdquo; or &ldquo;delete markers&rdquo; or any
file with a version that isn&rsquo;t current.</p>
<p>Huh I only have 86 unfinished multipart uploads. That&rsquo;s not too bad!
Wait.. there&rsquo;s 86 delete markers too? Weird, but that could make sense&hellip;
&hellip;there&rsquo;s 86 old version files&hellip;</p>
<p>Hey, did you know that hetzner paginates <em>massive</em> responses into groups of
86? Me neither!</p>
<h2 id="but-why">But why<a href="#but-why" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<p>This shouldn&rsquo;t be a thing. See when you build an object locked bucket on top
of kopia, it&rsquo;s a little weird because its actually <strong>kopia</strong> that manages the
object locking. It&rsquo;s really not advised that you have the bucket do it, because
kopia&rsquo;s maintenance wants to touch those flags (Side note: this urge to touch
all the flags was a source of GREAT SUFFERING for me earlier this year). So
what you do instead is designate the object locking to kopia and write a policy
to manage object lifecycle.</p>
<p>You did write a policy to manage object lifecycle right?</p>
<h2 id="whats-a-lifecycle">What&rsquo;s a lifecycle<a href="#whats-a-lifecycle" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<p>Excellent question. A lifecycle is the cycle of life of an object.</p>
<p>Now that that&rsquo;s cleared up&hellip;</p>
<p><em>(A lifecycle is a set of policies that tell the backend processes running an
object storage provider when it should clean things up. If you enable
versioning, but forget to write a lifecycle policy, you&rsquo;ve basically created
a world with aging and disease but missing the grim reaper. There&rsquo;s excellent
fiction written about this. NONE OF THEM END WELL)</em></p>
<h2 id="a-quick-migration">A quick migration<a href="#a-quick-migration" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<p>Apparently when I was moving over from B2, I set everything up correctly but
forgot to write a lifecycle policy and apply it to the bucket. This means that
for OVER A YEAR, kopia has been dutifully pronouncing files deceased, shoving
them in a body bag, tagging them with a 90 day tag that says &ldquo;only send to the
mortuary after this date, just in case we need to do anything else with the
body&rdquo; then shoving them in the file freezer.</p>
<p>Except the hearst has just.. never pulled up. What, you think that&rsquo;s kopia&rsquo;s
job? Kopia&rsquo;s job ends after chucking the file into the body bag and putting
it away. It&rsquo;ll keep piling the dead up inside that freezer all day long, likely
while complaining about the terrible service from the Hetzner funeral home, and
then will cheerily report &ldquo;All&rsquo;s well!&rdquo;</p>
<p>A quick back of the envelope calculation reveals this has likely cost me well
over 70 euro throughout the past twelve months.</p>
<p>So yeah!</p>
<p>Lifecycles are important!</p>
]]></content></item><item><title>Creativity vs. Engineering</title><link>https://mapletree.moe/posts/creativity-vs-engineering/</link><pubDate>Sun, 25 Oct 2026 02:30:00 +0900</pubDate><author>bakayuki</author><guid>https://mapletree.moe/posts/creativity-vs-engineering/</guid><description>&amp;lt;no value&amp;gt;</description><content type="text/html" mode="escaped"><![CDATA[<h1 id="i-cant-sleep">I can&rsquo;t sleep<a href="#i-cant-sleep" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<p>Japan is perhaps the only country I have lived in where sleep promoting drugs
are more readily controlled than stimulants (I can get 60mg of methylephedrine
otc without even needing to talk to a pharmacist, but melatonin is a
prescription). They also <em>love</em> what we would call &ldquo;kitchen sink&rdquo; drugs in US
pharmacy practice. The flu medicine I am taking has 6 active ingredients, 3 of
which are straight up stimulants. Yes, you are supposed to take it three times
a day even in the evening.</p>
<p>So, as I lay awake at 2AM desperate for sleep that simply won&rsquo;t come, my mind
was going back through a conversation I had with some friends earlier about
creativity in coding. This is an attempt to explain why I don&rsquo;t see what <strong>I</strong>
do as creative, even though I do agree creativity is very much a part of
coding. It is also an attempt to make me tired enough that I fall asleep.</p>
<p>I don&rsquo;t expect this to convince anyone, just explain my thinking on it.</p>
<h2 id="creativity-vs-engineeringtechnical-work">Creativity vs. Engineering/Technical Work<a href="#creativity-vs-engineeringtechnical-work" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<p>One of my favorite youtubers is &ldquo;Wristwatch Revival.&rdquo; As you can undoubtedly
tell from the name, he&rsquo;s a watchmaker who does videos on restorations of old
watches. Shockingly, most mechanical watches need very little restoration work
to get running again, outside of a &ldquo;service.&rdquo;</p>
<p>A service is very simply: fully disassemble the watch down to its smallest
components, clean them (either with a special machine or in an ultrasonic),
inspect the parts for any rust or breakage, put the watch back together.</p>
<p>While this is extremely skilled work, and Marshall demonstrates an incredible
amount of patience, I struggle to call a plain service creative work. Every
mechanical watch is made up of the same standard components, arranged in well
defined ways, and the goal is just to swap out any bad ones, and then lubricate
and re-assemble them. This is technical work, bordering on engineering work.</p>
<p>Where Wristwatch Revival becomes creative is when there is major damage to a
watch. There have been episodes where he needs to restore a dial without
causing further damage, or needs to reloom or reblue the hands, and bluing in
particular requires an eye for what colors match and the skill to get the metal
to that temperature without exceeding it. There are also cases where a standard
service my go awry, and that requires creative thinking to resolve.</p>
<h2 id="i-dislike-creative-solutions">I dislike creative solutions<a href="#i-dislike-creative-solutions" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<p>In about 90% of my projects I ruthlessly cut out any solution that I come back
to later and think &ldquo;that was clever.&rdquo; It&rsquo;s not because I hate the feeling of
being clever, it&rsquo;s because of a concept called &ldquo;innovation tokens.&rdquo;</p>
<p>In <a href="https://mcfunley.com/choose-boring-technology">Choose Boring Technology</a>, Dan McKinley writes about the benefits of
choosing boring technology. Boring is not to be conflated with &ldquo;bad,&rdquo; though
boring bad technology does exist. Boring is defined as a technology which is
clearly understood, has been around for a while, and is &ldquo;good enough&rdquo; for the
problem you are facing. Every time you decide to go with something new, or
fast moving, or still in the process of being understood, you are spending an
&ldquo;innovation token&rdquo; and depending on the size of your company or project, you
have a finite number of those and they don&rsquo;t come back for a very long time.</p>
<p>My biggest project to date is <code>yukari</code> and I have spent about two years of my
life building it after getting burned by multiple &ldquo;creative&rdquo; solutions to
self-hosting. <code>yukari</code> is boring, and I don&rsquo;t really consider any part of it
to be creative. It is <em>unusual</em>, however, because it is so boring that most
companies or home labbers just build their own version of <code>yukari</code> that does
only what they want it to do, and then keep it to themselves. The unusual part
of <code>yukari</code> is that I&rsquo;m building it to be used by probably 10 other people on
the planet, max, and when they find it I want them to have a nice experience.</p>
<p>The first component of <code>yukari</code> is <code>yukari-canon</code>. <code>yukari-canon</code> is able to
manage an arbitrary number of servers, either physical or cloud based, as a
single distributed system.</p>
<p>All of <code>yukari-canon</code>, save for two areas so far, is boring technology:</p>
<ul>
<li>It is written in <a href="https://en.wikipedia.org/wiki/Ansible_(software)">ansible</a>, which was started in 2012 and is now owned
by RedHat, arguably the most boring example of Linux. That&rsquo;s why IBM bought
them.</li>
<li>It expects RedHat Enterprise Linux, or a clone.</li>
<li>It expects <code>podman</code>, the open source alternative to docker that is mature.</li>
<li>The software selection for containers is all boring, well used, FOSS
software.</li>
<li>The mesh network I selected was <a href="https://theorangeone.net/posts/nebula-intro/">nebula</a> which was developed by Slack
before being fully open sourced.</li>
<li>Security is based on the CIS Level 2 Standard, which again, is ancient and
well understood.</li>
<li>Instead of inventing the wheel, I used fedora.linux_system_roles, which is
the upstream of RedHat Enterprise Linux&rsquo;s ansible roles, so its used in prod.</li>
<li>Notifications are sent via email, using postfix as a null-relay.</li>
</ul>
<p>There are two places that I spent my innovation tokens:</p>
<ul>
<li>The <code>ran</code> helper, which is written in python (despite me hating python),
because python is boring and needed for ansible. <code>ran</code> is a series of scripts
that automates the most tedious parts of getting up and running, like secret
generation.</li>
<li>The logic for configuring the *arr stack, since every software I looked at
that did that was essentially abandoned.</li>
</ul>
<p>90% of the 20k lines of code is just &ldquo;glue.&rdquo; Connect this standard component
to that standard component.</p>
<p>When I ran into issues that seemed like they needed a clever solution, I
avoided the clever solution by a mile:</p>
<h3 id="backups">Backups<a href="#backups" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>Every person on the planet has written some kind of homelab backup software
and open-sourced it for docker/podman containers. Essentially all of them have
&ldquo;untar and copy&rdquo; as the restore step, and no way of validating the data on
recovery is the same as what went into it. Alternatively, they have ballooned
wildly in scope.</p>
<p><code>yukari-backup</code> is just a 600 line bash script that uses <code>pg_dump</code> or <code>tar</code>
combined with <code>sha512sum</code>, <code>zstd</code>, <code>age</code>, and <code>rclone</code> for uploading to the
cloud. None of this is revolutionary. I&rsquo;m still honestly annoyed it doesn&rsquo;t
already exist. It has a full test harness that is centered around testing
restores on an actual container running actual software, and intentionally
injecting crap everywhere to make sure the assurances <code>yukari-backup</code> makes
are tested.</p>
<p>Everyone wants <em>retention</em>, or <em>deduplication</em>, or <em>incremental</em> backups. I
like those things, but if you&rsquo;re using S3 you have object lock and compliance
mode for free. That&rsquo;s your retention settings. For deduplication, to me, you&rsquo;re
immediately needing to introduce checking, because one bad deduplicated block
ruins every backup. For a sane retention window in homelabs/containers, you
are likely spending under a dollar or two for hosting unless god forbid you&rsquo;re
on AWS.</p>
<p>A backup is just a bash pipe:</p>
<p>pg_dump/tar -&gt; zstd -&gt; age -&gt; rclone</p>
<p>A restore just reverses the process. There is a manifest file that records
the sha512 of the original, pre-compression/encryption data and the filesize
to detect any issues. The manifest is written last. Something fails during
the upload? A manifest isn&rsquo;t written, the backup can&rsquo;t be used without a
manifest, the restore doesn&rsquo;t even see it. The errored backup is rotated out
by your compliance settings.</p>
<p>It&rsquo;s very dumb. In a good way. Its also done. It doesn&rsquo;t need any new features.
It doesn&rsquo;t need to keep growing. Its tested, I did a real fire drill with it,
it worked perfectly. It will live as version 0.1 indefinitely. I guess I should
bump that to 1.0, but that would feel weird and arbitrary.</p>
<h3 id="file-downloads">File Downloads<a href="#file-downloads" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>There are so many solutions available to containerized file downloaders for
a server. Copyparty is well known, and very creative! SFTP2Go is closer to
what I wanted, but again has its own user management system.</p>
<p>Every downloader container wants to be a downloader and a user manager. Or
a downloader and a cloud storage system. Or a downloader and <!-- raw HTML omitted -->.</p>
<p>I have a user database, I have a cloud storage system. This is just meant to
allow a registered user a way to log in and pipe things from a server. That&rsquo;s
it.</p>
<p>There is basically no container that satisfies that. Which is crazy to me.</p>
<p>I created a container that is a mini alma-linux container, that runs an
SFTP server. It also has PAM and SSSD running on it. The container then uses
RFC2307bis to authorize users from an ldap database. This is not a creative
solution. It boggles my mind that this doesn&rsquo;t exist as a ready made container,
but the main reason is most companies probably just built it themselves,
because it&rsquo;s an obvious solution.</p>
<p>RFC2307 is from 1998. SFTP is arguably as old. Boring technology.</p>
<h2 id="is-any-of-this-creative">Is any of this creative<a href="#is-any-of-this-creative" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<p>IDK. Maybe? To me, it feels more like servicing a watch. Maybe it&rsquo;s just that
I&rsquo;ve been in linux for 25 years now, but all of these parts were already there.
There&rsquo;s no need to re-invent the wheel for any of these. Hilariously, I think
that leads to basically every company that needs one of these solutions
reinventing the wheel, because it doesn&rsquo;t exist pre-shaped.</p>
<p>Essentially all of my projects, even what I&rsquo;m doing at work follows the same
pattern:</p>
<ol>
<li>Read as much of the relevant research as I can</li>
<li>Identify any relevant RFC/ISO standards that define parts of the problem</li>
<li>Read the example code and the standards</li>
<li>Follow the standards.</li>
<li>If a software package doesn&rsquo;t exist, or if it exists but some company has
monopolized it or is charging an insane fee (Looking at you, translation
memory systems), just.. build that myself, usually with the most bog standard
UI you can imagine.</li>
<li>Get feedback, especially on UI/UX</li>
<li>Iterate</li>
</ol>
<p>Most of my design decisions, either in a personal project or a work project,
come down to saying no:</p>
<ul>
<li>&ldquo;no, we don&rsquo;t need that.&rdquo;</li>
<li>&ldquo;no, that&rsquo;s out of scope.&rdquo;</li>
<li>&ldquo;no, that&rsquo;s solving a problem we don&rsquo;t have.&rdquo;</li>
</ul>
<p>(N.B. I am not immune to this. The first version of <code>ran demo</code> created a whole
virtual network running a virtual runner and a virtual server, with a router
and a whole bunch of other stuff. Then I came back to it the next day, wondered
what the hell I was doing, and deleted 70% of it and the remaining 30% became
the single VM demo that exists now. &ldquo;no&rdquo; is important to tell yourself too.)</p>
<p>I don&rsquo;t think I have ever written a completely novel piece of software, or
even an original piece of software. I&rsquo;d rather glue together pieces made by
people much more competent than me.</p>
<p>I like creative software, as in I like <em>using</em> creative software. I don&rsquo;t
personally want to create anything that gets called &ldquo;clever&rdquo;. Because then I
would need to be clever to maintain it.</p>
]]></content></item></channel></rss>