SourceHut is awesome

#tech#website

A few days ago I migrated this website to be hosted over on sourcehut pages and I'm very glad that I switched!

I have been hosting this website on a minimal Vultr VPS for the past two years until a few days ago when I noticed degraded performance with one of their locations. It was taking anywhere from 500ms to 18000ms to load my website. I decided it was the perfect to switch to something better.

The problem I had with my VPS was that it was overkill. I only ran a minimal Caddy server serving this website and nothing else. All of the settings I had configured on the webserver were security and performance headers. I didn't have any special routing or proxying.

header "X-Frame-Options" "sameorigin"
header "X-XSS-Protection" "1"
header "X-Content-Type-Options" "nosniff"
header "X-Permitted-Cross-Domain-Policies" "none"
header "Strict-Transport-Security" "max-age=31536000"
header "Content-Security-Policy" "default-src * data:; script-src https: 'unsafe-inline' 'unsafe-eval'; style-src https: 'unsafe-inline'"
header "Referrer-Policy" "no-referrer-when-downgrade"
header "Feature-Policy" "camera 'none'; fullscreen 'self'; geolocation 'none'; microphone 'none'"

Considering this is a static site with no analytics, scripts, or tracking, I found it harder and harder to justify $6 every month to keep this website running.

That's when I looked to sourcehut pages.

I've been a fan of sourcehut products for a while now. I've switched back and forth between using them but finally decided to commit to them after hearing how exceptionally they handled their recent attack (and after getting tired of Github shoving AI down my throat).

Github's current landing page text which reads 'Let's build from here: The world's leading AI-powered developer platform'

Using SourceHut ΒΆ

The process of switching was perfectly smooth. Combined with builds.sr.ht, I can commit to my website repository and have it updated in two minutes or less without having to worry about oauth tokens floating around. Here is my build configuration for this website:

image: alpine/edge
oauth: pages.sr.ht/PAGES:RW
packages:
  - deno
  - gzip
  - tar
  - hut
tasks:
  - deploy: |
      cd website
      deno task build
      tar -C dist -cvz . > site.tar.gz
      hut pages publish --site-config=./server/config.json -d sam.bossley.xyz site.tar.gz

They also allow you to provide declarative configuration for cache control which is a huge selling for me as a NixOS user. Here is my sourcehut pages site-config for this website:

{
  "notFound": "/404.html",
  "fileConfigs": [
    {
      "glob": "**/*.{css,jpg,js,png,webp,woff2}",
      "options": {
        "cacheControl": "max-age=31536000, public, immutable"
      }
    }
  ]
}

I have only good things to say about sourcehut. The products been wonderful to use and I cannot recommend them enough. Now instead of paying $6 every month for an overkill webserver, I pay $6 every month for a whole suite of awesome software tools!