rfvgyhn / docker-avorion

Docker container for Avorion dedicated server
https://hub.docker.com/r/rfvgyhn/avorion
MIT License
26 stars 12 forks source link

If the container dies abruptly, does the Galaxy corrupt? Or other problems happen? #24

Open BloodyIron opened 3 months ago

BloodyIron commented 3 months ago

Looking to run this in my k8s cluster, and I'm wondering how resilient Avorion or this container is to unexpected baddy scenarios. I don't necessarily plan to be abusive here, but I like building tolerant systems, and understanding where/how things break.

So in the scenario where I (or something) tell the pod to terminate, I'm not certain if that will tell the container to nicely shut down or not. But do you think the Galaxy files would corrupt in this scenario?

In the scenario where the k8s node the pod is running on eats dirt (kernel panic, halt, or some sort of other instant failure), I suspect the container would have no opportunity to be told to nicely shut down. In this scenario do you think the Galaxy files would corrupt?

I'm trying to set my reasonable expectations here and identify what I need to do to guard against scenarios like this causing problems I don't want. So whatever insights can be shared would be appreciated, thanks!

Also, thanks for making and maintaining this image series! Yay! :D Much appreciated.

rfvgyhn commented 3 months ago

The container (e.g docker stop) and Avorion handle SIGTERM properly which will save the game and gracefully shutdown.

While I don't believe the save files would corrupt on a sudden termination, I don't think there's any guarantee. That might be a better question for the Avorion devs on their forum. You might need to have a backup strategy if the save files are important enough to you.

lightlike commented 3 months ago

Docker does not handle SIGTERM well when you do not handle that inside the container in some situations. If you want proper Signal handling you can user https://github.com/krallin/tini or https://github.com/just-containers/s6-overlay.

tini was supposed to be integrated into docker to simply add it during build/run(?) but I did not look into that any further. s6-overlay is a bit bigger but comes with some other advantages like rootless execution and fully handled UID and GID among other features.

Some more information can be found here

BloodyIron commented 1 month ago

Well in my testing it seems to be pretty resilient. I beat it up a lot and it seemed to get back up pretty well. And to take extra precaution I also have saves every minute so yeah ;)

Thanks!