wingsite
CGI! Also replacing things

published: 2026-08-06 00:14:07
updated: 2026-08-06 17:28:02

I’ve been thinking of trimming down some of the services I run on my servers, both my home server and VPS, for a while now. In fact I already did a couple of months ago when I stopped running linkding and replaced it with a bash script1 that saved/read my bookmarks to/from a tsv file and generated an HTML page whenever I added or removed something. I much prefer using that script while I’m at my computer, and the generated HTML page exists so I can get to my bookmarks from my phone or if I happen to be at another computer which works perfectly fine in those situations. I’ll get to that but first…

alpine

I recently moved VPS providers due to ridiculous, repeated, cost increases on my previous one. While setting up my new server I decided to go with alpine instead of my usual debian for once. For many years I just assumed alpine was a container oriented distro because, well, it’s the base for so many OCI containers, but I took a proper look at it a little while ago and realised it’s just a nice lean distro that wants to focus on server stuff. I hung around the community IRC channel and played with it a little in a virtual machine to get a general feel for it, then spun it up for real on my VPS.

It’s different but I had fun getting used to everything and seeing an alternative approach. I’m not overly concerned with init systems, though I wouldn’t say I like systemd, and it’s not something I think about much on the desktop, but I do notice it on my servers. I’m not fond of systemd unit files, especially timers (why do I need 2 files!). OpenRC is cool and it didn’t take me long at all to work it out, besides for failing to get user services working, but that’s a recent addition so I’ll give it some slack there, and it could have just been a me thing.

My home server setup has been a bit of a mess for probably 2+ years now because I briefly used it as a desktop and never removed all that cruft when it went back to being a regular server. Something I meant to clean up forever ago but never did. I decided to finally rectify that while I was doing VPS stuff and move it to alpine as well.

I like and continue to use debian on my desktop, but alpine makes for a really nice server OS.

As I was setting everything up on the 2 servers, I got back to thinking about all those services I was running.

more replacements

As a quick aside, I’m not saying any of the projects I’m mentioning here are bad, I just want to do things differently.

One of the first things I decided to not set up again was navidrome. I don’t actually use it all that much and I already run jellyfin which can also play music, even though navidrome’s interface for doing so is much nicer, jellyfin works acceptably for the rare occasion I want to play music while away from my PC.

Something that bothers me about so many self-hosting focused projects, is that most of them run a small web server that needs to be left on all the time, waiting around for requests, and reverse proxied to your real one. Some projects are unavoidably complex and that approach makes sense, but so many aren’t. I’m aware it’s not like doing things that way is taking an extraordinary amount of resources or anything, but why not cut out always on services where you can? It’s also less to think about maintenance-wise.

With that in mind a service I’ve been meaning to replace for a long time is gotify. I never used gotify to receive notifications, which is one of it’s main selling points and I just don’t like them. Gotify was just something I could send messages to if something was wrong in my cronjobs, like backups failing, but it was also something I sent little notes/reminders to during the day that I could check when I got to my computer. Absolute prime candidate for replacing with, you’ll never guess, a tsv file of course :D However, unlike my bookmark script that I only add to at my computer, this needed to be accessible from multiple places.

cgi!

Yeah, sometimes you do need to run something dynamically, but with CGI you can just run it on demand! It’s handled by the web server you’re already running and some kind of CGI process (I’m using fcgiwrap), so as long as those are up, you don’t need to think about it. Also, yes, it does require one other always on service (unless your web server supports CGI itself), but it can handle many things. With a web server and CGI server together, you can have any number of “services” run when they’re actually being used and you don’t need to think about keeping them up :D

In the spirit of downsizing always-on services, I’ve also now moved my fossil to CGI2 since it supports that right from the same binary and I had been running it from the server command.

This did get me sidetracked, because even though I knew about it, I’d never (intentionally) used or wrote anything for CGI. It’s old, and if you go looking it up, you’ll probably find a lot of things skewed heavily towards perl, and the odd person saying it’s an outdated method or something, but it’s fantastically simple. You reverse proxy requests to it, and it will run the relevant script or binary, which gets passed all the required details by environment variables, with the exception of form data, which is passed via stdin. So you can write your scripts in any language and all you have to think about is grabbing some environment variables for input, then you respond by printing to stdout, easy!

I won’t go into too much detail here, but I’m adding a new section to my site for informational things3 where you can read about it. It’s a new work-in-progress section that I might get into the future.

pigeon

My first CGI program replaces gotify, pigeon4. It’s also my first real hare program, and both of those combined with the ridiculous summer heat, has caused me to spend a lot of time on something relatively simple, but that’s fine, I’ve learned a lot.

It could still a little tidying up and I haven’t added the ability to delete categories or make shared links clickable yet, but it’s perfectly functional. While I mostly intend to use it via scripts, I did add a simple form to the main page to add messages with the website.

For easily adding messages from a phone, I’m using HTTP Request Shortcuts5 which lets you define HTTP requests you can run manually, or with share functions.

Overall, I’m very happy with how it turned out and I have more ideas for it in the future!