Gotchas with static sites on S3 via CloudFront

There’s a ton of posts already on how to set up static sites hosted on S3 via CloudFront. This isn’t going to be one of them. What I want to discuss is some weirdness that I encountered with setting up this blog. For the purpose of this post we’re going to assume that you are going to create a hypothetical static site: https://example.com If you host a static site on hardware, or a VPS (be it an EC2 instance or a DigitalOcean Droplet) you’ll most likely do this with one of the various available web servers, like nginx or apache, and use a service like Let’s Encrypt to create the TLS certificate....

Diceware passphrase generator

There are many ways to generate passwords, and to avoid passwords in the first place (which you really should do), but I wanted a little practice in writing interactive bash scripts. So I chose to create a password generator based on the Diceware algorithm, even though I don’t carry any dice with me. Find of the day is the excellent gum tool that makes it easy to create pretty user interaction....

Good-enough leader election with MySQL

Leader election, in distributed computing, is the process of designating a single process as the organizer of some task distributed among several computers (nodes). Before the task has began, all network nodes are either unaware which node will serve as the “leader” (or coordinator) of the task, or unable to communicate with the current coordinator. After a leader election algorithm has been run, however, each node throughout the network recognizes a particular, unique node as the task leader....

GitHub Actions for Build & Release

I like to write code, build, and release tooling, for my brain at 3 AM. No surprises, no clever bits to trip me up. Lately I’ve been playing with GitHub Actions to build and deploy some of my public projects. It took a little while to figure out something that I could copy and paste between them, and I’d like to share what I’ve managed to come up with. Build Actions Committed to your project as ....

Switching from Jekyll to Hugo

As you can tell, I’ve switched this blog from Jekyll to Hugo since its entire toolchain comes in a single downloadable binary. I don’t need bells and whistles, and the Paper theme makes it look like I still know how to make pretty things. While Hugo has the hugo new generator, and it works really well, I wanted to preserve the hugo import jekyll migrated filename pattern. Time for a new skeleton script, this time in ruby because I used bash in the last one....

Standalone mode for Redis clients

I’ve been playing around with using an in-process redis using miniredis as the backing store for a service that relies on go-workers2 for background processing. You can find the code in my example-miniredis project on GitHub. While miniredis was created as something to be only used in unit tests, this may be useful in running a service that normally requires a redis in a totally standalone mode. I view such a standalone mode as critical for a good development experience in creating integrations against a service, since you can run the service locally without any of its downstream dependencies and still expect to have it respond sensibly....

gRPC server & grpc-gateway authentication

It has taken me far too long to figure out all the minute details of how to apply authentication to gRPC-based services, how to do that using the HTTP/JSON grpc-gateway, and then how to run a gRPC server and a grpc-gateway side-by-side using the same service instance in a way that makes sense to me. There’s a surprising amount of detail that is not documented and there are a few gotchas for the unwary traveller....

Golang SQL Boilerplate

My day job currently includes writing and maintaining golang services. It’s not a bad language, and it certainly forces you to understand that everything will fail, far more obviously than Java’s checked exceptions. I’m not going to argue about the utility of checking/returning error instances, but I do find myself writing the same code over and over again, especially when I’m handling any SQL operations. So I’ve come up with a couple of templates to remove a bunch of the boilerplate code for transactions and for looping over SQL query result rows....

Prometheus OpenLDAP Metrics Exporter

I’ve recently been involved with integration and administration of an OpenLDAP cluster, and was a little dismayed at the state of monitoring of OpenLDAP. You can certainly get good machine metrics using the Prometheus Node Exporter, but there wasn’t really anything good for OpenLDAP-specific metrics aside from an interesting project based on python. This exporter had some really good ideas, but I baulked at installing and running twisted python, irrespective how good it is, on slapd nodes....

Create new posts in Jekyll

I use Jekyll to create this blog, but creating new posts has been a bit of a pain, since you have to create the post files by yourself. To make it easier, here’s my script that generates a skeleton post file: #!/bin/bash set -euo pipefail if [[ $# -eq 0 ]]; then TITLE="-h" else TITLE="$*" fi if [[ "${TITLE}" == "-h" ]]; then echo "Generate a new Jekyll post" echo "Usage: ....