Self-hosted Blog Guide for Engineers: (the Sweet) Part III — Further maintenance

As you embark on this new journey of managing and maintaining your dynamic platform, it is essential to stay proactive in ensuring the smooth operation and optimal performance of your environment. This article will explore three crucial aspects of maintaining your newly created Kubernetes cluster

Self-hosted Blog Guide for Engineers: (the Sweet) Part III — Further maintenance
Photo by Simon Abrams / Unsplash

This article is part of a guide for engineers on setting up a self-hosted blog (or any other service) on Ghost using Terraform, Ansible, and Kubernetes (part I, part II).

Congratulations on successfully setting up your Kubernetes cluster with a Ghost blog! As you embark on this new journey of managing and maintaining your dynamic platform, it is essential to stay proactive in ensuring the smooth operation and optimal performance of your environment. This article will explore three crucial aspects of maintaining your newly created Kubernetes cluster with Ghost blog: updating the Ghost configuration file, upgrading Ghost and MySQL versions, and expanding storage volume.

Updating the Ghost configuration file

The Ghost configuration file serves as the backbone of your blog's settings, defining everything from database connectivity to theme customization. Regularly updating this file ensures that your Ghost installation remains up-to-date with any changes or improvements introduced by the Ghost team. Considering you've followed the instructions from Part II of this manual, you should now have the configuration file set up with Kubernetes secret. In that case, all you'd need to do to upgrade the configuration is:

  1. update the code/config.production.json file;
  2. update the secret with the following command:
$ kubectl create secret generic ghost-blog --dry-run=client --save-config -o yaml --from-file=config=../code/config.production.json | kubectl apply -f -
  1. Rollout the change by restarting the deployment:
$ kubectl rollout restart deployment ghost-blog-web

Upgrading Ghost and MySQL Version

Ghost, being an open-source platform, constantly receives updates and new features that improve its security, performance, and overall user experience. Similarly, MySQL, the database management system that powers your Ghost blog, often releases new versions with bug fixes and optimizations. Fortunately for us, the setup we've configured allows us to update both technologies with little effort. All you need to do is simply update the image directive version (image: ghost:5.38) in the kube/blog.yaml and apply the change to the Kubernetes cluster in the blog namespace.

$ kubens blog
$ kubectl apply -f kube/blog.yaml

Similarly, it's done for MySQL by updating the image version directive for MySQL deployment in the kube/mysql.yaml file and applying the change.

Expanding storage volume

As your Ghost blog grows in content and attracts more visitors, you may find that the initial storage volume allocated to your Kubernetes cluster becomes insufficient. In this section, we will look into expanding your storage volume to accommodate the increasing demands of your blog.

One of the critical aspects of our setup was CSI Driver installation for Hetzner which would help us to modify a separate volume via Kubernetes cluster configuration changes. To expand the volume, change the storage: 10Gi param to a new value in the kube/pvc.yaml config and apply it running the kubectl apply -f kube/pvc.yaml command. This will result in smooth Hetzner Volume resizing without re-creation of it. Note that this value can only be increased and can't be shrunk back — don't go too far, as it will affect the cost.

Conclusion

As you can see, maintaining such a blog is simple and hassle-free. In future articles, I'll aim to cover details on further expansion — moving from a single-node configuration to an indeed clustered, highly-available solution. Subscribe to not miss out on the updates!

Subscribe to Humble Thoughts

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe