Zeal central operations -- 2026-10-13
====================================

Deployment selected by the owner
--------------------------------
MS-02 owns accounts/GUID registration, friends, party invites, reservations,
the server registry/monitor, Elo/placements/results/leaderboards, moderation,
the website/downloads and the encrypted voice relay. SQLite stays on local
MS-02 storage. Clients never carry database, moderation, bridge or RCON keys.
Psychz machines host the game processes and one lobby/rating bridge pair per
game process. The MS-02 LAN game is retired from matchmaking. This does not
create a second rating pool or split duos. Public game endpoints:

  zeal01-1  108.181.132.237:28960     zeal01-2  108.181.132.237:28961
  zeal02-1  108.181.132.159:28960     zeal02-2  108.181.132.159:28961

Both hosts run Debian 13, two instances each. Four matches provide 32 player
seats; this is the configured capacity, not a 32-human performance benchmark.
See deploy/psychz-inventory.json and docs/PSYCHZ-HOSTING.txt. The installer
discovers the registry dynamically; this move requires no player update.

Live control endpoints
----------------------
https://zeal.family -- registration, account controls and installer download
https://zeal.family/admin -- authenticated staff dashboard
https://ranked.zeal.family -- player party/matchmaking/voice-control API
https://results.zeal.family -- authenticated game result API

The last two services have certificate-validated TLS on both sides of the
Cloudflare connector. Their origins bind to 127.0.0.1, not the LAN/public NIC.
Cloudflare provides player-facing certificates. A private local CA validates
the MS-02 origins; clients do not install this CA. zeal-origin-tls.timer checks
daily around 04:00-05:00 Chicago time and renews origins with less than 30 days
remaining. Renewal restarts the affected service; parties may need to reopen
Ranked during that maintenance. CA key: root-only
/etc/zeal/tls/private. No certificate verification bypass is enabled.

Staff use
----------
Open Register in the updated game, including if already registered. The signed
game proof opens a 15-minute browser session. Follow Staff dashboard. Cynic, Ynzie
and xDLJ are equal owners. Owners assign moderator/admin roles to registered names;
staff do not need SSH or a shared root password to moderate.

Owners are created and removed only on MS-02, never from the dashboard, so a
stolen browser session cannot change who controls Zeal. Owners cannot restrict,
kick or demote each other. Both commands are recorded in the audit history:

  cd /opt/zeal-ranked
  ./venv/bin/python -m zeal_accounts.admin --database /var/lib/zeal/accounts.sqlite3 grant-owner USERNAME
  ./venv/bin/python -m zeal_accounts.admin --database /var/lib/zeal/accounts.sqlite3 revoke-owner USERNAME

revoke-owner returns that account to admin and refuses to remove the last owner.

Each player row lists accounts that shared an IP address or network (protected
fingerprints; moderators never see addresses). Admins and the owner can open
a player's IP history, including raw addresses for VPN checks, with a recorded
reason. See DEVICE-ENFORCEMENT.txt, IP evidence.

Available actions: ranked suspensions, voice transmission timeouts, social
timeouts, current-session removal, lifting restrictions, report review and role
changes. Moderators can apply up to seven days. Admin/owner can apply permanent
restrictions. Self/equal/higher-role targets are protected; only an owner
changes staff roles. Reasons are required and actions are recorded. Lifting a
higher-role restriction requires that role or higher. Reports never auto-ban.

Players can block/unblock and report from Invite/Friends or the account website.
The website accepts a specific report reason. Blocking removes the friendship
and pending requests, prevents invitations/code joins, and blocks voice in both
directions. Reports are limited to five/hour per account, with one open report
per pair. Invites, API calls, new party sessions and concurrent HTTP workers
are bounded. Native in-game inherited admin GUIDs and !giveadmin cannot grant
Ranked authority; staff actions go through the central authenticated dashboard.

Monitoring and maintenance
--------------------------
The dashboard refreshes every five seconds while visible. It shows each instance,
game phase, current player/queued counts, last heartbeat age and active/drain/
offline mode. Counts and reservations also exist in the server monitor API/CLI.
Heartbeats stop if the actual GSC presence file stops updating; a living bridge
alone cannot make a crashed game healthy. Five seconds without a valid report
makes the instance unavailable for new assignments. This is process/presence
monitoring, not proof that an Internet firewall permits game UDP, CPU/frame-time
monitoring or a substitute for testing public reachability.

Each instance has a kind. Ranked instances rate matches; Unranked instances take
parties of up to eight and are refused by the rating service even if their game
tried to begin a rated match. Set the kind centrally and match it on the game host:

  ./venv/bin/python -m zeal_accounts.admin --database /var/lib/zeal/accounts.sqlite3 server-kind zeal02-2 unranked
  (instance.cfg on the host: set comp_ranked_rated 0; Ranked instances omit it)

Parties only see and reserve instances of their own mode. Clients older than 1.36
open Ranked only and never see Unranked instances.

Drain/offline stop NEW reservations; neither forcibly ends an active match.
Use drain, wait for players to leave, then update/restart the instance. Existing
matches finish using their frozen rating roster. Parties are ephemeral: a lobby
service restart requires reopening Ranked; persisted accounts/results remain.
There is no automatic backend failover if MS-02 or its Internet link fails.

Adding a game instance (no client update)
-----------------------------------------
On MS-02, inside the existing iw4x-qa container:

  cd /opt/zeal-ranked
  ./venv/bin/python -m zeal_accounts.admin --database /var/lib/zeal/accounts.sqlite3 add-server \
    --id ash1-1 --label "Ashburn 1 Lobby 1" --address ACTUAL_PUBLIC_IP:28960 \
    --scriptdata /srv/zeal/instances/ash1-1/game/userraw/scriptdata \
    --output /root/private-enrollment/ash1-1

