This is the first post on a brand new website I’ve built as a homepage for myself. I say a little bit about why I decided to build it in the About Me page but perhaps I should talk about how I’ve built it and how it’s hosted and why I chose to do it this way.
First off the site is built using a tool called Hugo. It’s a static site generator that allows you to write content in a human readable way using Markdown. I’ve built a few sites in Hugo in the past but it’s been a few years at this point and if I don’t do something for a while I have to re-learn it.
For the non-technical If you’re reading this and wondering what a static site is and what the alternative is then the alternative is a dynamic website. A dynamic website is where the content you see is generated on the fly from one or more sources. Take Facebook as an example of a dynamic site. You log in and you see your feed which consists of posts your friends have made (plus a load of other garbage) all collated for you on the fly. A static site is more like a file with some text in it. Everyone sees the same thing and it only changes when that text file gets updated. This site is little more than a bunch of text files that get crunched together by Hugo and put up where you can see them with a web browser. Your browser shows them to you as this website.
Many years ago when I first started tinkering with this sort of stuff I built and hosted my own Wordpress instance (a dynamic site). It was a useful experience and learned a ton. One thing I did learn is that if you don’t stay on top of the maintenance of PHP based applications like Wordpress things can go wrong pretty quickly. It’s really important to keep everything up to date otherwise attackers scanning for known vulnerabilities will soon find it. It’s very convenient but It’s a web of interdependent parts and all that complexity can cause lots of other problems. I need something that can go without maintenance for months or years and not become a problem. PHP is great for dynamic content but most things don’t need to be dynamic; you might as well avoid the headache and keep things static. Hugo does just that. What Hugo can’t do is things like contact forms or user interaction like comments but for that there’s other solutions.
At the time of writing my contact form is using a service called Formspree which offers a free account that lets me get up to 50 emails a month from this site. I can upgrade that if I ever need to but if I’m getting more than 50 emails a month I’d be very surprised. It also supports various methods of spam-bot protection with reCAPTCHA and hCaptcha.
The site is currently hosted on AWS in their S3 storage service which costs pennies. In front of that is AWS Cloudfront CDN. There are no servers I have to maintain and pages load in milliseconds.
I might change my contact form to use other AWS services eventually. I should be able to create a serverless contact form using API-gateway and Lambda. While I’ve done a few things in Lambda before API-gateway is unexplored territory for me. I’ve worked with other cloud providers such as Google’s GCP and Microsoft’s Azure but I’ve found GCP to be unintuitive and Azure was just terrible at the time. Maybe it’s matured now but I want to revisit them and use this setup to see if I can master the basics. I also want to try out Alibaba Cloud at some point. The key thing is to split everything down into its component parts so that no one thing is dependent on any given service. I’ve used AWS a lot for work over the past few years and I generally find it to be pretty decent but I like to keep my options open.
I don’t really want to go into great detail about how to use Hugo or how to set up AWS to host a site as that’s already well documented elsewhere. See this YouTube series for a good guide on how to get started with Hugo. I used this as a refresher to remind myself how to use it. There’s plenty of AWS guides kicking around, not least their official documentation which is usually pretty good.
I’ll probably come back and write about my experiences. If I’m going to go into technical detail I might write a series of posts on something here and there.