feat(velocity): drain players via transfer before shutdown - #66
Merged
Conversation
A proxy pod that is rolled today kicks everyone on it. The preStop hook now calls a loopback drain endpoint instead: lobby players are moved to another proxy with a Minecraft transfer packet immediately, players inside a round stay until the round sends them back towards a lobby (that connect becomes the transfer), and at the deadline the rest is transferred regardless. New logins are denied while draining. Wait-only without GROUNDS_DRAIN_TRANSFER_HOST; endpoint is loopback so only the pod's own preStop hook can trigger it.
GROUNDS_DRAIN_TRANSFER_HOST becomes an override: without it the target is this region's own entry in the REGIONS catalogue (what /region already transfers players with), selected by REGION. One shared values file then drains correctly in every region.
|
hbrombeer
marked this pull request as ready for review
August 1, 2026 19:46
This was referenced Aug 2, 2026
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.



Core of the proxy drain project: a Velocity pod that is rolled today kicks everyone on it. The chart's preStop hook (groundsgg/charts, grounds-velocity 0.9.0) now calls a loopback drain endpoint served by this plugin:
ServerPreConnectEvent).Endpoints (loopback only):
/drain/start?deadlineSeconds=N,/drain/players,/drain/status.GROUNDS_DRAIN_TRANSFER_HOSTunset = wait-only drain.Session correctness on transfer (reconnect vs. stale session) is handled by groundsgg/library-grpc-contracts#78 / groundsgg/service-player#95 / groundsgg/plugin-player#31 — deploy those first or transferred players bounce off
ALREADY_ONLINEfor up to 90s.Rollout order: contracts → service-player → plugin-player → this (new velocity image) → charts grounds-velocity 0.9.0 → deploy values (
drain.enabled,drain.transferHost,terminationGracePeriodSeconds).