Minecraft Server Wake on load

Wanted Goal

I currently have a Minecraft server running for my needs on an i7 4770 server with 16GB of DDR3 RAM. The performance is good enough for a cheap server, but with energy costs rising, it pains me to leave this PC running 24/7 (even when no one is connected to the server). That's where this idea came from: running a Minecraft lobby server on my mini PC with an Intel N100 which consumes almost nothing compared to the i7. When a player connects, the lobby server should be able to wake up the more powerful i7 PC, which consumes more energy but has better performance, to make the survival server available. The N100 will only run the lobby server, where players will connect, and as soon as they do, a script will wake up the i7 PC via Wake-on-LAN, which will then open the connection to the Minecraft survival server.

Security

I want these services to run in a VLAN separate from my main network. Since my Minecraft server is accessible to the world, I want to ensure that even if it gets compromised, I have time to detect it before an attacker can do any real harm. For this reason, I will place both machines in a VLAN separate from my private network. I will apply necessary updates as soon as possible (or even set them to automatic, though I'm not sure yet). Additionally, I will set up extensive logging with a Wazuh server, firewall, Grafana statistics, and alerts to properly monitor both machines. Everything will be fully containerized with Docker.

production

The setup ended up being different... I was in a hurry to make the server accessible to my friends, but after realizing that no one was connecting, I decided to go for a simpler solution. So, I created a Python script that manages a Discord bot. This bot responds to commands entered in a private Discord channel to turn the i7 server on or off. Currently, my main server runs Proxmox, which manages a VM where Minecraft is hosted. The Python script controlling the bot runs on my N100, and when the power-on command is entered in Discord, it sends a Wake-on-LAN magic packet to the Proxmox server. This turns on the Proxmox server, which automatically starts the Minecraft VM. But that was without considering the fact that my friends would forget or simply not take the time to turn off the machine. That’s why I created a second auto-shutdown script on the Proxmox hypervisor. On the Proxmox hypervisor, a script runs under a user named "minecraft" (with no special privileges). This script connects to the mcstatus service to check how many players are currently on the Minecraft server. If no players have been connected for more than 20 minutes, the script shuts down the Minecraft VM and then powers off the Proxmox server. Illustration 4
germain@godef.be
Linkedin