blog.ligthert.net/site/content/posts/setting_up_this_blog.md
2025-01-20 23:29:30 +01:00

5.2 KiB

title date draft
Setting up this Blog 2022-10-20T18:56:43+02:00 false

About

This blogpost will outline the motivations and technology used to create and host the tech-stack that hosts this blog. It is not that exciting in terms of tech and rather simple in setup.

The setup of this blog uses the following tech:

  • Hugo, generating the HTML output of this blog
  • AWS, used to host this blog
  • Terraform, to provision and manages resources in the above mentioned AWS

Basics

The Why

Why would I need a blog? I've been doing great without for the better part of the past few decades, so why need one now? And there are a few simple reasons for this:

  • While I sometimes speak my mind on the Fediverse, this is generally (with Mastodon, Pleroma, Misskey, etc) a short-form medium and it doesn't offer the ability to post blogs in a well formatted document. ( I know there is WriteFreely, but I will address this later in this post. ) So I am in need of something that offers a way to write longer posts, in a more structured, and with better formatting is something I desire.
  • Sharing is Caring. I hope that one day I write down enough discoveries that it may help people solving an issue they have issues with. A blog (especially on tech) is an excellent way to do this.
  • I need a challenge. And this is the truth. From time to time I need to challenge myself. This can be done either way by setting up a blog, or by down something that is worth a blogpost.

Requirements

For this blog I have a few "simple" requirements.

  • Ownership. I need to be the owner of the blog, I need to be able to do with it what I want. This means being able to host it wherever, do with it whatever, showing the things I want to to show. This excludes third parties that offer hosting a blog at a freemium, and kick you off when you have too much traffic, don't login often enough, or they don't like what you are posting.
  • Easy. Writing a blogpost should be easy. I should be able to create a new file, start typing in some mark-up language and create a new blogpost. It shouldn't be that hard.
  • Little to no maintenance. If you are already busy, then setting up something that requires even more time as an upkeep doesn't make sense. So I need something that I can deploy somewhere and it will be fine for the next couple of decades. I do not want to maintain a CMS, update software, manage databases. Just. Please no, I've already seen and done that enough of that already in my life.

Solution

With my desire for ownership, something easy, low in maintenance I ended up with Hugo. And it fulfills all my needs. Just install the binary, pick a theme, write a blogposts in MarkDown, generate the flat files for the website, upload it somewhere, and done! It is that easy. You need to be a techie to set this up and make it easy, but this isn't an issue for me. 😉 Once you have the flat files for a website, upload them to a webserver, and that takes care of the hosting. Chuck this in version control, and you can track changes over time.

I could go the other route. Install something like Typo3, Drupal, Wordpress, even code my own Python Flask container. Install a database server. And do this manually. But then I need to pay money for the upkeep of a VM on the Internet. Need time to update the software. And update the operation system of the VM. That is just extra effort I am not looking forward too, and not willing to commit myself to.

Hugo

Using Hugo was rather simple:

  1. Follow the Quick start guide. Play around a bit to get familiar with it.
  2. Pick a nice theme. I picked m10c as a theme.
  3. Wrote this blogposts.
  4. Generate and upload the files.

AWS

This part is based on an blog post on the AWS blog about exactly what I need, something highly available that hosts simple files. The steps for this are relatively simples and can be summarized with the following:

  1. Create an S3 Bucket
  2. Open up the S3 Bucket and turn it into a webserver
  3. Setup a CloudFront distribution and point to the S3 bucket as a source

Easy peasy.

Terraform

Terraform allows me to do essentially the above in AWS and create all the things automagically from the commandline. I've written HCL that allows me todo just that. I executed this from the commandline and it created what I needed in one go.

Wrapping up

  • There is a bunch of flat files that make a website.
  • There is infrastructure in place that can hosts these files.

The only thing that needs to happen is actually uploading these files.

aws s3 sync public/ s3://blog.ligthert.net/ --delete

Easy!