29/08/26 00:22
I recently moved this site to a new server, and re-did my entire stack from scratch, so I figure I'll document it here.
My last server was a mid-tier desktop thrown into a 4U chassis, and frankenstein'd up to about 43TB of raw storage (26TB useable across two ZFS arrays) with PCIE cards and MOLEX connectors. I shut it down due to a recent heatwave. Since it's kinda power hungry, I'm reluctant to boot it back up. I realised I didn't need 24/7 access to my storage, and never used any of my self-hosted services - I just occasionally boot it up when I want to retrieve something or dump some files. Additionally, my homelab setup had gotten pretty brittle over the years, accumulating cruft from experimentation. I learned a lot, but I don't really trust it as a production system anymore. It's now relegated to cold storage, while I gradually move services to my new server - still using Ubuntu Server, now on a miniPC.
Previously, to host this site, I was using an Apache docker container, with a bind mount for the content. This worked great, no complaints. Apache is good software. However, I've switched to using Caddy. Caddy is incredible. I wish I knew about it sooner. It's so easy to set up, the config format is super simple. Unlike Apache or nginx, I feel comfortable setting up a reverse proxy or custom headers without getting confused by syntax. I'm running it directly on bare metal, and I have zero complaints. My Caddyfile looks like this:
ryankrage77.me {
# Set this path to your site's directory.
root * /srv/www/ryankrage77.me
# Enable the static file server.
file_server
try_files {path}.html
encode zstd gzip
@matrixServer path /.well-known/matrix/server
header @matrixServer Content-Type "application/json"
@matrixClient path /.well-known/matrix/client
header @matrixClient Content-Type "application/json"
header @matrixClient Access-Control-Allow-Origin "*"
}
matrix.ryankrage77.me {
reverse_proxy 127.0.0.1:8008
}
Look how beautifully easy to understand that is. Four lines of config to set up a static site (ignoring the matrix stuff that I'll get to in a bit) - or two, if you drop compression and rewrites (which let you serve html files without the html extension in the URL). I just copy-pasted my sites files over to the new machine, reloaded Caddy, and it was back up and running.
In addition to serving the site, Caddy also handles certificates for HTTPS, entirely automatically. Well, actually I had an issue here, but it wasn't Caddy's fault. Although I updated port forwarding on my router to point to the new server, for some reason it didn't actually take effect until I restarted the (rubbish ISP-provided) router. But then! The site went live.
I've previously used SWAG proxy and Traefik for certs & reverse proxying. But, they both broke - SWAG stopped working altogether, and I can no longer get configuration changes in Traefik to apply. Plus, they were a pain to setup and make changes to. Caddy has solved all of this for me right out of the box. Did I mention I love Caddy? (oh and thanks to Nex for teaching me you can enable multiple compression methods with fallback).
For editing the site, I just mapped the /srv/www directory to my desktop over sftp, and I edit the files with sublime text. I may look into a proper static site generator in the future, as hand-writing HTML and maintenance is getting a bit tedious as I add more pages, but I'm still having enough fun with it for now. I think it's neat that every byte (of text) served to your browser was hand-typed by me :)
The next thing I set up was Matrix. Matrix is a decentralised, uh, chat/messaging... protocol? Standard? Honestly I'm not super clear on the terminology or the specifics of the software. It's basically Discord, except there's loads of Discords and they can all talk to each other, and it supports e2ee encryption (in private rooms).
I went with Continuwuity as my server of choice. Honestly this decision was based almost entirely on vibes, but the more I learn, the more I'm convinced it was the best choice. It's super easy to set up, it's light and performant (at least for my single-user instance), and the community and support is great. I highly recommend it if you want to host your own Matrix instance.
I ended up hosting it with Docker Compose, my old enemy. You can host it bare-metal or in a VM or whatever, but I keep coming back to Docker as a turnkey way to host stuff. If it ain't broke, don't fix it. I created a subdomain, matrix.ryankrage77.me, for split routing. This let's me have my identity be @ryankrage77:ryankrage77.me, which is cleaner than :matrix.ryankrage77.me in my opinion, while still actually serving the instance from the subdomain. I'm not going to share the compose I actually used, as it was from an old guide and likely isn't following best practices. I'll instead recommend Continuwuity's docs or Nex's guide.
One thing I customised was serving the .well-known files you can see in the Caddyfile above. These are used for federation, and while you can (maybe should?) put these in your Continuwuity config to let it serve them, and just reverse-proxy to them - I decided to create them manully. They're extensionless files but should be served as JSON. It will work without, but I added those custom headers so they're served properly.
And that was pretty much it. I started the container, and created my account. I did run into an issue here - I started with Nheko as my first client, and I never got a recovery key, which led to me being unable to verify devices. This is needed for encryption to work properly, though non-encrypted stuff (aka public rooms) still worked fine. In the end I just had to reset verification, which was honestly the most seamless troubleshooting experience I have ever had. I clicked 'reset', the issue was fixed. I didn't need to log out. It was so smooth I couldn't even tell if it had fixed the issue - I had to DM some people to confirm. This does lose all encrypted messages, but as I only had a few test messages, it didn't matter (and once you have a recovery key, there should never be a need to reset). For now I've settled on Cinny as my client on desktop, and Fluffychat on iOS. I also tried Element Classic and Element X, but didn't really vibe with them.
I've been really enjoying my time on Matrix so far, and have met some cool people and had some interesting conversations. I've found it way easier to get involved in conversations than on Discord and similar, even in large public rooms. Everything seems well-moderated, and it's easy to get support. My initial interest in Matrix was to replace Telegram, which I only use with one friend, so I created them an account on my server too, though convincing them to actually switch over is still a work in progress. I also still have Discord for now, as realistically I'm never going to get my friends on there to switch away. However, I don't use it much - I just log into the web version once a day or so. I'm finding myself way, way more active on Matrix.
Matrix supports voice calls, but I haven't attempted to set this up yet. It looks a fair bit more involved, and I'm still researching what needs to be done. I'll write a new post and link it here if/when I get this working.
If you want to get on Matrix, but find running a server daunting, or don't have a domain/IP/homeserver/VPS - you absolutely don't have to! You can just join somebody else's instance. I just wanted to self-host for fun and vanity. My one recommendation would be to use something other than :matrix.org, since the whole point is decentralisation.
If you want to host your own website, I can't recommend Caddy enough. I may write a more in-depth guide covering getting a domain, DNS, and a minimal homeserver/VPS install in the future. Of course, there are plenty out there already, so give it a go! If you really can't host yourself, even on a VPS, I'd recommend Neocities.
At the time of writing, that's all I have set up so far. The next thing I'm looking into is Mastodon. I spent this morning doing a deep-dive into Mastodon and Bluesky, and Mastodon won out for me. ATproto is a cool protocol, but the infrastructure for decentralization just isn't there yet compared to ActivityPub. Mastodon seems more open and better suited to what I want out of a social networking site. Expect a new blog post if/when I get that set up.