Backburner Month 19: Aloysius
This is an entry from a list of projects I hope to some day finish. Return to the backburnered projects index.
What is it? A reverse proxy and web server interface.
Aloysius was originally inspired by the old academic servers where a person could host static pages under their username. What I wondered was, how could I design a system like that for dynamic sites, where a given user account could run their own services via a reverse proxy but not conflict with any other service on the machine?
So the approach was based on directories and symlinks. The top-level configuration is a directory that contains zero or more subdirectories, each of which uses different files to describe both filters and forwarding logic. Filters are based on matching on either
path (i.e. the HTTP requst path) or
domain (i.e. the server) or both, and then they can forward in one of three ways—maybe more over time, too, but these were the first three I experimented with—as specified by a
mode file: either
http (which forwards the request to host
host on port
redir (which uses HTTP response code
resp and redirects to host
aloysius, where you specify another directory by the symlink
conf, and then recursively check configuration there.
That last one is important, because it allows you to symlink to any readable directory. One idea here is that different subdomains can map to different users on the same machine. For example, let's say you're keeping your Aloysius configuration in
$ALOYSIUSDIR, and you've got a user on the machine
yan who doesn't have root access but wants to be able to run some dynamic sites. You can set up something like the following:
# create a dir to forward yan's config $ mkdir -p $ALOYSIUSDIR/00-yan # match against yan.example.com $ echo yan.example.com >$ALOYSIUSDIR/00-yan/domain # use a recursive aloysius config $ echo aloysius >$ALOYSIUSDIR/00-yan/mode # and forward it to yan's home directory $ ln -s /home/yan/aloysius $ALOYSIUSDIR/00-yan/conf
yan can write their own configuration for whatever dynamic web services they want—at least, if supported by the ability for them to run user-level services—and it doesn't require giving them root access to change the other configuration for the reverse proxy. It falls directly out of Unix symlinks and permissions!
Why write it? Honestly, it's not terribly useful anymore: I run my own servers using mostly nginx and am pretty comfortable with configuration thereof. But I still think it's a cool idea, and I clearly think this directory-and-symlink-based system of configuration has legs (which I know I've written about before).
I still think it'd be convenient! After all, I have for a long time used a directory of files (along with a wildcard) to configure Nginx: this simply makes that the first-class way of doing configuration! But also, there's a lot of work that goes into writing a good web server, and this is also solving a problem which the tech world seems to no longer have: namely, how to shunt around requests to different web services all living on the same machine, since instead we abstract those away into their own containers and treat them like separate machines.
Why the name? The name Aloysius was chosen pretty much at random. I originally called it Melvil after Melvil Dewey due to a loose metaphor between the tiny scraps of information used in configuration and the card catalogues that Melvil Dewey had helped popularize, but only because at the time I didn't realize what an absolutely awful human being Melvil Dewey was.