site/content/dev/alex/_index.md

1.4 KiB

title summary type params
Alex Minecraft server wrapper that automates world backups project
links
name url
Source https://git.rustybever.be/Chewing_Bever/alex

Alex was created to solve an issue I'd been having: inconcistent Minecraft server backups.

My original backup system involved compressing the server world and config directories in a tarball. While this usually worked, the command regularly failed due to conflicts while reading a file the server was writing to. Because the Minecraft server is unaware of the fact it's being backed up, it continuously writes data to disk, preventing the tar command from doing its job.

My solution for this consisted of designing a process that wraps the Minecraft server process and interacts with its standard input. The Minecraft server accepts certain commands (save-all and save-on/save-off) that allow an admin to control when and if the server writes data to disk. Using this, the wrapper process tells the server to flush all data, stop writing to disk, and only resume writing after a successful backup has been created.

This idea was then expanded to implement incremental backups, which greatly reduced the time and disk size needed for the backups. For reference, our ~2.5GB world folder can be backed up incrementally in less than 5 seconds, with backups running every thirty minutes, without ever turning off the server.