However, the instructions and documentation are pretty scant. I have had trouble trying to set up my server. I am no expert, but I have got Apache httpd already running serving a website on port 80. I do not mind whether I run the server list on a different port, but a subdirectory would be a nice option I think. Whatever works I'll take..
So far the working looks like this:
Code: Select all
git clone https://github.com/minetest/serverlist/
cd serverlist
sudo apt install python3 python3-pip libapache2-mod-wsgi-py3
pip install -r requirements.txt
cp config-example.py config.py
cd ..
sudo mkdir -p /var/games/minetest/serverlist
sudo cp -r serverlist/* /var/games/minetest/serverlist
sudo vim /etc/apache2/sites-available/10-serverlist.conf
Code: Select all
<VirtualHost *:5000>
DocumentRoot /var/games/minetest/serverlist
WSGIScriptAlias /serverlist/ /var/games/minetest/serverlist/server.py
WSGICallableObject app
WSGIProcessGroup minetest-serverlist
WSGIDaemonProcess minetest-serverlist threads=2
<Directory /var/games/minetest/serverlist>
Require all granted
</Directory>
</VirtualHost>
Code: Select all
cd /etc/apache2/sites-enabled
sudo ln -s ../sites-available/10-serverlist.conf 10-serverlist.conf
sudo ufw allow 5000
sudo apache2ctl restart
If I instead try to run the development server, /var/games/minetest/serverlist/server.py through my SSH session, then I can at least get a response from curl locally. However, GET /list, /list.json and so on will 404, probably because there are no servers that have successfully announced. That brings me to the next problem. This system already runs minetestserver as a daemon. The relevant parts of minetest.conf are:
Code: Select all
server_address = [redacted internet domain name of server]
server_announce = true
serverlist_url = http://127.0.0.1:5000
Code: Select all
127.0.0.1 - - [06/Jun/2023 04:22:02] "POST /announce HTTP/1.1" 200 -
127.0.0.1 - - [06/Jun/2023 04:22:24] "POST /announce HTTP/1.1" 202 -
[2023-06-06 04:22:24,617] WARNING in server: Invalid IP 127.0.0.1 for address [internet domain name of server] (address valid for {'127.0.1.1'}).
Code: Select all
$ curl http://127.0.0.1:5000/list
$ curl http://127.0.0.1:5000/list.json
$ curl http://127.0.0.1:5000/static/list
$ curl http://127.0.0.1:5000/static/list.json
So how do I fix this? Is my firewall bad? I've also tried removing the check, but no luck. Patch for server.py is:
Code: Select all
314a315,321
> if checkAddress:
> addresses = set(data[4][0] for data in info)
> if not server["ip"] in addresses:
> app.logger.warning("Invalid IP %s for address %s (address valid for %s)."
> % (server["ip"], server["address"], addresses))
> return
>
This leaves me a with a few head-scratchers:
- Is my firewall still somehow missing a rule? I thought ufw was just about foolproof.
- Is there a missing setup step, like touch static/list.json, or is the file meant to come into being through normal program operation? How do I write any necessary rewrite rules for it?
- Why doesn't my apache site work at all when executing the python file does? How do I debug/get logs on that?