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 ....

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....

S3 backup script in a single binary

Everyone has a backup script that takes a tarball/zipfile/etc and uploads it somewhere for safe-keeping. In a lot of places where I’ve worked, the “somewhere” winds up being an Amazon S3 bucket (or lately a DigitalOcean Space). These scripts are lovingly crafted and sometimes quite clever, using the aws cli or s3cmd, or something custom. What I wanted was to encode my process for encrypting a backup and sending that backup to an S3 bucket....

Convert PEM to JKS

SSL/TLS in Java is a pain in the behind. Not only is the setup verbose, but the format for certificates and keys is unique. Nginx/Apache/Go/etc seem to be happy using certifiates and keys encoded as PEM files, but Java has its own special KeyStores, with the JKS format being the default. There are a number of questions on forums, and custom recipes that involve openssl, to convert PEM certificates and keys into formats that can be imported into a Java keystore....

S3DropBox is now on GitHub

I've released a new version of my S3DropBox on GitHub. I've moved the project to GitHub so that I can have all my current active projects in one place. Check it out in its new home at https://github.com/tomcz/s3dropbox. This release uses the AWS java libraries. They are finally good enough for me to stop creating my own wheels and vulcanising my own rubber. As a bonus the S3DropBox creates URLs in virtual hosted format (eg....

Post-Redirect-Get in Rails

For a while now I've been flying the flag for using a post-redirect-get design pattern when writing web applications. In my opinion the current crop of web frameworks still make it very easy to do the "bad" thing since to do PRG properly you need to think what kind of an interaction you want with users and not cop out saying its technically very difficult in . If you resort to ActiveX controls, popups without navigation bars and/or weird javascript hacks to stop users from clicking refresh or back buttons then perhaps you should have written a better web application....

PicoContainer and Jersey

The Jersey JAX-RS project provides bindings for springframework and google-guice. However I wanted to see what it would take to use PicoContainer as an IoC container within Jersey. Verdict: not much at all. Nicely extensible. To see what I mean please take a look at my jersey-pico project on GitHub. I can now create JAX-RS services in Java or Groovy with a very simple IoC container....