ronoaldo / minetestserver

Docker images for hosting Minetest servers, with some extra tooling embeded.
Apache License 2.0
5 stars 2 forks source link

Server crashes due to lack of --gameid argument #22

Closed adrinux closed 3 months ago

adrinux commented 9 months ago

This looks like a really useful project but I'm having trouble getting a test server up and running. I get an error:

2024-02-06 15:13:03: ERROR[Main]: To run a Minetest server, you need to select a game using the '--gameid' argument.
2024-02-06 15:13:03: ERROR[Main]: Check out https://content.minetest.net for a selection of games to pick from and download.
2024-02-06 15:13:04: ERROR[Main]: ServerError: Supplied invalid gamespec
Minetest server crashed! See error logs at debug.txt and /tmp/minetest.stderr
Restarting in 10s ...

One possible caveat is that I'm using Podman not Docker but those are largely interchangeable for a simple test run on my workstation.

The container can write into the /data folder so it's not a permissions problem. But /data remains empty when I run the container.

My impression is that the stripped down minetest.conf in the sample server is too stripped down to be functional. I presume I can grab the one from the minetest repo instead and modify that (or use one of my existing minetest.conf files).

The README talks about modifying the mintest.conf from the image by copying it to /data, that just copies the minetest.conf I provide in /server when building my image - so a bit cyclical...

And building my image fails if I remove minetest.conf from /server

I have a feeling this is mostly a documentation problem...

ronoaldo commented 9 months ago

Hi!

Thank you for the report!

This looks like a really useful project but I'm having trouble getting a test server up and running. I get an error:

2024-02-06 15:13:03: ERROR[Main]: To run a Minetest server, you need to select a game using the '--gameid' argument.
2024-02-06 15:13:03: ERROR[Main]: Check out https://content.minetest.net for a selection of games to pick from and download.
2024-02-06 15:13:04: ERROR[Main]: ServerError: Supplied invalid gamespec
Minetest server crashed! See error logs at debug.txt and /tmp/minetest.stderr
Restarting in 10s ...

Great catch! Indeed, the newer version of minetest.conf.sample (which is bundled by default) seems to be lacking that configuration and if we just docker run it fails. This is a bug as a simple docker run should launch the default minetest game that I am still bundling with the container.

This was probably caused by the recent update in Minetest 5.8 where there is no "default game" and you must explicitly install/configure it.

As a workaround, you can try the sample/quickstart.sh aproach that has a working workflow to setup and run a minimal sample server with some basic mods.

One possible caveat is that I'm using Podman not Docker but those are largely interchangeable for a simple test run on my workstation.

I don't anticipate any issues here, but I must say I failed to have some features working in podman. I guess I was trying rootless and it was not binding the ports/volumes or something. I would love to hear feedback if it works with Podman as well or if there are changes that can be done to make it happen.

The container can write into the /data folder so it's not a permissions problem. But /data remains empty when I run the container.

My impression is that the stripped down minetest.conf in the sample server is too stripped down to be functional. I presume I can grab the one from the minetest repo instead and modify that (or use one of my existing minetest.conf files).

Indeed, that seems to be the issue. We can try to set a default game in the bundled config.

The README talks about modifying the mintest.conf from the image by copying it to /data, that just copies the minetest.conf I provide in /server when building my image - so a bit cyclical...

This is not mandatory... The idea to copy to /data is to have a way to edit config without rebuilding the container. But you can also have your own config and COPY it via Dockerfile. I was trying to provide a setup that requires less docker builds but that ended up being confusing.

Any suggestions here to make it simpler are welcome!

And building my image fails if I remove minetest.conf from /server

That part is interesting... I have a server published here: https://github.com/ronoaldo/mercurio where I can build and run the game with this base container image and several customizations. Can you tell me the errors you face when building?

I have a feeling this is mostly a documentation problem...

Indeed, documentation can always be improved to make it simpler/clearer. I'll try to rewrite some parts of it to make it clear.

adrinux commented 9 months ago

This was probably caused by the recent update in Minetest 5.8 where there is no "default game" and you must explicitly install/configure it.

I don't think that's relevant since it applies to the desktop client and you always had to pull the game separately if you were only running the minetestserver binary. And your Dockerfile does clone the minetest_game repo.

minetest_game is available via contentdb - might it be worth not cloning and instead pulling it in with the custom build via contentdb? Then if someone chose a different game you wouldn't have that unused game code in the image. But that's a discussion for a different issue :)

As a workaround, you can try the sample/quickstart.sh approach that has a working workflow to setup and run a minimal sample server with some basic mods.

Well that's docker based, and I actually ran through that manually substituting relevant Podman commands. I might try it on the one box I still have docker installed on, but since my aim is to have this running on rootless Podman I need to figure out what's going wrong.

I have enough experience running Docker images under Podman I'm sure I can get it working.

I have a feeling now that the build is not working properly and that's why the /data directory remains empty - perhaps there is nothing to copy. I'll investigate further, in particular I need to look at what is actually in my built image.

More later...

adrinux commented 9 months ago

Some progress. I duplicated the CMD from your dockerfile into my custom server/Containerfile and added in --gameid to be passed to the wrapper script.

CMD ["/usr/bin/minetest-wrapper.sh", "--config", "/etc/minetest/minetest.conf", "--gameid", "minetest"]

And the server now starts.

I just need to get the connection from the minetest client working now :)

EDIT: To add, for a quick test I just started a container with host network type:

podman run --network=host -it --rm --volume "$PWD/data:/var/lib/minetest" -p 30000:30000 mytestserver:latest

And was able to connect from the desktop minetest client.

ronoaldo commented 3 months ago

Hi! I opted to add the --gameid minetest options to the default Dockerfile CMD, and that should have this fixed as a side-effect.

Please let me know if this helps.

adrinux commented 3 months ago

It should do. It would still be necessary to duplicate the CMD in a custom Dockerfile/Containerfile for any other games of course, Mineclonia for example.

I have to think about how I can now test this, I ended up rebuilding all my worlds on a custom containerfile based on yours.

I might revert my standard minetest and minetest creative worlds back to using your images and only use a custom one for Mineclonia, since that's not even compatible with 5.9.0 yet AFAIK.

Will take me some time to get around to reworking my code.

ronoaldo commented 3 months ago

No worries @adrinux - and thank you for the bug report and help! I would say that your approach of customizing the image downstream is better, as this is one of the goals of this project: allow for you to start from a base image and customize from it.