First Post


We are live! #

Welcome! This has been a long time in the making, so I am excited to finally have the site up and running.

The first thing I will write about is exactly that, how I set this up and run it. This is just the first edition and I plan on detailing a lot of this later, but for now I just want to get this out there.

VPS #

I host this myself on a VPS I rent from Hetzner, running Ubuntu Linux as that is what I am most familiar with. I like using a VPS because then I also get to tinker with the server, like setting up tools on it and configuring the firewall.

Firewall #

I use nftables as the firewall. I’ve used OpenBSD and FreeBSD more “seriously” than I have used Linux, so nftables was the one that made the most sense to me as it seemed the most similar to what I already knew.

Caddy #

To serve the pages I use Caddy as it was quite nice and easy to set up. It also provides automatic https for your site if you need that. There are other ways of getting certificates for your site which I will get back to later.

Goaccess #

To analyze the traffic logs from Caddy, I use Goaccess which produces nice reports right out of the box.

Cloudflare #

The domain was bought through cloudflare and are hosted by them, with the added bonus that they provide caching as well as some basic protection from attacks. In addition I use their cloudflared to set up an outgoing tunnel from my server to their network, which they send traffic through. That means I don’t need to have the web ports open, making the actual server practically invisible.

Hugo #

Then finally the blogging software. I use Hugo which is a statis site generator, making it easy to host your site practically anywhere.

The theme I use is typo but with some modifications:

  • Changed the main font from Literata to Roboto
  • Changed the monospace font from Monaspace Argon to Monaspace Neon
  • Moved the embedded JavaScript for setting theme automatically to its own file
  • Removed the / in front of the links in the header as I think it looks better without
  • Changed the date format shown to yyyy-mm-dd as that is my preference
  • Added “Last updated” to the posts, since I aim to update them and keep them alive

The reason for changing the font is purely subjective. Content such as CSS and JavaScript should be in their own files and not togheter with the html, and certain security headers will block these from loading if that isn’t done. I plan on setting these headers later as it’s considered good practice. I just need to find out what to set and how to set it first, but I thought I would prepare for it already.

Deploying #

When building the site, I tell Hugo to publish to a designated directory:

$ hugo -d ~/bgrasmo.com/public

The bgrasmo.com directory is tracked in git, so I commit and push my changes.

Then on the webserver I pull the changes, and that is it.

The directory structure is set up this way to have tracking in git, but avoid sharing the .git directory which is in the root directory bgrasmo.com. The webserver only serves content from the public directory.

This step might need some improvement, at some point in time I’ll look into how and if I can automate some of this.