Game server manager: web UI for Valheim and Project Zomboid servers

FastAPI + vanilla JS app run as a Docker container behind Caddy (HTTPS by
IP). install.sh installs or updates it on a server in one command, with
preflight checks and Docker setup; deploy.sh pushes a local checkout to a
server over SSH and runs install.sh there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
neil 2026-10-16 19:54:56 -07:00
commit cb9a6d1970
No known key found for this signature in database
20 changed files with 3801 additions and 0 deletions

88
README.md Normal file
View file

@ -0,0 +1,88 @@
# Game server manager
A small web app for running dedicated game servers on your own Linux server or VPS. You can create,
start, stop and configure servers from a browser, see who's playing, stop idle servers automatically and
keep world backups.
Supported games: **Valheim** and **Project Zomboid** (Build 42, with a Workshop mod picker).
## Install
On your server, as root (or with sudo), run:
```sh
curl -fsSL https://git.neilbantoc.dev/pub/game-servers/raw/branch/main/install.sh | sudo bash
```
When it finishes, it prints the web address (`https://<your server's IP>`) and the login password.
The installer:
- checks the machine first (Linux, root, free ports 443 and 8080, RAM, disk space) and stops with a clear
message if something is wrong;
- installs `curl`, `tar`, `iproute2` and Docker if they're missing (Docker via
[get.docker.com](https://get.docker.com));
- runs the manager in a Docker container named `gsm`, with [Caddy](https://caddyserver.com) in front of it
(container `caddy`) for HTTPS. Caddy gets a free Let's Encrypt certificate for your server's IP
address, so you don't need a domain name;
- keeps its files in `/opt/gsm` and game data in `/srv/gameservers`.
### Options
Set these before `bash`, after `sudo`:
```sh
curl -fsSL https://git.neilbantoc.dev/pub/game-servers/raw/branch/main/install.sh | sudo SITE=games.example.com ADMIN_PASSWORD=hunter22 bash
```
| Variable | Meaning |
| --- | --- |
| `SITE` | Address for the web UI: a domain pointing at the server, or its public IP. Default: the server's public IPv4 |
| `ADMIN_PASSWORD` | Web UI password, set on first install. Default: random, printed at the end |
| `GSM_REF` | Branch or tag to install. Default: `main` |
| `SKIP_DOCKER_INSTALL=1` | Stop with an error if Docker is missing instead of installing it |
### Requirements
- A Linux server with a public IPv4 address. It must be x86_64, because the game images are built for it.
- Enough RAM for the games you want: about 1.5 GB per Valheim server, 3 GB or more per Project Zomboid
server.
- Inbound ports open in your provider's firewall:
- TCP 443 for the web UI, and 80 if it's free (redirects to https);
- UDP for each game server: two ports each, from 2456 for Valheim and from 16261 for Project Zomboid.
The installer opens the web ports in `ufw` if it's active. Docker opens the game ports itself.
## Update
Run the install command again. It downloads the latest version and restarts the manager. Your password,
settings, game servers and worlds are kept. Running game servers keep running.
## Change the password
Edit `ADMIN_PASSWORD` in `/opt/gsm/.env`, then run the install command again.
## Uninstall
```sh
docker rm -f gsm caddy
docker rm -f $(docker ps -aq --filter label=gsm.managed=true) # the game servers
rm -rf /opt/gsm
rm -rf /srv/gameservers # worlds and backups: only if you're sure
```
## Security notes
The manager controls Docker on the host (it mounts `/var/run/docker.sock`), which amounts to root access.
Anyone with the web password can create and delete game servers and their worlds, so use a strong
password.
## Development
`app/` is the FastAPI backend and a plain JavaScript frontend (`app/static/`). To deploy a local checkout,
including uncommitted changes, to a server you can SSH into as root:
```sh
HOST=root@<server> ./deploy.sh
```
This copies the code to `/opt/gsm/src` on the server and runs `install.sh` from there.