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); }); }