Hello World

hello.go

I decided to start a small blog and this is the initial post. My plan here is to make this a fun and casual (as in “zero commitment”) side project where I can write about some of the topics I find interesting or worth documenting. Now that I have successfully setup the technicalities of the blog and its server it might be that I become bored with the actual writing part, but we will see where this goes.

Even though I had the loose idea of running my own little blog for quite some time now, I never really had enough motivation to actually start creating one. This has changed a bit recently with setting up a new server to host my own private git repositories and then one thing just led to another. I believe part of this was how easy it is was to get this all to work from end to end so I want to try and summarize how I setup this blog from scratch on a single sunny weekend.

The Motivation

The first step was to have a server which could host the blog. I originally did this not to host a blog but rather to somehow implement private git repositories. Of course I know you can use free private repos with github, bitbucket or gitlab but each have their own limitations or disadvantages. Github is very convenient and popular and if you eventually decide to make a repo public that’s very convenient. I find the pricing however quite absurd. Bitbucket is entirely free but only allows to share access to each private project with at most one person. Gitlab is actually quite cool and tries to lure developers to their platform via unlimited private projects and collaborators. However my main problem here is kind of silly but nevertheless important to me: My username fgrosse is already taken by Frank Große who also seems to be from Berlin. Nevertheless I do have accounts with all three of the platforms but I figured its time to try something new and learn along the way.

The Server

Ok, so I decided to start fresh and setup a new virtual server somewhere in the cloud. I hadn’t setup an entirely new server from scratch in years so I was curious about how fast I could get going. Earlier this week I had some discussion going on at work at which hoster would provide the best service and prices and after running a Strato server for almost six years I decided to try out something new and chose Hetzner. I had only heard good things about them and without advertising too much I can say that the setup was super easy and I was logged in via SSH within minutes. The smallest instance they offer is still more than enough to run the little workloads I have in mind for now and its pretty cheap with less than 3€ per month. Moreover I can cancel the subscription on a monthly basis and even only get billed on an hourly basis should I decide to delete the server early.

The Domain

Initially I was happy with the server and I got my private repositories running within one or two hours using Gogs (a lightweight, self-hosted github clone written in Go; more on that in one of the next blog posts). However it was kind of inconvenient to access this directly via the IP address and if it would ever change I would have to update a lot of places (e.g. all remotes of all cloned repositories). Luckily I remembered I still had an old domain lying around at my Strato server. The only problem was that I had decided to cancel the domain end of last year because I was never using it for anything else than printing a generated ASCII art picture of my dog. After quickly checking if I still had access to the domain or if it was already gone I was happy to see that it was still working and I was yet the owner. The domain however was already flagged as being cancelled soon so I had to act quickly. After evaluating my options I decided to try to use my new AWS account which I had created a month ago to play with the different Amazon Web Services. I knew from work already that there is Route 53 to manage DNS records so I gave that a shot and again it worked all pretty much at the first try and without too many issues. Given that I had to transfer my domain from one provider to the other, I was yet again very happy to see how fast and easy I was able to make that change.

Encrypt all the Things!

At this point I had spend most of an entire afternoon but I was feeling really good about all of this. So far most things were quite painless or easy to resolve (for instance I wasted about one hour to understand how I could manage DNS records within my Hetzner account). The next step was to actually start the blog. I knew already I wanted to use Hugo for this job because I was using it at work for our internal documentation. Huge is a static website generator written in Go (a pattern?). I love Hugos simplicity and extensibility but I had Gogs already running on the port I wanted to bind my domain name to. So I needed some kind of Apache-like proxy which would route each HTTP request to its corresponding website. Enter Caddy, a modern web server also written in Go. I was following Caddy for quite some time already but I never found a good excuse to use it at work or any other project until now. Setting up Caddy was pretty much straight forward, especially given the good documentation and examples they provide. Also Caddy now comes with automatic TLS support using Let’s Encrypt without a single line of extra configuration. This really just worked out of the box so I was getting website encryption for free for the blog as well as all other sub domains I would host in the future. I think this is pretty damn amazing and I have to dive into the details of how this works exactly under the hood in the future.

The Blog

So there was already a spoiler that I wanted to use Hugo for generating the blog as entirely static HTML/CSS/Javascript website. Setting up Hugo is easy but then I spend hours fiddling with the styling. I’m not a designer, nor do I intend to become one but I like things pretty nevertheless.

The End

Wow, what a wall of text above ¯\_(ツ)_/¯. It seems like I got a bit carried away with my first post even though I tried to keep it short and definitely left out many details. However if you kept reading until here its probably not so bad…

In summary setting up the blog was a really nice experience and I’m looking forward to writing more posts in the future. The next one is gonna be more focused on a single topic and I also plan to make it more technical and explain much more in detail what is going (e.g. code examples / shell output). Now I only have to decide for a topic that would make a good first blog post (this is number zero).

Cheers
Friedrich