From 12c6aea053c367f1dabb03218213a1f7c77352d1 Mon Sep 17 00:00:00 2001 From: cryptooda Date: Sun, 7 Sep 2025 21:47:46 +0700 Subject: [PATCH] fix binding silo --- src/Managing.Bootstrap/ApiBootstrap.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Managing.Bootstrap/ApiBootstrap.cs b/src/Managing.Bootstrap/ApiBootstrap.cs index 8d13af83..de676f90 100644 --- a/src/Managing.Bootstrap/ApiBootstrap.cs +++ b/src/Managing.Bootstrap/ApiBootstrap.cs @@ -113,8 +113,7 @@ public static class ApiBootstrap Environment.GetEnvironmentVariable("COMPUTERNAME") ?? // Windows hostname "localhost"; - // For Docker containers on the same server, use localhost binding with unique ports - IPAddress bindIP = IPAddress.Any; // Bind to all interfaces (0.0.0.0) + // For Docker containers, always use localhost for same-server clustering IPAddress advertisedIP = IPAddress.Loopback; // Advertise as localhost for same-server clustering // Only use external IP if specifically provided for multi-server scenarios @@ -153,9 +152,12 @@ public static class ApiBootstrap }) .Configure(options => { + // Advertise the specific IP for clustering options.AdvertisedIPAddress = advertisedIP; options.SiloPort = siloPort; options.GatewayPort = gatewayPort; + options.SiloListeningEndpoint = new IPEndPoint(IPAddress.Any, siloPort); + options.GatewayListeningEndpoint = new IPEndPoint(IPAddress.Any, gatewayPort); }) .Configure(options => { @@ -193,12 +195,15 @@ public static class ApiBootstrap } else if (string.IsNullOrEmpty(postgreSqlConnectionString)) { - // In Docker/containerized environments, use endpoint options + // In Docker/containerized environments, use endpoint configuration siloBuilder.Configure(options => { + // Advertise the specific IP for clustering options.AdvertisedIPAddress = advertisedIP; options.SiloPort = siloPort; options.GatewayPort = gatewayPort; + options.SiloListeningEndpoint = new IPEndPoint(IPAddress.Any, siloPort); + options.GatewayListeningEndpoint = new IPEndPoint(IPAddress.Any, gatewayPort); }); }