Move to

After more than 10 years of hosting my hugo-based blog on one of DigitalOcean’s machines, I decided to move to a different hosting environment. For a decade, I ran this site on a DigitalOcean Ubuntu droplet with tightly secured nginx. This droplet, beyond hosting a simple static website, served as my experimentation platform — running 24/7, connected to the internet with a decent connection, and costing me only $6 a month. Over the years, it was a place for this software engineer to experiment and play. I believe that every software engineer should have the skills to create a website, serve it, set up certificates, configure DNS, and email, at a bare minimum.

Finally, I chose, a platform that utilizes Firecracker virtualization. For those who might not be up-to-date on this, Firecracker is a virtual machine monitor (VMM) developed by Amazon Web Services (AWS). It was initially created to replace QEMU (or a derivative they’ve used) and power AWS Lambda and Firegate products more efficiently. Later, they open-sourced it. Firecracker uses the Linux Kernel-based Virtual Machine (KVM) to create and manage microVMs. With this tool, you can host your services using resource-efficient containers, like Docker.

One of the very cool aspects of is its ability to put apps to sleep when you’re not using them. Even more impressively, it can spin them up in under a second, or even a few hundred milliseconds, even with hobby instances having just 1 shared CPU and 256 MiB of RAM!

Instead of spinning up nginx inside my container, I opted for Caddy as it seemed like a simpler solution. Notably, Caddy has no libc dependency, and configuring it is much simpler compared to nginx. To illustrate, here’s a Caddy configuration file for this site:

	auto_https off
} {
	root * /usr/share/caddy

I’ve turned off HTTPS in the Caddy configuration since handles that for you. Even without, Caddy is capable of automatic TLS certificate renewals, eliminating the need for manual cronjobs to generate Let’s Encrypt certificates.

The Dockerfile is equally simple (the public folder is where Hugo generates your static website, and the Caddyfile consists of the seven lines above):

FROM caddy:2.7.5

COPY ./public/ /usr/share/caddy/
COPY ./Caddyfile /etc/caddy/Caddyfile

comments powered by Disqus