Repository navigation
lbs.gdxsv.net: Caddy site, GCE allocator and replay upload in lbs, retire mcsfunc - #432
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gdxsv side of the hostname split (zdxsv
docs/MIGRATION.mdphase 0, items 13-17). Nothing changes on the running server until the next release is deployed with the newlaunch-lbs.sh.infra/lbs/gdxsv.caddy:lbs.gdxsv.net:8443->127.0.0.1:9880for/lbs/*with CORS,flush_interval -1for live spectating. Copied to/etc/caddy/sites/on the VM (caddy is installed there,import sites/*.caddy).lbs_gce.go: the lbs talks to the Compute Engine API directly (google.golang.org/api/compute/v1, already a dependency). Same behaviour asinfra/mcsfunc/index.js: reuse a runninggdxsv-<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 withGDXSV_LOBBY_PUBLIC_ADDRsubstituted (lbs.gdxsv.net:9876inlaunch-lbs.sh).GDXSV_MCSFUNC_URLis gone;GDXSV_GCE_ONDEMAND=trueenables it. IAM before deploy: the lbs service account needsroles/compute.instanceAdmin.v1androles/iam.serviceAccountUser(it attachesgdxsv-service@<project>to the VMs).POST /lbs/replay_upload(lbs_replay_upload.go): multipart file<battle_code>.pb-> GCSreplays/<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=gdxsvenables it; the service account needs object create/view on the bucket. New dependencycloud.google.com/go/storage.website/src/Status.tsxandrun4flycast.shpoint atlbs.gdxsv.net; README env docs updated;infra/mcsfuncremoved.udpteststays a Cloud Function;infra/lbsapiandinfra/uploaderstay until old flycast builds are gone (they get repointed tolbs.gdxsv.net:9880as shims in phase 2).Tests:
lbs_gce_test.go(fake Compute API: reuse / restart / create / relay network / bad params / cleanup) andlbs_replay_upload_test.go;go test ./...passes.🤖 Generated with Claude Code