Use the real public IPv4/hostname, never the literal placeholder. Each instance
needs its own ID, port, writable game directory, Wine prefix and bridge pair.
Start with two instances per Psychz host. Qualify a third using measured frame
time, load, loss and headroom on the actual host; the estimate is not a benchmark.
The registry supports up to 32 instances. Enrollment immediately adds the entry;
it remains unavailable until healthy. Public discovery includes no bridge keys.

Transfer that private output directory over SSH to the game host. Store the two
JSON files outside userraw/game downloads, readable only by that instance's bridge
user. Both URLs already use HTTPS. The lobby and rating credentials are distinct,
revocable and confined to one instance; only their SHA-256 hashes are stored in
the central registry. Never package the private enrollment output in the installer.

deploy/*.service are systemd templates for Debian/Wine hosts. They assume:
  game user zg-INSTANCE and bridge user zb-INSTANCE, shared spool group zi-INSTANCE;
  /srv/zeal/instances/INSTANCE/game with the matching native DLL and all scripts/mp;
  /var/lib/zeal-instances/INSTANCE/wine owned by the game user;
  /etc/zeal/instances/INSTANCE/{game.env,lobby-bridge.json,rating-bridge.json};
  /opt/zeal-ranked containing this Python source and a working Python3 venv.
Install the original game's dependencies/assets and Bot Warfare dependencies too.
Create game.env with DISPLAY=:101 (use a different display per instance).
Set net_port and hostname in that game's instance.cfg. Use comp_ranked_auto 1,
comp_elo_backend service, comp_qa 0, bots_manage_fill 0 and sv_lanOnly 0 for public
instances. Keep RCON private or disabled. Give scriptdata directory group zi-INSTANCE,
setgid/default group write access, and umask 0007; bridge replies are mode 0660.
Keep code/configs root-owned and account/rating databases entirely off game hosts.

Start zeal-ranked-display@INSTANCE, zeal-ranked-game@INSTANCE,
zeal-ranked-lobby-bridge@INSTANCE and zeal-ranked-rating-bridge@INSTANCE.
Check the dashboard, public UDP queries and a full eight-player Windows match.
Then repeat enrollment with ash1-2, ash2-1, ash2-2 etc. When ready, drain qa:

  ./venv/bin/python -m zeal_accounts.admin --database /var/lib/zeal/accounts.sqlite3 server-mode qa drain

Use the same command with active or offline for other modes. Do not re-enroll
an existing ID to rotate a key. Instead use rotate-server --id ash1-1 with the
same --scriptdata and a NEW private --output directory. Transfer both new configs
and restart that instance's bridges. Old credentials stop authenticating at once.
The CLI writes the new config files before activating their keys.

Public voice network
--------------------
The relay remains on MS-02. Its advertised endpoint is 108.181.132.237:29901.
Zeal-01 forwards only that UDP port through WireGuard to 10.77.90.2:29901 on
MS-02. The tunnel admits only voice packets and their replies; it cannot forward
to the home LAN or reach SSH, accounts, ratings or administration. Players use
SRTP and obtain their session keys through the existing HTTPS API. They do not
install WireGuard. This forwarding host does not run the voice relay or hold
central voice session keys. Game UDP goes directly to each Psychz host.

Normal Cloudflare website tunnels do not publish raw game/voice UDP. Provider
UDP protection is separate from HTTPS and the port/commit speed. If Zeal-01
goes offline, public voice loses its forwarding path, including for Zeal-02
matches. Central services and Zeal-02 game processes remain separate; automatic
voice gateway failover is not implemented. Drain and schedule gateway reboots.

Ratings and recovery
---------------------
The lobby's rating credential can read profiles and leaderboards only. It cannot
begin/finish/cancel matches or export the full snapshot. A game writer is scoped
to its instance. New match rosters must be registered, centrally reserved for that
instance, in the allowed map/mode pool, and keep the whole duo on one team. Existing
idempotent begin/finish retries still work after reservation expiry. Game servers
remain trusted to report honest scores/outcomes; this is not anti-cheat attestation.

Configs: /etc/zeal. Central source/venv: /opt/zeal-ranked.
Accounts/registry/moderation: /var/lib/zeal/accounts.sqlite3.
Ratings: /var/lib/zeal-ratings/ratings.sqlite3 (only the rating service writes).
MS-02 test game: /srv/zeal/game-qa; /root/iw4x remains a compatibility alias.
Migration backups: /root/qa-state/central-20261013, including both SQLite online
backups, configs, previous service definitions, native DLL and scripts.
Use SQLite backup APIs, not a copy of a live main DB without its WAL. Keep a
separate private off-host backup of persistent data and the owner's GUID key.
Do not revert just one database after results are committed; reconcile the
matching game/outbox/results audit first. Game bridges retain unsent results.

Installer and source
---------------------
The website serves installer 1.29, its SHA-256 and full corresponding IW4x native
source. Ranked, voice, account integration, branding, badges and class restrictions
are mandatory; only DLC is optional. The installer carries no fixed LAN game pool.
Base-game and optional DLC archives are hosted on MS-02 at versioned HTTPS URLs
under zeal.family/downloads/packages/. Google Drive IDs, downloads and browser
fallbacks were removed. Both automatic and local/browser packages are SHA-256
checked against pins embedded in the installer before extraction. Interrupted
transfers resume across cancelled runs. HTTPS downgrades and invalid ranges fail.
A separate unprivileged nginx service streams these files, leaving registration
and matchmaking workers available. See DOWNLOAD-HOSTING.txt for paths, updates,
limits and deployment. Windows publisher signing is not implemented.
