DEV Community

Cover image for What I learned automating game servers on a VPS over SSH
Fikret Sanal
Fikret Sanal

Posted on

What I learned automating game servers on a VPS over SSH

Full disclosure: I'm part of the team behind Captanel, the app this post is about.

We wanted game servers for friends (Minecraft, Valheim, CS2...) on a cheap Linux VPS without anyone touching a terminal. The app runs on Windows and does everything over SSH, with no agent or web panel on the server. Three problems were more interesting than expected.

Memory limits that don't kill the game

Limits are applied with docker update right away and a docker-compose.override.yml so they survive reinstalls. The catch: the game's own heap setting (e.g. Minecraft's MEMORY=) must stay at least 512 MB below the container limit, or the server dies on boot.

Banning in a game that has no ban command

CS2 has no built-in ban. We read players from RCON status and drop a banned IP's traffic in the DOCKER-USER chain, only on the game port, so SSH and websites are untouched.

Restarts that warn players first

Scheduled restarts live in /etc/cron.d. With a 05:00 restart and a 5-minute warning, players get a message at 04:55, the world is saved, then the server restarts.

Supported: Minecraft, CS2, FiveM, Rust, Valheim, Palworld, Project Zomboid, Satisfactory, Garry's Mod, Terraria, MTA:SA, open.mp. Windows only; the installer isn't code-signed yet, so SmartScreen will warn.

If you run game servers: what's the most annoying part for you?

https://captanel.com

Top comments (0)