Sonney's Blog

Docker

I lost my first blog.

“I never look back darling, it distracts from the now” – Edna Mode, The Incredibles.

About a month ago, I thought I would give blogging a shot. I'm not a good writer by any measure, but I liked the fact I had carved out my own federated space on the internet, and I was approaching it in nifty ways that made this an interesting piece for me: – I'm going off learning a lot about kubernetes deploying one on my private server. – I'm interested in the #fediverse and the approach to social media it presents. – I'm doing this all off my Arch Linux laptop that I configured and I'm falling in love with.

So what happened?

I'm tired of my laptop fans running at super hot temperature. I like the quietness of my laptop and I prefer it not to burn my lap. So I thought I'd give remote dev a chance.

Essentially, I wanted to deploy some #Docker containers on my private server to run my application. I then intended to try developing remotely using a combination of Jetbrains Gateway, or LazyVim, both are fantastic in their own right.

The principle here is to outsource my entire development workload to a server away from me. This begins to suggest that I don't need to spend exorbitant amounts on money on a new Mac (as mine approaches vintage status slowly, but surely).

I realised that my instance was inadequately powered to do this task, so I stupidly (without testing the backup procedures), scaled my instance. It was then that I discovered I had lost my blog – the DNS from blog.sonneypatel.com resolved to a page displaying a Server Error, and a non descriptive 500 error.

Diagnosis (and Facepalm)

I suppose it was always my fault that I hadn't tested the persistence of my blog prior to writing it. I should have spent a few days knocking the pod over and seeing if I was able to login and observe some test posts.

The silver lining in all this is that I didn't really like what I was writing anymore, and sometimes a clean slate is good for me.

The Kubernetes Deployment I had configured was not correctly mounting the volumes nor setting the correct volumeMounts. This resulted in files not being where they should, leading to initialisation procedures needing to be executed, duplicate config files hanging around the box and the various stages of trying to set everything straight.

Notable commands I used were:

kubectl cp <pod-name>:<path-to-file> <local-destination>

In the end, I just went nuclear. I initialised the WriteFreely blog once, and copied the files over to a secure location and mounted the volume from there. Using the above command, I was able to take an “initialised” state and just copy it over to my private server.