A room's whole transcript is saved with it and the file is capped at 256 KiB, but the transcript was never trimmed: a verbose two-player game hit the cap in round 76, after which every action failed with 'Room data exceeds the storage limit'. Past about 150 KB the oldest lines are now dropped (with their audiences) before saving; the game state is never trimmed, and sequence numbers keep counting from the last line so the app's roll replay and round tracking are unaffected.
9.8 KiB
Internet hosting
The supported single-host layout is Android → HTTPS Caddy proxy → loopback-only Kotlin server → inference backend. Only game endpoints are public. Administration uses SSH port forwarding and a separate random admin key.
This is a bounded anonymous game service, not an account-based service or a DDoS mitigation platform. Distributed abuse can still consume the room quota or request budget. For a closed playtest, restrict ingress to your testers or use a VPN. Do not expose the Kotlin listener directly.
What is enforced
- Eight request workers and a queue of 64, with a JDK connection limit of 128. Excess load may close a connection; clients should retry with backoff.
- Request/header deadlines, a 16 KiB header limit, at most 50 headers, and bounded body reads: 8 KiB for game requests, 16 KiB for administration. Caddy adds its own limits.
- Caddy buffers the small bounded request body before sending it upstream and stops selecting the upstream at 32 concurrent requests. Invalid action credentials and nonexistent/full join targets are rejected before their bodies are read by Java.
- JSON-only writes, strict Bearer authorization, canonical paths, duplicate security-header rejection, Host checks in the production profile, and cross-origin request denial.
- Per-client token buckets: 240 requests/minute, four room creations/minute, twelve joins/minute, sixty actions/minute, and three admin LLM probes/minute. Bursts are bounded separately;
429includesRetry-After. - A shared 2400 requests/minute budget, plus global room-creation (20/minute, burst 10) and join (120/minute, burst 20) budgets. Per-client bookkeeping is capped at 4096 bucket entries; new identities are denied when full until idle entries expire.
- Only explicitly listed numeric proxy peers can supply
X-Real-IP.X-Forwarded-Foris never used. The supplied Caddy configuration replaces client-supplied identity/protocol headers. - Public proxy requests require the configured HTTPS origin. The entire admin surface is denied to remote clients by default, even with a valid admin key. Caddy independently exposes only
/health,/campaigns,/campaigns/*(covers),/rooms, and/rooms/*. - At most 200 room files. Rooms expire after seven days without a write and are removed on the next room creation. Expired sessions cannot be resumed. Each room is capped at 256 KiB, stored privately and replaced atomically; room symlinks are not followed. In long games the oldest transcript lines are dropped (about 150 KB is kept), so a room never outgrows its file.
- A fixed set of room locks prevents unknown-room requests from growing memory. Contended mutations fail quickly; polling reads the last atomically saved snapshot without waiting for narration.
- At most two concurrent LLM operations. Excess game narration falls back to authored text. The full response, including its body, has a deadline and a 100 KB limit. Redirects are not followed, preventing a backend from redirecting credentials elsewhere.
- In production,
LLM_ALLOWED_HOSTSrestricts the exact backend hosts the web panel may select. Local inference is allowed; link-local, multicast, and unspecified literal addresses are rejected. This is not a network sandbox: only list trusted backend hostnames, control their DNS, and restrict outbound traffic where appropriate.
Prepare the host
Use a maintained Linux host with systemd, a currently patched JDK 17, and a current stable Caddy installed from its official distribution. The supplied Caddy configuration was validated with Caddy 2.11.7.
Point your chosen domain's A/AAAA records at the host. Only publish an AAAA record if IPv6 connectivity works. Expose TCP 80/443 for Caddy and retain your existing SSH access. Keep TCP 1337, Caddy's management API, and all inference ports private.
Build the server with ./gradlew -PserverOnly :server:test :server:distZip, or use the updated server ZIP. The ZIP includes deploy/ and this guide. After unzipping it:
sudo useradd --system --home-dir /var/lib/de-praxis --shell /usr/sbin/nologin de-praxis
sudo install -d -m 0755 /opt/de-praxis /etc/de-praxis
sudo cp -a server/bin server/lib server/scripts /opt/de-praxis/
sudo install -m 0600 server/deploy/server.env.example /etc/de-praxis/server.env
sudo install -m 0644 server/deploy/de-praxis.service /etc/systemd/system/de-praxis.service
Skip user creation if that dedicated service account already exists. Keep /opt/de-praxis root-owned so the service cannot modify its own code.
Edit /etc/de-praxis/server.env: set PUBLIC_ORIGIN to your actual HTTPS origin. Keep HOST=127.0.0.1, the loopback-only trusted proxies, and ADMIN_REMOTE_ACCESS=false. The origin must contain no path or trailing slash.
Merge server/deploy/Caddyfile into your host's Caddy configuration, replacing relay.example.com with the same domain. Merge global options with any existing global block rather than creating a second one. Do not overwrite unrelated hosted sites.
sudo caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile
sudo systemctl daemon-reload
sudo systemctl enable --now de-praxis
sudo systemctl reload caddy
The service creates /var/lib/de-praxis with mode 0700 and runs without root privileges, Linux capabilities, or permission to modify the application/system directories. It has a 512 MiB memory ceiling, a 256 MiB Java heap, and bounded task/file-descriptor counts. It deliberately does not prohibit executable memory because the JVM needs JIT compilation.
Configure through a private tunnel
ssh -N -L 9080:127.0.0.1:1337 your-server
Open http://127.0.0.1:9080/admin. Retrieve the admin key from /var/lib/de-praxis/admin.key on the host using your administrative SSH account. Do not put this key in a URL or share it with players.
If inference runs on the same host, use a loopback backend URL. For a LAN or hosted backend, first add its exact hostname/IP to LLM_ALLOWED_HOSTS in the environment file and restart the service. Then configure its URL, model and key through the panel. Persisted settings take precedence over the initial LLM_URL variables.
For trusted local-network testing without a proxy, use --lan --lan-admin (or LAN_MODE=true LAN_ADMIN_ACCESS=true) instead. This is a separate HTTP-only opt-in and cannot be used with this public-hosting configuration.
ADMIN_REMOTE_ACCESS=true exists for operators deliberately building a separate authenticated HTTPS administration route. It also requires PUBLIC_ORIGIN; the supplied public Caddy config will still block /admin. SSH access is the documented default.
The campaign MCP endpoint at /mcp follows the same network restrictions and remains blocked by the supplied public proxy. Use the tunnel's http://127.0.0.1:9080/mcp URL with a scoped MCP API key. Never give the admin token to an assistant. MCP campaign uploads may be up to 576 KiB; any deliberately added HTTPS MCP proxy route needs matching body limits without raising limits on the game routes.
Players enter https://your-domain in Android. Do not distribute http:// internet addresses: the Android testing build also supports plaintext LAN servers, so using the HTTPS address matters.
Verify before inviting players
curl --fail https://your-domain/health
python3 /opt/de-praxis/scripts/security_smoke.py https://your-domain
The security smoke test needs Python 3 and is read-only: it verifies TLS through the platform trust store, HSTS, header replacement, public admin-route denial, and cross-origin rejection. Separately confirm the Kotlin and inference ports cannot be reached from outside the host. Run one short campaign through the Android app using the HTTPS address. The bundled scripts/smoke.py also exercises room creation and simultaneous actions, but creates a disposable test room.
The automated suite covers proxy spoofing, host/origin enforcement, admin isolation, both declared and chunked oversize bodies, rate-limit refill/saturation, room quotas/expiry/symlinks, inference size cancellation/concurrency, and a backend that stalls after sending response headers. Deployment QA also runs the game and security smoke tests through Caddy with a locally trusted test CA; public ACME issuance still requires your actual DNS and host.
Operations
Use journalctl -u de-praxis and journalctl -u caddy for service diagnostics. The app does not print credentials or request bodies. Keep access logging disabled unless you have a reason to retain player IPs; if adding it, redact credentials and set rotation/retention.
Back up /var/lib/de-praxis as private data: it contains backend credentials, the admin key, and player session tokens. Keep backups outside the web root and protect them accordingly. To rotate administration access, supply a new random ADMIN_TOKEN in the root-owned environment file and restart the service. Previous browser sessions then fail authentication.
Review room usage in the control room. To stop new arrivals, disable Accept new transmissions; existing crews can continue. Request-limit, quota, TTL, inference-host, and concurrency environment values are startup policy and require a restart. Per-client limits are shared by users behind the same public NAT address. Tune them alongside your expected number of poll-based clients and backend inference budget.
Keep the JDK, Caddy, OS, and application updated. Preserve the data directory during application upgrades. No template or test run here deploys a service to a public host automatically.
Implementation references: Caddy automatic HTTPS, Caddy request limits, proxy header handling, and JDK 17 HTTP-server settings.