self hosting

This weekend I rented a cloud server from Hetzner for about a fiver a month. The aim is to move to self-hosting wherever I can.

I've started off strong by moving (almost) all of my websites to an nginx instance on that server.

[to the audience] Does anyone else struggle to remember the intended pronunciation of nginx: engine ex? I always catch myself saying en jinx.

Nginx was surprisingly easy to use. The server_name attribute lets you split requests by subdomain, so I can just point each at the server in my DNS config and let it rip. I especially like that to set up a static HTTP server is as simple as pointing to the files:

server {
  server_name felixwaller.dev;
  location / {
    root /public/felixwaller;
  }
}

Okay, so it's not quite that simple once you throw in security, routing edge cases and the SSL setup, but certbot not only generated and saved Let's Encrypt SSL certificates for me, but also added the necessary settings to the nginx config! I actually found it quicker to set up HTTPS here than on some dedicated hosts. Crazy.

A few of my websites need an actual backend (shocker) and for those I almost unilaterally use Pocketbase. For that I set up some systemd service files so that if the server reboots or the processes crash they'll restart automatically.

[Unit]
Description=Eurotally

[Service]
ExecStart=/public/eurotally/pocketbase serve --http localhost:8000
Restart=always

[Install]
WantedBy=multi-user.target

Just for completeness, here's what the nginx configuration looks like for one of those:

server {
  server_name eurotally.felixwaller.dev;
  location / {
    proxy_pass http://localhost:8000;
  }
}

I'm positive that somewhere amongst all of this I've left some horrendous security hole, but since there are no sensitive data stores or privileged access keys on the system, this shouldn't be too much of an issue.

I can thoroughly recommend making the switch if you're comfortable in the terminal. I'll probably write about why I started this journey soon but for now I'll just gesture vaguely at the general political climate. Next up for me is migrating my code forge and photo & document storage over, but I'll have to invest some time in security and backups so that might not happen for a while.