-
Notifications
You must be signed in to change notification settings - Fork 962
feat(relay): graceful tunnel drain on SIGTERM #4594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b8055fa
feat(relay): graceful tunnel drain on SIGTERM
saddlepaddle 191f4ec
fix(relay): use SIGINT for drain + kill_timeout=10s on Fly
saddlepaddle 96bae9b
chore(relay): add deploy-staging.sh for parametrized staging deploys
saddlepaddle 366f612
fix(relay): clear self-owned directory entries on startup
saddlepaddle 9771b37
fix(host-service): lower reconnect MAX_MS from 30s to 5s
saddlepaddle 214adb0
fix(relay): address PR review — close-code, accept-during-drain, batc…
saddlepaddle ae630c4
chore(relay): post-deploy smoke test across all regions
saddlepaddle 3aee590
fix(relay): in-band drain signal before WS close on shutdown
saddlepaddle 75994e0
fix(relay): await directory cleanup during drain; reject registers wh…
saddlepaddle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #!/usr/bin/env bash | ||
| # Deploy the relay to the staging Fly app (superset-relay-staging). Mirrors | ||
| # deploy.sh but targets fly.staging.toml + the staging app, so we can iterate | ||
| # on multi-region without risking prod. Edit REGIONS to grow the fleet. | ||
| set -euo pipefail | ||
|
|
||
| APP=superset-relay-staging | ||
| REGIONS=(sjc iad fra) | ||
| COUNT=${#REGIONS[@]} | ||
| REGION_LIST=$(IFS=, ; echo "${REGIONS[*]}") | ||
|
|
||
| cd "$(git rev-parse --show-toplevel)" | ||
|
|
||
| echo "==> fly deploy ($APP)" | ||
| fly deploy \ | ||
| --config apps/relay/fly.staging.toml \ | ||
| --dockerfile apps/relay/Dockerfile \ | ||
| --app "$APP" \ | ||
| . | ||
|
|
||
| echo "==> fly scale count: $COUNT machines, 1 per region across $REGION_LIST" | ||
| fly scale count "app=$COUNT" \ | ||
| --region "$REGION_LIST" \ | ||
| --max-per-region 1 \ | ||
| --app "$APP" \ | ||
| --yes | ||
|
|
||
| echo "==> Status" | ||
| fly status --app "$APP" | ||
|
|
||
| echo "==> Smoke test" | ||
| "$(dirname "$0")/smoke-test.sh" "${APP}.fly.dev" "${REGIONS[@]}" |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #!/usr/bin/env bash | ||
| # Post-deploy smoke test for the relay. Hits /health on the public hostname | ||
| # with `fly-prefer-region` for every region the fleet is supposed to span, | ||
| # then verifies the response 200s with `region` matching the requested | ||
| # region — catches partial-deploy failures, missing regions, and machines | ||
| # that booted but aren't actually serving. | ||
| # | ||
| # Usage: smoke-test.sh <hostname> <region> [<region> ...] | ||
| # smoke-test.sh superset-relay-staging.fly.dev sjc iad fra | ||
| # | ||
| # Exits non-zero on any failure so callers (deploy.sh, deploy-staging.sh) | ||
| # can halt the pipeline. | ||
| set -euo pipefail | ||
|
|
||
| if [ $# -lt 2 ]; then | ||
| echo "usage: $0 <hostname> <region> [<region> ...]" >&2 | ||
| exit 64 | ||
| fi | ||
|
|
||
| HOSTNAME="$1" | ||
| shift | ||
| REGIONS=("$@") | ||
|
|
||
| fail=0 | ||
| for region in "${REGIONS[@]}"; do | ||
| printf " %-4s " "$region" | ||
| body=$(curl -sS --max-time 8 -H "fly-prefer-region: $region" "https://${HOSTNAME}/health" 2>&1) || { | ||
| printf " ✗ curl failed: %s\n" "$body" | ||
| fail=$((fail + 1)) | ||
| continue | ||
| } | ||
| got=$(printf "%s" "$body" | sed -nE 's/.*"region":"([^"]+)".*/\1/p') | ||
| if [ "$got" = "$region" ]; then | ||
| printf " ✓ %s\n" "$body" | ||
| else | ||
| printf " ✗ wanted region=%s, got=%s: %s\n" "$region" "$got" "$body" | ||
| fail=$((fail + 1)) | ||
| fi | ||
| done | ||
|
|
||
| if [ "$fail" -ne 0 ]; then | ||
| echo "==> smoke test FAILED: $fail region(s) did not respond as expected" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "==> smoke test OK across ${#REGIONS[@]} region(s)" | ||
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The smoke test never verifies HTTP status 200, so non-200
/healthresponses can be treated as success if the body still matches the region.Prompt for AI agents