Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Luanti serverlist self-hosted in Docker

The official Luanti serverlist is really cool, and is free software! The game client uses this list to show you the public instances. I forked it so I could make it work better with the arbitrary server addresses, and I built a docker container for it. I needed it to accept a server_address = dockerhost.ipa.example.com$30001 so that it would publish that hostname and port, rather than the connected IP address (an internal docker one) of 172.24.0.2 with port 30000 like the container always runs. This means my serverlist trusts the entry coming from the Luanti instance and does not do anything with the actual requester IP address, so it's not as secure.

No, it's not published on hub.docker.com or anywhere else. But it's pretty simple to build.

To build your own docker image with the static files, and no nodejs components, run this command in the repo directory, in my branch. My branch includes the generated servers.js downloaded from the public instance which for some reason took a whole node project to build?! I hate nodepm and never figured out how to use it, and I suppose this docker container is now overkill for just a small Flask project, but it fits nicely with my other docker infrastructure at this point.

docker build . -- tag luantiserverlist

Adjust docker-compose.yml if necessary, and mkdir /home/luanti/serverlist/run. The initial assets will be copied to this volume, for you adjust afterwards. Then you can run docker-compose.

docker-compose up -d

The included docker-compose.yml exposes port 8082.

For an easy reverse proxy in apache httpd, to serve at https://reverseproxy.example.com/games/luantiserverlist which you can place in your minetest.conf variable serverlist_url.

# Inside your virtual host.
ProxyPass        /games/luantiserverlist http://dockerhost.int.example.com:8082/
ProxyPassReverse /games/luantiserverlist http://dockerhost.int.example.com:8082/
<Location "/games/luantiserverlist">
   RequestHeader append X-Forwarded-Prefix "/games/luantiserverlist/"
</Location>

And then you can configure servers and clients to use this value.

serverlist_url = http://webserver.ipa.example.com/games/luantiserverlist/

It's really great to be able to list your own servers with pretty names and descriptions!

Praise the Lord for people who are willing to make FLOSS. I doubt many people will want my modifications, but they're there for anyone who would like it.

References

  1. Dockerizing a Python Flask App: A Step-by-Step Guide to Containerizing Your Web Application | by GeeekFa | Medium

Comments