N7: Dedicated server packaging, health endpoint and graceful shutdown
- packaging/server/tidewall-server: a wrapper that turns SIGTERM and SIGINT into a clean stop through the server's new --stop-file, since the engine can't catch signals. The server tells everyone it shut down, logs its statistics and exits 0; the wrapper kills it only after 15 s. - --config=PATH reads options from a file (packaging/server/server.cfg); options after it on the command line win. - --health-port answers GET /health with JSON (phase, players, tick, uptime) on loopback by default. HealthServer is non-blocking and bounded. - packaging/docker: a debian:13 image that checks the engine against tools/engine.sha512, imports the game at build time, runs as an unprivileged user, and works with a read-only root and a small /tmp. compose.yaml is project and container tidewall-server, read-only, no capabilities. - packaging/systemd: a hardened unit with a dynamic user. - make server-package-check: compose up, healthy, non-root, read-only, a real headless client joins over UDP into the drop, then SIGTERM stops it cleanly. This also covers H7 (graceful shutdown on SIGTERM). Closes #38 Closes #70 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# An example Tidewall dedicated server. From this directory:
|
||||
#
|
||||
# docker compose up -d builds the image from the repository and starts it
|
||||
# docker compose logs -f the server's JSON log lines
|
||||
# docker compose down stops it cleanly: players are told it shut down
|
||||
#
|
||||
# TIDEWALL_PORT changes the UDP port on the host (default 24650). To change anything
|
||||
# else, mount your own server.cfg over /etc/tidewall/server.cfg (see the commented
|
||||
# volume below) or add options to `command`.
|
||||
name: tidewall-server
|
||||
|
||||
services:
|
||||
server:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: packaging/docker/Dockerfile
|
||||
image: tidewall-server:dev
|
||||
container_name: tidewall-server
|
||||
restart: unless-stopped
|
||||
command: ["--config=/etc/tidewall/server.cfg", "--port=${TIDEWALL_PORT:-24650}"]
|
||||
ports:
|
||||
- "${TIDEWALL_PORT:-24650}:${TIDEWALL_PORT:-24650}/udp"
|
||||
read_only: true
|
||||
tmpfs:
|
||||
- /tmp:size=64m,mode=1777
|
||||
cap_drop:
|
||||
- ALL
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
stop_grace_period: 20s
|
||||
# volumes:
|
||||
# - ./server.cfg:/etc/tidewall/server.cfg:ro
|
||||
Reference in New Issue
Block a user