Hosting with Netlify, part 1

New technology is always fun to work with, but it also comes at a cost. Both in terms of money but also time.

Kubernetes is an awesome tool to use, and it makes it really easy to deploy applications. Using it as a managed service in Google Cloud is fantastic. But for my needs it definitely is overkill. Deploying a website built with Hugo leaves lots of underutilized features in a kubernetes cluster.

So, what alternatives are there? Lots, of course. But if you want to make it cheap, basically free, I suggest that you take a look at Netlify. I especially recommend it if you build static web sites from Hugo, Gatsby, Contentful or other tools associated with the Jam Stack.

My previous setup, that cost me around $60 per month, was building a docker container with Gitlab CI and uploading it to Google Cloud Container Registry. In the Kubernetes cluster, Flux monitors changes in the registry and deploys a new version of the application with Helm. The container runs an nginx instance that serves the static files built by Hugo. Some files are served from Google Cloud Storage with a load balancer in front. DNS management and TLS certificates was handled by Cloudflare.

As you see, a lot of moving parts and way too complex for the use case at hand.

With the switch from Google Cloud to Netlify, I switched the DNS handling from Cloudflare to Netlify, so now Netflify handles the certificates and redirect to https. The deploy process is triggered by me commiting and pushing code to Gitlab, which triggers Netlify to build and deploy the Hugo code. It’s usually done within 20 seconds. And that’s it.

The files in Google Cloud storage are still there, but instead of using Google’s load balancing, which cost around $18 per month, I let Cloudflare do it - for free.

A walkthrough of what I did and how everything is configured, is available in part 2 (available soon).

All in all, I’ve reduced my cost of hosting this Hugo site from $60 per month, to close to zero. You can probably achieve that as well.