Autoscaling BingoMC on Hetzner Cloud
Game servers that appear when players arrive and disappear when they leave. BingoMC rents cloud servers by the hour instead of paying for a fleet of monthly ones.
BingoMC is a Minecraft Bingo network with busy evenings and quiet mornings. Paying monthly for enough servers to cover the peak means paying for servers that sit empty most of the day. So the network rents its game servers by the hour, and only while it needs them.
Scaling up
A job checks the network every few seconds. It knows how many players are online and how many game servers are waiting for players, and it works out what it needs: one game for every few players, and always a couple of games ready to join.
When there isn’t enough room, it creates a new Hetzner Cloud server through the API. The server boots with a cloud-init script that installs Docker and starts a small worker. The worker starts game servers in containers, registers them in the database, and replaces each one when its game ends. Servers are ready within minutes, which allows us to scale up quickly when players arrive.
Scaling down without kicking anyone
When the network is quiet, the job picks a node to retire, but only if the rest can still carry the load. It doesn’t shut anything down itself. The node is marked as draining and the job waits for all its games to finish. When the last game ends, the node is removed from the database and removed through the Hetzner Cloud API.
The result
Capacity is scaled seamlessly when players join. The network can handle a busy evening, and the bill stays low when less players are online.