8000 lbs.gdxsv.net: Caddy site, GCE allocator and replay upload in lbs, retire mcsfunc by inada-s · Pull Request #432 · inada-s/gdxsv · GitHub
[go: up one dir, main page]

Skip to content

lbs.gdxsv.net: Caddy site, GCE allocator and replay upload in lbs, retire mcsfunc - #432

Merged
inada-s merged 2 commits into
masterfrom
ai/lbs-gdxsv-net
Oct 20, 2026
Merged

inada-s merged 2 commits into
masterfrom
ai/lbs-gdxsv-net

Conversation

@inada-s
@inada-s inada-s commented Oct 20, 2026
Copy link
Copy Markdown
Owner

gdxsv side of the hostname split (zdxsv docs/MIGRATION.md phase 0, items 13-17). Nothing changes on the running server until the next release is deployed with the new launch-lbs.sh.

  • infra/lbs/gdxsv.caddy: lbs.gdxsv.net:8443 -> 127.0.0.1:9880 for /lbs/* with CORS, flush_interval -1 for live spectating. Copied to /etc/caddy/sites/ on the VM (caddy is installed there, import sites/*.caddy).
  • mcsfunc -> lbs_gce.go: the lbs talks to the Compute Engine API directly (google.golang.org/api/compute/v1, already a dependency). Same behaviour as infra/mcsfunc/index.js: reuse a running gdxsv-<role>-<region>-latest, restart a stopped one with a fresh startup script, else create it in the first zone that accepts it; delete VMs stopped for 5 days (now also relay VMs, which the function never cleaned). Startup scripts are Go constants with GDXSV_LOBBY_PUBLIC_ADDR substituted (lbs.gdxsv.net:9876 in launch-lbs.sh). GDXSV_MCSFUNC_URL is gone; GDXSV_GCE_ONDEMAND=true enables it. IAM before deploy: the lbs service account needs roles/compute.instanceAdmin.v1 and roles/iam.serviceAccountUser (it attaches gdxsv-service@<project> to the VMs).
  • uploader -> POST /lbs/replay_upload (lbs_replay_upload.go): multipart file <battle_code>.pb -> GCS replays/<battle_code>.pb (gzip, no-transform), then the battle's replay URL is set. 409 for an existing replay, which flycast already treats as success. GDXSV_REPLAY_BUCKET=gdxsv enables it; the service account needs object create/view on the bucket. New dependency cloud.google.com/go/storage.
  • website/src/Status.tsx and run4flycast.sh point at lbs.gdxsv.net; README env docs updated; infra/mcsfunc removed. udptest stays a Cloud Function; infra/lbsapi and infra/uploader stay until old flycast builds are gone (they get repointed to lbs.gdxsv.net:9880 as shims in phase 2).

Tests: lbs_gce_test.go (fake Compute API: reuse / restart / create / relay network / bad params / cleanup) and lbs_replay_upload_test.go; go test ./... passes.

🤖 Generated with Claude Code

…tire mcsfunc

Preparation for the zdxsv/gdxsv hostname split (zdxsv docs/MIGRATION.md phase 0,
gdxsv side). The lobby's HTTP API is served as https://lbs.gdxsv.net:8443/lbs/*
by the host's caddy (infra/lbs/gdxsv.caddy), so the Cloud Functions in front of
it can go:

- mcsfunc (Node) is ported into lbs as lbs_gce.go: one VM per role and region
  via the Compute Engine API, stopped VMs restarted, VMs unused for 5 days
  deleted (now relay VMs too). GDXSV_MCSFUNC_URL is replaced by
  GDXSV_GCE_ONDEMAND; the service account needs compute.instanceAdmin.v1 and
  iam.serviceAccountUser instead of cloudfunctions.invoker. The startup scripts
  take the lobby address from GDXSV_LOBBY_PUBLIC_ADDR (lbs.gdxsv.net:9876).
- uploader becomes POST /lbs/replay_upload: the replay goes to the GCS bucket
  GDXSV_REPLAY_BUCKET as replays/<battle_code>.pb (gzip) and is recorded on
  the battle; 409 when already there, as before.
- website Status.tsx and run4flycast.sh use lbs.gdxsv.net; launch-lbs.sh and
  README follow. udptest stays a Cloud Function; lbsapi and uploader are kept
  for old flycast builds until the apex move.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…loop shape)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@inada-s
inada-s merged commit 528ee1b into master Oct 20, 2026
2 checks passed
@inada-s
inada-s deleted the ai/lbs-gdxsv-net branch October 20, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0