Creating my Blog (Again)

Posted on | 530 words | ~3 mins

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?

  1. Be fast and static (I’m the only user)
  2. Be able to show code and math equations (I do have a math background)
  3. Fit in my infrastructure
  4. Look good to in my phone and in browser
  5. Be easy to update
  6. Support posts in other languages
Clownfish Infra

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:

Scenario 1: Across columns

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.

Filling the Requirements

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:

1
2
3
func main() {
	fmt.Printf("test")
}

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.