Blog About
At the time of writing, my personal website has been running in a bare-metal Kubernetes cluster for about a year, and I am now officially sick of maintaining it.
Having a budget Kubernetes cluster that I can try out new stuff and learn with is great, but hosting my website there means it has to remain operational at all times, and has in general has to be maintained rigorously.
For these reasons, i decided to look for alternative ways to host the site.
My list of demands for the new hosting environment was short:
Regardless of one’s opinion on whether a massive global entity MITM’ing the entire internet is a good or a bad thing, it’s hard to ignore the bang for buck Cloudflare gets you. Not only will they take care of your DNS needs, and provide a free TLS certificate, but their edge-network can be leveraged for hosting a static (or dynamic if you include workers) website.
Oh, and all of this is free of charge.
Cloudflare recently they rolled out Cloudflare pages, a service designed especially for hosting JAMstack websites. You can go read the marketing blurb yourself, but for the purposes of this post you can think of it as a more barebones implementation of Vercel and the like.
Cloudflare pages includes built-in “GitOps” capabilities; after watching the automation fail to compile my website using a framework it claimed to support (Hugo), I surmised that it would probably be less painful to just upload the static file bundle directly using Wrangler and Github Actions:
jobs:
Build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Hugo init
uses: peaceiris/[email protected]
with:
hugo-version: '0.101.0'
extended: true
- name: Compile static bundle
run: hugo --minify -d ${{ env.BUILD_NAME }}
- name: Deploy bundle
uses: cloudflare/[email protected]
with:
accountId: ${{ secrets.CF_ACCOUNT_ID }}
apiToken: ${{ secrets.CF_API_TOKEN }}
command: pages publish ${{ env.BUILD_NAME }} --project-name=${{ env.PROJECT_NAME }}
I can now freely render my Kubernetes cluster inoperable with all sorts of moronic experiments, but this website will remain available, because it’s served from the fastest edge-network in the world, free of charge.