Why do I need a blog?
I’m not a good writer and I will not improve if I don’t practice. If I did something cool, I’ll forget about it in months, so a blog is a natice place to record this information.
What my blog need to have?
- Be fast and static (I’m the only user)
- Be able to show code and math equations (I do have a math background)
- Fit in my infrastructure
- Look good to in my phone and in browser
- Be easy to update
- Support posts in other languages
I could host this website using Github static pages or any other free service. However, in 2010 I wrote a simple PHP system to my mom and she still uses it. This system depends on a MysqlDB, Google Storage (for upload images) and in the PHP code. To make it worst, I started doing some applications in Golang. To support all my services I decided to use GCP.
A single MysqlDB in GCP can cost a significant amount of money. To keep it low cost, I decided to rent a VM and run all my services. Docker was the choice to to run different systems and applications in the same machine. At now, all my personal services run in a single
e2-small (2 shared CPUs, 2GB, 10 $/month) with the Container-Optimized OS - when I started it was the CoreOS.
One day, GCP UI changed and I took almost a minute to find the DNS settings. After that, I moved everything to Terraform. The files are saved in GitLab and it I use GitLab CI to apply changes. No UIs, just plain text.
All the docker container configs are also in Terraform. The current CI looks like:
The first node is responsible for building some custom images, the bottom left the GPC state and the last one the Docker state.
The full list of the actual containers running by this infra is: Prometheus, Grafana, HTTPs renewer, CAdvisor, Tinc VPN (custom build), Turn Server, Nginx, Gogs (Git service), Wordpress, other 3 PHP systems and this website.
Why Clownfish? Each of my machines as a sea related animal name.
I tried to create a blog before with Wordpress and is simple impossible to take care about it. Plugin updates, WP updates… A simple static site is more than enough. And, id it is static, it is fast (of course, with a small css and js libs).
My second attempt was to use raw HTML. Writing a teh Materialize css lib, but management content become painful.
The third solution, the one running right now, is using Hugo.
Setting code blocks is pretty easy:
And for math equations I can use $\LaTeX$ using MathJax:
$$a=1, b=2, …$$
The design is pretty simple, but I think I manage to do something decent. It uses Materialize.
About the updates? I do have my own Git and pushing a change on it trigger the gitlab pipeline that creates the docker image and update it the Clownfish Infra.
The last item is about the other languages. Hugo supports it out of the box.