Solidblocks Hetzner

After years of shifting workloads to the big cloud providers like AWS or Azure, I am now more often confronted with situations where the deployed cloud infrastructures become unmanageable cost and complexity wise. A nice, fast and inexpensive alternative for smaller projects is the Hetzner Cloud featuring all basic needed building blocks like VMs, block devices, networking, firewalls and load-balancers. One major drawback with Hetzner is though, that there is no pendant to the AWS RDS service family, meaning we have to start to self-manage our state (and backups) again. [Read More]

Solidblocks Shell Terraform

A common problem when provisioning infrastructure with Terraform is the inherent bootstrapping problem imposed by the fact that Terraform needs some kind of storage to store its state. In an ideal world Terraform would be able to provision its state backends using infrastructure as code defined in Terraform itself. In a more real world you are often confronted with the question “Where to store the initial state needed to provision the first resources? [Read More]
pdx 

Solidblocks Shell Software

Referring to a previous post about developer experience, a re-occurring need when writing automation and/or glue code for software or infrastructure projects is to ensure all required software is installed on the execution machine. A lot of software exists to achieve this goal, e.g. NixOS or asdf, but sometimes a little bash can be enough to get the same results. Solidblocks Shell Software provides a small set of easy to use functions to install commonly used software for infrastructure projects. [Read More]
pdx 

Compiling Ubuntu Kernel Packages

Although the situation greatly improved over the last 10 years, with very new hardware under Linux you sometimes may run into hardware compatibility issues. The following guide shows how to build an installable Ubuntu/Debian kernel package from a Linux kernel source tree. This post is based on a wakeup-from-sleep issue that I had with my new Lenovo ThinkPad T14s G3. The Wi-Fi card had trouble coming back from sleep and the system ran into IO issues after wakeup looking the whole system. [Read More]

The do file

Project Developer Experience

The first question after cloning a new repository often is: “How do I build this thing?”, immediately followed by “…and how do I run this thing?”. There may be a README.MD somewhere with some information about some commands that you can run, but this information tends to get outdated very fast. A simple shell script can serve as an entrypoint for all tasks needed to work with the content of a repository. [Read More]
pdx 

Project Developer Experience

A personal pet peeve of mine when joining a new project or environment is the developer experience (DX). Under this rather wide umbrella term I summarize everything that is needed to get a project running, tested and deployed apart from the actual business code itself. Starting on the local development environment setup, over being able to build and test locally to finally being able to deploy. In the following series of posts I will try to visit some recurring problems and obstacles and give and some heavily opinionated and patterns on how to solve them. [Read More]
pdx 

Solidblocks RDS

Being a freelance consultant for some time now, I find myself frequently coming back to one of my older posts on how to run a PostgreSQL database in the cloud, where the cloud is not one of the big ones that already offer a dedicated managed database service. Although for example AWS RDS is an excellent and stable service, it can sometimes be a little too much (and to pricey as well). [Read More]

What's my age again? (PostgreSQL Edition)

One of the many fun aspects when taking over an existing codebase is that you inevitably learn something new - if you want or not ;-).

Today a user reported a bug, that some numbers that are derived from the diff of two dates produced incoherent results. Looking at the code, it turned out that the code in question uses PostgreSQLs AGE function to get the interval between two dates. The shortest reproduce I was able to come up with that shows the questionable behavior looks like this:

SELECT AGE('2021-06-30','2021-05-19') AS age1, AGE('2021-07-01','2021-05-20') AS age2;

and returns the following surprising results

+-------------------------------------+-------------------------------------+
|age1                                 |age2                                 |
+-------------------------------------+-------------------------------------+
|0 years 1 mons 11 days 0 hours 0 mins|0 years 1 mons 12 days 0 hours 0 mins|
+-------------------------------------+-------------------------------------+

The correct answer for both cases should be 0 years 1 mons 11 days but the period for age2 is off by one day. This post will try to shed some light on the AGE function, why it produces the unexpected results and show alternatives that produce a (maybe) better result.

[Read More]

Kubernetes port forward

Occasionally when developing and deploying services to Kubernetes you may encounter a situation where you need to access an API that your service relies on from your local machine. Depending on your network setup or internal company policies you may realize: “S**t, that API is only accessible from within the Kubernetes cluster”.

situation

This post shows how to deal with such a situation using a Kubernetes port forward and a special Docker container.

[Read More]