Posts Tagged "Techno Esoterica"

Posts about esoteric tech stuff; best ignored and not encouraged!

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.

Remember Bookmarklets?

Remember bookmarklets? I remember getting online as a young person and being really amazed by the power of these. I hardly even knew what Javascript was back around the year 2000, but I knew these things were cool.

As I got older and started to work on the web I remember using some very powerful bookmarklets like Firebug Lite. It launched a trimmed down version of the Firebug developer tools suite in browsers outside of Firefox. That was a big deal back then when I was still having to make things work in internet explorer 7 and 8. It felt like magic.

Browsers are a lot different than they used to be. They are some of the most sophisticated pieces of software you may ever use. Today they have robust and powerful plugin and extension ecosystems that make the magic of bookmarklets feel pretty ancient. Extensions are simply more powerful. They integrate much better to the browser, as well as the pages they work on. Extensions can do a whole log of things that bookmarklets just cannot do. Extensions can access protected browser features like dedicated storage, background processing, tab and window control, etc.

Extensions are really impressive and useful kit for anyone using a web browser. Sometimes though, you just need to throw a little javascript at a page to make it do something. That's where bookmarklets still shine. I don't need a whole extension to generate a link to specific text on a page, but I can do that with a bookmarklet pretty quickly. Those are the kinds of bookmarklets I want to collect: things that enhance the page I'm on, or fix the page I'm on, but don't require access to the browser features that extensions offer.

It has been really fun collecting these over time and learning how other folks out on the internet are still using them. I've even written a couple myself. Bookmarklets really take me back to my early days on the web when it was all super new and exciting. Unfortunately, I don't know the source of all of the bookmarklets in my collection, but where possible I've tried to give credit or link to the sources.

I have made my bookmarklet collection available here in my Bookmarklets page. Try them out!

Using Makefiles for Stuff around the Home (dir)

I use a Makefile to move my emacs configuration from its git repo in my home directory to the emacs config directory. There are a variety of better ways a person could move files from one place to another and a Makefile probably wouldn't be the wisest first choice. Writing a script to execute a copy command would be very straightforward and absolutely be a more sane choice.

I wanted to learn a little more about the tool and this seemed like a fun way to waste some time doing it. I did waste a lot of time doing it, but I learned a lot about the tool. I learned enough to make use of it in more useful circumstances. So it wasn't a total wash.

I will say this for using a Makefile instead of a script: it is weirdly satisfying only seeing the files you've modified get deployed to where they need to go. I thought it might be fun to go through how that works in the context of my emacs Makefile.

After this experiment I ended up adopted Makefiles for several things including ersatz.website. It is surprisingly useful and fairly quick to write once you know what you're doing.