From d371975870d1921b3f53acc53214c54b12910e90 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Thu, 19 Mar 2026 02:13:48 +0000 Subject: [PATCH] fix(gateway): enable cluster sync without requiring BOOTNODE_URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, SYNC_ENABLED was tied to BOOTNODE_URL being set, creating a chicken-and-egg problem: the first node in a cluster had no bootnode to point to, so sync was disabled entirely. Now sync is enabled whenever NODE_ID > 0. Peer auto-discovery works via incoming sync connections — when another node syncs to us, WaveKV's handle_sync automatically adds the sender as a peer. BOOTNODE_URL remains optional for speeding up initial discovery. --- gateway/dstack-app/builder/entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gateway/dstack-app/builder/entrypoint.sh b/gateway/dstack-app/builder/entrypoint.sh index d8eaa114..915c289e 100755 --- a/gateway/dstack-app/builder/entrypoint.sh +++ b/gateway/dstack-app/builder/entrypoint.sh @@ -43,7 +43,11 @@ if [[ ! "$NODE_ID" =~ ^[0-9]+$ ]]; then exit 1 fi -SYNC_ENABLED=$([ -z "$BOOTNODE_URL" ] && echo "false" || echo "true") +# Sync is always enabled when NODE_ID > 0. Peer auto-discovery works via incoming +# sync connections: when another node syncs to us, we learn about it automatically +# through WaveKV's handle_sync, which auto-adds the sender as a peer. +# BOOTNODE_URL is optional — it speeds up initial discovery but is not required. +SYNC_ENABLED=$([ "$NODE_ID" -gt 0 ] && echo "true" || echo "false") echo "WG_IP: $WG_IP" echo "WG_RESERVED_NET: $WG_RESERVED_NET"