Production: https://arena.sharingan.poker
One dedicated bare-metal host (Scaleway EM-B112X-SSD, nl-ams-1: 24 threads, 188 GB RAM, 2x 1 TB SSD RAID1, Ubuntu 24.04; moved off an EM-I420E on 2026-11-03 to cut cost) runs the whole hosted arena.
SHARINGAN-1 (compact blueprint, 124.7 GB, sizing medium) is memory-mapped read-only and shared through ONE host page cache by the
arena, the inference server and every job sandbox.
browser / SDK / curl
| https://arena.sharingan.poker https://sharingan.poker (static site: /play /leaderboard /docs)
v
Cloudflare Worker `sharingan-arena-edge` (deploy/platinum/edge) adds X-Edge-Secret + X-Client-IP, WebSockets pass through
| https://51-158-206-42.sslip.io (Let's Encrypt cert, Caddy)
v
Caddy (host, :443) 403 unless X-Edge-Secret matches. Path routing on ONE hostname:
| /v1/jobs* /v1/quota /v1/credits* /v1/webhooks/* -> runner 127.0.0.1:8090
| /v1/act* /v1/info /v1/health -> serve 127.0.0.1:8081 (a serve API key or any arena bot token)
| everything else (REST, WebSocket /v1/play) -> arena 127.0.0.1:8080
v
podman (rootful, quadlet units, all on network `sharingan-core`)
sharingan-postgres postgres:16-alpine, data in /srv/sharingan/pgdata, DBs `arena` and `runner`
sharingan-core arena :8080 + sharingan-serve :8081 in one container; /srv/sharingan/models mounted :ro; page cache warmed at boot
sharingan-runner job API; BILLING_MODE=free; talks to podman through /run/podman/podman.sock
| one sandbox container per job (label sharingan.sandbox=1, name run-<job>)
v
sharingan-bot image NO network (NetworkMode none), models :ro (same page cache), 4 CPU / 12 GiB / 512 pids, bot runs as uids 10010-10015 (one per rotation of a deal, wiped in between),
signed result -> runner -> arena POST /v1/results -> verified:true. Max 4 jobs in parallel (queue beyond).
Everything is a systemd unit and survives reboot: sharingan-postgres, sharingan-core, sharingan-runner (generated by podman quadlet from
/etc/containers/systemd/*.container|*.network, sources in deploy/production/quadlet/), caddy, sharingan-backup.timer, sharingan-health.timer.
Firewall (ufw): inbound 22, 80, 443 only (+ DNS from the container bridge, + forwarding for the pip window). unattended-upgrades is on.
Free mode (no Stripe yet)
BILLING_MODE=free in the runner: jobs cost nothing, no ledger, the Stripe webhook route is off. Public users authenticate with their arena bot
token (Authorization: Bearer sk_...; the runner validates it with GET /v1/me on the arena, cached 60 s) and only see their own jobs.
Quotas per player: FREE_MAX_HANDS_PER_DAY=1000000 (rolling 24 h) and FREE_MAX_CONCURRENT_JOBS=2 (HTTP 429 quota_hands_per_day / quota_concurrent; a job's planned hands count even if it is aborted or fails, only our own infra failures are free), plus FREE_MAX_CONCURRENT_JOBS_PER_IP=2 and SUBMITS_PER_MINUTE_PER_IP=10 per client address;
GET /v1/quota shows usage. Public users always run in worker mode. RUNNER_AUTH_TOKEN stays the trusted service token (any userId).
To go paid later: set BILLING_MODE=paid + STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET + PRICE_USD_PER_1K_HANDS (the paid path is unchanged, see
deploy/platinum/README.md); the webhook URL is https://arena.sharingan.poker/v1/webhooks/stripe. In paid mode public users need a service in front that
holds RUNNER_AUTH_TOKEN (the paid API is keyed by userId), or extend playerOf() in runner/src/app.ts.
Where things live (all on the host)
/srv/sharingan/secrets/ (700, files 600) |
postgres_password, arena_admin_token, arena_runner_token, worker_sign_key, runner_auth_token, edge_shared_secret, serve_api_keys (name=key,...), and the env files the units load: core.env, runner.env, postgres.env, caddy.env |
/srv/sharingan/config/runner-public.env |
non-secret runner env (WORKER_ENV_JSON: blueprint path, buckets, sizing) |
/srv/sharingan/models/ |
sharingan-1.plcp, buckets-200/ (owner uid 10001, no access for others: the user bot inside a sandbox cannot read the weights) |
/srv/sharingan/pgdata, /srv/sharingan/backups |
Postgres data; nightly dumps |
/srv/sharingan/bin |
backup.sh, healthcheck.sh |
/etc/containers/systemd/, /etc/caddy/Caddyfile, /etc/systemd/system/caddy.service.d/edge.conf |
unit sources |
~/src |
the synced repo (images are built from it) |
| Cloudflare (account 502fc16a...) | Worker sharingan-arena-edge (secret EDGE_SECRET, var UPSTREAM, custom domain arena.sharingan.poker), Worker sharingan (static site) |
No secret is in git. The arena admin token is arena_admin_token (use it for ARENA_ADMIN_TOKEN endpoints).
Redeploy (code change)
# from the Mac
rsync -az --delete --exclude .git --exclude target --exclude data --exclude node_modules --exclude .venv \
-e "ssh -i ~/.ssh/pluribus_ed25519 -o IdentitiesOnly=yes -o UserKnownHostsFile=~/.ssh/known_hosts_pluribus" \
./ ubuntu@51.158.206.42:~/src/
# on the host
cd ~/src
sudo podman build -f deploy/platinum/docker/Dockerfile --target core --build-arg CARGO_BUILD_JOBS=24 -t localhost/sharingan-core:prod . # arena/serve changed
sudo podman build -f deploy/platinum/docker/Dockerfile.bot --build-arg ARENA_IMAGE=localhost/sharingan-core:prod -t localhost/sharingan-bot:prod . # worker/SDK changed (also rebuild after the core image)
sudo podman build -f deploy/platinum/docker/Dockerfile.runner -t localhost/sharingan-runner:prod . # runner changed
sudo cp deploy/production/quadlet/* /etc/containers/systemd/ && sudo systemctl daemon-reload # unit files changed
sudo systemctl restart sharingan-core # drains running matches for 20 s; the runner keeps its jobs and fails them cleanly if the arena is away
sudo systemctl restart sharingan-runner # recover() fails jobs that were mid-flight (free mode: nothing to refund)
Site: CLOUDFLARE_ACCOUNT_ID=502fc16a6392df03de7c478c5242f047 npx -y wrangler@latest deploy at the repo root. Edge Worker: same command in deploy/platinum/edge.
Caddy: sudo cp deploy/production/Caddyfile /etc/caddy/Caddyfile && sudo systemctl reload caddy.
Sandbox AppArmor profile (once per host, and when it changes; the runner's LOCAL_SANDBOX_APPARMOR=sharingan-sandbox needs it loaded):
sudo cp deploy/production/apparmor/sharingan-sandbox /etc/apparmor.d/ && sudo apparmor_parser -r /etc/apparmor.d/sharingan-sandbox.
Isolation check of a new bot image (a bot that tries to keep notes between rotations of duplicate deals must find none):
sudo sh deploy/platinum/bot/test_isolation.sh localhost/sharingan-bot:prod /srv/sharingan/models.
Sandboxes pick up a new sharingan-bot:prod for the next job automatically (the image is referenced by tag).
Upgrade the model (final SHARINGAN-1 replaces sharingan-1.plcp)
The blueprint fingerprint is part of every verified result, so old leaderboard runs stay attributable to the old model.
- Copy the new file next to the old one:
/srv/sharingan/models/sharingan-1-final.plcp(rsync/scp;sudo chown 10001:10001,chmod 640). If the sizing or buckets changed, put the newbuckets-*directory there too and adjustSIZING/ARENA_BUCKETS. - Point the units at it: in
/etc/containers/systemd/sharingan-core.containersetBLUEPRINT_FILE=sharingan-1-final.plcp(andSIZING=if needed); in/srv/sharingan/config/runner-public.envchangeARENA_BLUEPRINT(andARENA_BUCKETS,ARENA_SIZING) to the new path. Both must agree: the arena rejects a worker result whose blueprint fingerprint differs from its own. - Warm the page cache before the cut-over so the first jobs are not disk-bound:
sudo bash -c 'cat /srv/sharingan/models/sharingan-1-final.plcp > /dev/null'(~5 min; RAM is large enough to hold old + new). sudo systemctl daemon-reload && sudo systemctl restart sharingan-core sharingan-runner. Verify:curl https://arena.sharingan.poker/v1/benchmarksshows the newblueprint_fingerprint,GET /v1/info(serve key) shows the new file, then run a hosted job.- Delete the old file once happy. Rollback = revert step 2 and restart.
Rotate secrets
All secrets are files in /srv/sharingan/secrets/; units read them at start.
- Edge secret:
openssl rand -hex 32 > edge_shared_secret, rewritecaddy.env(EDGE_SECRET=...),sudo systemctl restart caddy, thencat edge_shared_secret | CLOUDFLARE_ACCOUNT_ID=502fc16a6392df03de7c478c5242f047 npx wrangler secret put EDGE_SECRET(fromdeploy/platinum/edge). Do both within a minute: traffic is 403 in between. - Runner / admin / runner-token / worker key: new value in the file, rewrite the matching lines in
core.envandrunner.env(ARENA_RUNNER_TOKENandARENA_WORKER_KEYS=runner1=<key>in core;ARENA_RUNNER_TOKEN,WORKER_SIGN_KEY,RUNNER_AUTH_TOKENin runner), restartsharingan-corethensharingan-runner. - Postgres password:
ALTER USER sharingan PASSWORD '...'viasudo podman exec -it sharingan-postgres psql -U sharingan, updatepostgres.env,core.env,runner.env, restart all three. - Serve API keys: edit
serve_api_keysandSHARINGAN_API_KEYS=incore.env(name=key,name2=key2), restartsharingan-core. Hand a key to someone = one newname=key. - Individual players' bot tokens are shown once at registration and stored hashed; there is no recovery, register a new bot.
Backups
sharingan-backup.timer runs /srv/sharingan/bin/backup.sh nightly at ~03:17 UTC: pg_dump -Fc of arena and runner into /srv/sharingan/backups/<db>-<ts>.dump, 14 days kept.
Restore: sudo podman exec -i sharingan-postgres pg_restore -U sharingan -d arena --clean --if-exists < /srv/sharingan/backups/arena-<ts>.dump.
These dumps live on the same disk: copy them off-box (e.g. rsync to the Mac or object storage) if the data matters. The model is not backed up here (the originals are in pluribus-repro-2026).
Manual run: sudo systemctl start sharingan-backup.service.
Monitoring basics
sharingan-health.timer(every 2 min) runshealthcheck.sh: units active, arena/readyz, serve/v1/health, runner/readyz, disk < 85 %, sandbox count. A failure makes the unit fail:systemctl list-units --failed,journalctl -u sharingan-health -n 20. Wire an external uptime check tohttps://arena.sharingan.poker/readyz.- Logs:
sudo journalctl -u sharingan-core -f(arena + serve JSON lines),-u sharingan-runner,-u caddy;sudo podman logs sharingan-runner. - Load/sandboxes:
sudo podman ps --filter label=sharingan.sandbox=1,sudo podman stats --no-stream,htop. Page cache:free -g(buff/cache should hold the 125 GB model). - Jobs:
curl -H "Authorization: Bearer $(cat /srv/sharingan/secrets/runner_auth_token)" localhost:8090/v1/jobs?userId=<player_id>; stuck sandboxes are reaped every 5 minutes and at runner start. - Reboot test:
sudo reboot; everything returns by itself (core takes a minute to warm). Certificates renew automatically (Caddy).
Verify from outside
curl https://arena.sharingan.poker/healthz ; curl https://arena.sharingan.poker/v1/house
sharingan eval mybot.py --server https://arena.sharingan.poker --hands 20000
sharingan benchmark mybot.py --track sharingan-1 --server https://arena.sharingan.poker
sharingan submit mybot.py --server https://arena.sharingan.poker --hands 20000 # hosted job, VERIFIED
Note: the default Python-urllib User-Agent is blocked by Cloudflare (error 1010); the SDK sets its own User-Agent, plain curl works, other clients should set one.
Known limits
- Sandboxes are containers (rootful podman, no network, no-new-privileges, AppArmor sharingan-sandbox, bot uids 10010-10015 without capabilities, pid/cpu/mem limits), not microVMs. A kernel-level escape would reach root on this host, which holds the model and secrets: this host is dedicated to this service for that reason. Move to Platinum microVMs when G15 (shared RO model volume) lands.
requirementsFilejobs get a short egress window (pip) on thesharingan-egressnetwork; arbitrarysetup.pycode runs there.- One host: no HA. Restoring from a dead host = new host + this README + backups + the model file.