My website is static, and uses Hugo. This allows it to be hosted using GitLab Pages, and similar services. I suppose the main requirement is that it’s gotta be flat/no DB.
The main benefit I’ve found from this is maintenance, in that there isn’t really any. Modify the repo and the pipeline triggers when a new change is pushed so that the new content is available on the site. This is not some scientific comparison, just me looking at some of the differences I observe when trying out different services.
Wanting to try out other services than my current, I’ve added them using subdomains, for simplicity. The services in question are Azure and Cloudflare Pages. Azure’s default hostname was a bit random. One thing to note, URLs for blog posts and such are mapped to m15n.no. As such, only all requests will end up on GitLab unless the subdomain is specified in the address bar on posts. It is intended for m15n.gitlab.io visitors to be forwarded to my custom domain. When setting up the page in Azure, I got this one. There might be a way to get a better one, that I do not know of.
$ dig +short az.m15n.no CNAME
kind-pond-0021e7203.1.azurestaticapps.net.
Cloudflare’s is so much better, and could probably be even cleaner if I wanted to (as in removing ‘-gitlab-io’). I did not think that far ahead during the initial onboarding.
$ dig +short cf.m15n.no CNAME
m15n-gitlab-io.pages.dev.
While no CNAME, GitLab’s default URL is clean, too:
m15n.gitlab.io
Setting the custom domain was easy on them all, though I for some reason also created this one for Azure. Possibly not needed.
$ dig +short www.az.m15n.no CNAME
kind-pond-0021e7203.1.azurestaticapps.net.
One of the differences between them, was the build process.
With GitLab Pages as the initially established one, I’ll start with that. It required some tinkering with the [1].gitlab-ci.yml
file. I cannot recall where I found mine, but it’s very barebone/default and does the job.
The [2]build process in Azure got a bit detailed. It seems like I am getting some build script for free from GitLab with the script: - hugo
bit.
It’s still reasonably simple. The biggest challenge was probably securely setting the deployment token. I wanted to store it in Azure KeyVault, rather than as a pipeline variable. The AzureKeyVault@2
task option was unsuccessful, but while troughtshooting I found the Library. Now I am using a variable group that’s linked to the KeyVault. For some reason my service principal account worked there, but never with the task. Anyway, this seems like a solid solution so far.
I’m not sure what specific Hugo version GitLab uses, but I scripted Azure to grab the latest binary. The hugo --minify
option doesn’t seem to work yet, but that’s not critical.
This was just to have tried it. It was impressively simple and quick to set up. The build process is largely in the background. The configuration was to connect a repository, not add a remote repository. Instead it is connected as an app, and very simple to authorize.
From what I can see on GitLab, there are plans to get more options available. The issues have however been open for a while, so it’s hard to tell when it will happen. It’s also fully possibly that I’ve missed something.
[3]With Cloudflare it looks possible to add any headers you want, rather easily. I have however not tested this, but it is a nice feature. It’s possible Cloudflare has more options, for free, if their DNS is used. I am currently using my registrar’s DNS.
For Azure, I suspect a lot of options are hidden behind the $9/mo standard plan. That is however overkill for my needs. On another note, their default offerings are pretty good. The main selling points are availability. Both in high-availability, and the ability to restrict by origin.
With that in mind, I am curious just how it is on the free tier.
On GitLab, I haven’t seen anything yet. Azure has in relation to functions, which I’m not sure how works here. Cloudflare has some really simple, and seemingly not overly invasive one. I used Plausible.io previously, but currently do not use anything. I want to write post without knowing how many reads it. If the day comes when I reach some limit for the free tier, I’ll worry about it at that time.
What I’ll use in a year is entirely unknown, but for now I will be using Azure. Primarily for educational purposes. The repository will however stay on GitLab, and changes pushed to both GitLab and the (private) Azure repo.
I am planning to see how much I can automate my setup with Terraform. Not sure if I’ll use it much with this static site, but the experience will carry over to other projects.
[4]I have added monitors at UptimeRobot for numerous providers. Load will vary across them, but it might show “natural” outages.
[1] https://gitlab.com/m15n/m15n.gitlab.io/-/blob/master/.gitlab-ci.yml
[2] https://gitlab.com/m15n/m15n.gitlab.io/-/blob/master/azure-pipelines.yml
[3] https://developers.cloudflare.com/pages/platform/headers
[4] https://stats.uptimerobot.com/DAm97FoN6o