feat: optional UDS listener + health endpoints for Kubernetes deployment - #62
Merged
Conversation
- Add SPROUT_UDS_PATH env var for optional Unix Domain Socket binding - Dual-bind TCP + UDS via tokio::select! (gated with #[cfg(unix)]) - Add /_liveness (always 200) and /_readiness (checks MySQL + Redis) - Concurrent readiness checks with 2s global timeout - Safe UDS cleanup (only removes socket files, not arbitrary paths) - Add Db::ping() method for readiness health checks - Add redis_pool to AppState for readiness probe - Zero behavior change when SPROUT_UDS_PATH is unset
tlongwell-block
added a commit
that referenced
this pull request
Mar 14, 2026
* origin/main: feat: optional UDS listener + health endpoints for Kubernetes deployment (#62) # Conflicts: # crates/sprout-relay/src/config.rs
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.
Summary
Adds two opt-in features for deploying sprout-relay on Kubernetes with an Istio service mesh:
Optional Unix Domain Socket listener — set
SPROUT_UDS_PATHto bind a UDS alongside TCP. Useful when a service mesh sidecar (e.g. Istio/Envoy) delivers traffic via a Unix socket while Kubernetes health probes need TCP.Health endpoints —
/_liveness(always 200) and/_readiness(checks MySQL + Redis connectivity with a 2s timeout).Changes
sprout-db/src/lib.rsDb::ping()—SELECT 1health checksprout-relay/src/config.rsuds_path: Option<String>fromSPROUT_UDS_PATHenv varsprout-relay/src/main.rsserve_dual()— TCP always + optional UDS viatokio::select!,#[cfg(unix)]gatedsprout-relay/src/router.rs/_liveness,/_readinessroutes;ConnectInforead from extensions (works on both TCP and UDS)sprout-relay/src/state.rsredis_poolfield for readiness probeDesign decisions
SPROUT_UDS_PATHis unset — existing deployments are unaffected#[cfg(unix)]— compiles cleanly on all platforms; non-unix logs a warning if the env var is settokio::join!with a single 2s outer timeout (not sequential)deadpool-redisandtokiofeatures/healthendpoint preserved for backward compatibilityTesting
cargo fmt✅cargo clippy --all-targets --all-features -D warnings✅cargo test -p sprout-relay— 88/88 ✅cargo test -p sprout-db— 54/54 ✅