Game dev #2 – Automating

The problem with being a systems administrator is that, if you do your job properly, no one is likely to notice. I spent some efforts in the past week to improve how I manage things with the Minecraft servers, and figured I'd explain here how the process went! The problem

Running a single Minecraft server was easy. Updating? Take server down, swap files, bring back online, done. Then I introduced Raw (now Rodinia). I had to do it twice over. Simple enough. Then Gondwana got split off. Then Avalonia. Then the Lobby. And so on.

As it stands right now, with the additions of minigames, I'm running 11 Minecraft server instances in parallel. Updating to new versions means taking down all 11 servers, replacing the appropriate files, then bringing them online. The same goes for security and performance fixes, and this is a significant work load at this point. It's also easy to make mistakes: if I keep an older version of, say, one of my plugins on a random server, it may still work yet contain a bug that I assume has been fixed for weeks. This happened more than once, and I wanted to streamline the entire update process.

The solution

What I did is create a server launcher. Instead of simply starting each Minecraft server directly (or really, my server wrapper that takes care of launching the server instance), I call that script instead. Written in Python, every time it is run, it copies some files from a central location, places them in the server's directory, then runs the server. The end result is that, every time a server is launched or restarted, it automatically grabs the latest files I've made available to it, ensuring that everything is up to date. This currently includes the Spigot build (the game proper), my wrapper (used for IRC link-ups and remote control), along with my custom-made plugins. New files can be added to that as I need to.

Of course, this raises the issue of updating the launcher itself whenever I want to automatically copy new files, and I don't want to do that either. Thanks to Python's modular structure, I've got a single copy of the core launcher in the shared directory. Each server has a mini-launcher, not likely to required any changes, which is used to call the main one. If I want to keep a new file updated, I only need to edit the one central location.

The result

Keeping a server up to date is super simple now. I place the updated files in the centralized location as soon as they're available, then restart individual servers whenever it's convenient. A simple command is used for each instance: python3 launch.py. And it's done!

I hope you found this insight interesting. Again, feel free to let me know if there's a topic that you'd like me to expand on in a future post! :–)

#gamedev #projects

– Doctacosa