Last updated: 08 Oct 2023
I wanted to run a simple Minetest server on my Synology using podman. I found some containers that the community put together, but after having some trouble with those, I put together a few scripts that got me what I needed.
Containerfile
FROM alpine:latest
COPY setup_container.sh /setup_container.sh
COPY run_server.sh /run_server.sh
RUN /setup_container.sh
CMD ["/run_server.sh"]
This depends on two other scripts: setup_container.sh
and run_server.sh
. Both are trivial.
Crafting setup_container.sh
/bin/sh
set euo pipefail
apk update
apk add minetest-server sudo
Crafting run_server.sh
#!/bin/sh
chown -R :games /var/lib/minetest/.minetest
chmod -R 775 /var/lib/minetest/.minetest
chmod -R g+s /var/lib/minetest/.minetest
while true; do
sudo -u minetest minetestserver --gameid minetest --worldname <worldname> --port 56789
sleep 10
done
It runs as user minetest
so the directories for configuration/mods/worlds will be set to /var/lib/minetest
, since this is where we will mount our data.
<worldname>
will be the name of the folder the world you want to load is stored under worlds
.
Building the Container
A simple script builds the container:
VERSION=0.0.4
podman build -f Containerfile -t minetest:$VERSION
Assembling and Mounting the Data Directory
The Alpine container has Minetest installed, and it will look for .minetest
at /var/lib/minetest/.minetest
. So we'll need to mount a configured .minetest
directory. For version 5.7.0, the minetest
game is not included in the Alpine package, so it's necessary to assemble a .minetest
directory on a different system:
games
needs to includeminetest_game
, installable through the client. Alpine's install doesn't have this. If you want to use another game as a base, of course that will need be installed.mods
needs to include any mods you want to use in the world you'll be hosting.world
needs to be created with the mods you'll want, and they'll need to be installed in themods
folder mentioned above. Its name needs to match<worldname>
in the scripts baked into the container.
Crafting minetest.conf
In the .minetest
directory is minetest.conf
, which is read by Minetest on startup. Several settings are necessary to get the server running properly.
enable_server = true
// Register with the server using this name, and set a password
// This is the server admin
name = <admin username here>
// Can be anything, I use this value. Default: 30000
port = 56789
default_privs = interact, shout, fly, fast
server_name = <server name>
// Adjust based on whatever your default game is
default_game = minetest
// Optional: message of the day
motd = Message of the Day!
// Whether to announce the server globally
server_announce = false
Full docs on all the settings can be found in the minetest docs.
Running the Container
Running the container requires two adjustments: one for network mapping, and the other for mounting a volume with data.
- Make the
.minetest
directory available for reading and writing at/var/lib/minetest/.minetest
. - Expose whatever port the server is running on (I use 56789) on the host for both TCP and UDP.