Posts Tagged "Programming"

Computer programming; largely regarded as a big mistake

Use A Makefile To Build Container Images

I recently replatformed the site from the Digital Ocean app engine to a Hetzner VPS. I wrote about why I migrated off of Digital Ocean here. I decided to use Caddy as the web server because it made getting up and running with TLS nice and easy. During the migration, my domain's A and AAAA records were still pointed at the live Digital Ocean site so Caddy was not able to do the normal ACME style challenge with Let's Encrypt when creating my TLS certificates. Instead, I had to do a DNS challenge so I would not disturb my A and AAAA records. The DNS challenge with Caddy requires that you build a custom container image with the needed functionality specific to your registrar.

I used a Makefile with some well-structured targets and "stamp files" to generate a tar of the Caddy container image, and to deploy and install that image to my remote server. I was able to ensure that if the underlying containerfile was changed, then a new container image would be created, exported to a tar file, uploaded to my server, and then installed on my remote server. Make is able to navigate the dependency graph of your targets, and only perform the minimally required actions needed to get to a goal. Had I written a script to do all of this, I'd be building and deploying a container image every time - or even worse - I could miss a step. Now, I just type 'make' in the terminal and I don't have to think about what step requires what. Fantastic.

I'll explain how I strucutred my Makefile to get this done.

Learning Jujutsu

I am not learning to fight. I am learning the Jujutsu version control system! I've used git almost my entire programming career, and I've learned to use it well. Over the years I've acquired the ability to do rebase workflows, stacked branches, fixups, reordering, staging changes using git add -p, and many other things. I've got a whole mess of git command aliases I'm hoarding like some kind of Tolkien dragon. I've learned the magic spells but still aren't a master of them. Even armed with this secret arcane knowledge, git is still a very confounding and difficult tool to use.

JJ - the abbreviated name of Jujutsu - immediately solves many of the problems I encounter when using git. JJ has a markedly different set of ideas compared to git. Unfrtunately that means my git knowledge doesn't fully transfer, but I think that is alright. JJ actually makes a lot of that knowledge no longer needed. It is a much simpler tool to use and understand and I think that is really exciting.