Unifi Doorbell: Round 2
It hasn’t quite been two years - but it’s close enough that timeago.js, which I use to make the timestamps on my blog prettier, reckons it has been - since we bought a Unifi doorbell, after which I pulled the old intercom out of the wall, cut a tiny rectangle hole in a scrap piece of varnished shelving timber, screwed it to the wall and went “yep, that works until I get the time to do it properly”.
You know how shit goes, it took forever for me to find time to do it properly. It looked like arse the entire time. I am, in retrospect, gutted I did not take any before photos, so I have neither photos of the “1990s finest technology intercom” nor the scrap piece of timber, but needless to say they both looked awful.
I found the brick mortar I’d bought for the process in the process of cleaning the garage out last week, so I decided that this weekend was the one, it was happening. So yesterday, after our usual choring, I went and bought some masonry bits and the anchors, pulled everything off the wall, drilled a couple of holes, absolutely ratfucked the masonry bit that was the correct size, momentarily considered trying a larger sized bit, re-terminated the RJ45 for the doorbell, and stuck it somewhat haphazardly in the new location and called it a day.
There were two striking problems with how I’d left it. First, the fucking great hole where the original intercom system was. Second, the Unifi angled mount requires a small recess where the cable goes in - the mount itself is not fat enough to sit flush against the wall, leaving me with a 4mm gap on the left side of it. Infuriating. The third, slightly less obvious issue, was that one of the anchor holes was only about 10mm deep, not really enough to get a good grip.
Still, I figured I could solve this, so before sitting down to play some video games for the night, I dropped one of the spare bricks from when they built our house which the previous owners very thoughtfully left behind the back shed for us into a bucket of water (as I’m told it would help the mortar cure better by stopping one of the bricks from wicking all the water away if it was waterlogged?).
Up this morning to walk the dog, and then immediately into it. I went to HammerBarn, bought two more decent 5mm masonry bits, mixed up some mortar and did my very best to brick it in nicely. I then took the masonry bits, drilled the holes the rest of the way so the anchors were secure, then used the drill bits to pre-drill some sections where I needed to recess it, and spent almost two hours with a hammer and chisel chipping away at the brick until it fit.
It was an absolute arseload of work, but the results look pretty good. You can definitely pick out where the brick was replaced (at least, I can), but only if you’re looking for it. If you just walk up, it does not draw your eye to it at all, so I’m pretty happy.
The best part? I can finally pull the plastic film off the front of the camera that I had left on because I knew it was not finished!
Garage Tidy Up #78912678
After spending all day playing video games yesterday and not accomplishing much else, I decided to get some chorin’ done. First, I spread out and raked in the box of garden seed I bought on the bare patches on the front lawn. It remains to be seen whether it will grow up enough to survive the summer heat this late, but I’m optimistic.
Next, I remembered that it’s been a good month now since I noted that the front of a couple of the servers and the UPS were a bit dusty, and I wanted to move the server rack back to it’s original position. Both of those things required everything to be shut down, so that’s what I did.
I cleaned it all out, rolled the rack across, re-routed the power cable and the ethernet drops, and stuck the GPS antenna (which I completely forgot about) to the window. While I had everything apart, I pulled the battery tray out of the UPS grog gave me and had a look at it. First of all, they’re not swollen, which is good. Second, they’re just CSB HR 1234W F2 batteries, which look fairly easy to get. I’ll reach out to Lachlan, who did our solar install, as he reckoned his supplier could probably beat anywhere else in Australia, and I’ll probably do those after Christmas. I contemplated leaving them disconnected, but that’s probably not that much safer and they do still hold a charge, just not a very big one, but enough to protect me from a short blip.
Anyway, when it was all said and done there isn’t actually noticeably more space in the garage. Sabriena came out and was decidedly unimpressed with my effort, however it’s actually much more sensibly laid out, and next weekend hopefully I can get to organizing some of the storage and that’ll actually make room. Also I found about four different tools we’d been looking for, so that’s a win.
Kubernetes Readiness Probes: Apparently Too Difficult
I like to joke that burning yourself with lit cigarettes is too expensive in Australia, and sometimes you just need to feel, so I run Kubernetes at home. I jest, of course, for the most part it’s fairly pain-free now I’m over the hump of figuring things out for the first time.
But one of the minor pain points is that when I update the containers for Mastodon, I spend several minutes getting either a 404 or a 502 from Traefik, every time… and in principle, this shouldn’t happen.
So what am I doing wrong? The first thing I figured I was doing wrong was only having less than 2 replicas (or in what humans would describe it, no replicas at all), but that on it’s own didn’t help anything.
After chatting it over with some folks on Discord, lamenting that one day I should figure this out, they mentioned liveness probes, which is the obvious sounding solution to it, and it kinda worked - but the second time around the container got shot-down because rails takes forever to fucking start for some unholy reason. I tried increasing the initial delay, and that failed too, because Mastodon’s rails server is just that fucking slow to start up (the cli is patently unusable for me, it just takes days to spin up).
But what I didn’t realize at the time (because I have the attention span of a goldfish and didn’t read all the documentation before trying shit) was that liveness isn’t the only thing you can control, they have “startup” probes as well, which are similar but different: startup is checked when the container first boots, and only when the threshold is met, is the container considered “up”, and then liveness probes are just checked to see if the pod is healthy.
So in the end, this appears to have done the trick:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
...
livenessProbe:
httpGet:
path: /health
port: web
httpHeaders:
- name: server
value: Mastodon
failureThreshold: 2
periodSeconds: 10
startupProbe:
httpGet:
path: /health
port: web
httpHeaders:
- name: server
value: Mastodon
failureThreshold: 30
periodSeconds: 10
Note the missing z from the Kubernetes documentation - Mastodon exposes a short, light /health endpoint, so that’s the one I use. I probably don’t need to check the headers, but I figure I might as well, and there may be some additional thing I could check to make sure it’s working, but for now this seems good enough.
This makes it wait up to 5 minutes for rails to start (which should fucking be enough) before 2 failures in 20 seconds is enough to shoot the pod down for misbehaving. I could look into using readiness instead of liveness (which just doesn’t send traffic to the pod instead of killing it to restart it), but I’m not sure that matters for my use case.
But the result was that the update to 4.5.0 kept the whole shebang running without a 404 or 502, which was nice.
Font Awesome minification, Take 1
As mentioned when I switched over to PicoCSS as a CSS framework for this site’s theme, unless I include an image on one of the first X (where X is currently 4) most recent posts on the front page, by far the biggest inflator of my site’s transferred size is CSS and fonts related to Font Awesome. I only use about 7 of the glyphs from two sets, but that results in me loading 600KB (uncompressed) of fonts for glyphs I don’t care about, along with a pile of extra CSS (to the tune of about another 180KB uncompressed). Of course, gzip or brotli does a fine job of compressing this, but that’s not the point, damn it.
Naturally, they offer a subsetting feature, which requires their Pro plans or higher, and that’s $120/year… much more than I need to spend, I feel like that’s more intended for designers and so on who will use it frequently.
But I can do it myself right? Near as I can tell, the icons are CC-BY, the fonts are SIL OFL, and the CSS is MIT-licensed. So as long as I don’t call it something else and pretend it’s not Font Awesome, I think I’m in the clear to modify and redistribute the files? So I think legally and ethically I’m good.
But what about technically? Turns out it’s fairly easy on the font side of things:
# Set up fonttools
python -m venv venv
source venv/bin/activate
pip install fonttools
# Build the regular FA set
fonttools subset ~/src/fwaggle.org/themes/pico/static/webfonts/fa-solid-900.ttf \
--unicodes=U+F00B,U+F13E,U+F02C,U+F1B9,U+F11B,U+F6FF,U+F007,U+F062 \
--layout-features='*' \
--output-file=/home/fwaggle/src/fwaggle.org/themes/pico/static/fonts/fa-regular-fwaggle.ttf
# And the four from fa-brands I use as well.
fonttools subset ~/src/fwaggle.org/themes/pico/static/webfonts/fa-brands-400.ttf \
--unicodes=U+F4F6,U+F09B,U+F1B6,U+F08C \
--output-file=/home/fwaggle/src/fwaggle.org/themes/pico/static/fonts/fa-brands-fwaggle.ttf
First of all, note that fonttools doesn’t normalize the ~ so you have to specify the full path to your file.
Grabbing the lists of glyphs is a little bit repetitive but otherwise trivial. They’re referenced as say "\f00b" in CSS, that corresponds to U+F00B (not sure capitalization is required, but I did it anyway), and then it’s just a comma separated list. Depending on your OS, you might be able to read them in the little square if it’s an undefined glyph too.
I’m not actually sure the ligatures etc (--layout-features='*') are required, but I’m fairly sure they’re not already defined in the font anyway so leaving it in there doesn’t hurt anything.The result is a pair of minimal font files that are about 5KB combined. I wonder if it’s possible to concatenate them into a single font file? Doesn’t matter though.
Next up, hacking up the CSS. First, I removed any references to the WOFF2 format (I could subset those too, but meh, it works with just TTF format) and updated the URLs to my changed files.
Then, I went through and hacked out all the transitions - I don’t use them, honestly I didn’t know they were a thing, and they weigh about 80KB of uncompressed CSS on their own.
The rest of it is scaffolding, which breaks if you remove it, and definitions of individual styles that reference the unicode codepoints that the glyphs occupy, like this:
.fa-list::before {
content: "\f03a"; }
As you can imagine, they’re not very big, but what I could do is go through and throw all those away and only keep the ones I’m using. But do I care? I’ve gone from 600KB to less than 100KB. I could potentially get that down a bit but I’m skeptical I’ll get it below 50KB. I’m fairly sure my front page is under half a megabyte now if there’s no photos.
And I don’t think I’ve broken anything, but we’ll see when I push it to the live site (it works locally anyway).
Beanie: benign bump
Sabriena noticed some time ago a small bump on our dog Beanie’s left flank, that felt something like a hard pimple. We then noticed a week or so ago that it had grown a bit, so in to the vet this Tuesday to have them check it out.
Upon their advice, we opted to have an “aeration”, which is apparently the same thing as a biopsy but instead of cutting off a chunk, they take an empty syringe and use it to pull out several samples, put it on slides, and send that off to the lab. Our vet doesn’t have a lab internally (in a town of ~18,000 people this is no surprise) so it would be a few days.
The vet called on Friday morning, telling us that it doesn’t appear to be malignant - it’s most likely a subcutaneous follicular cyst, apparently fairly common in dogs. Completely fine to leave it for now, if it gets too large and/or annoying for her we can have it removed and it probably won’t come back, but there’s no reason to subject the dog to surgery right now.
