fix a bit orleans
This commit is contained in:
@@ -56,6 +56,7 @@ In `appsettings.Production.json`:
|
|||||||
#### Environment Variables
|
#### Environment Variables
|
||||||
- `RUN_ORLEANS_GRAINS`: Enable/disable Orleans grains (true/false)
|
- `RUN_ORLEANS_GRAINS`: Enable/disable Orleans grains (true/false)
|
||||||
- `DISABLE_ORLEANS_CLUSTERING`: Force localhost clustering (true/false)
|
- `DISABLE_ORLEANS_CLUSTERING`: Force localhost clustering (true/false)
|
||||||
|
- `ORLEANS_ADVERTISED_IP`: Set specific IP address for Orleans clustering (e.g., "192.168.1.100")
|
||||||
- `ASPNETCORE_ENVIRONMENT`: Set environment (Production/Development/etc.)
|
- `ASPNETCORE_ENVIRONMENT`: Set environment (Production/Development/etc.)
|
||||||
|
|
||||||
### 3. Network Configuration Improvements
|
### 3. Network Configuration Improvements
|
||||||
|
|||||||
@@ -124,22 +124,28 @@ public static class ApiBootstrap
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configure networking for better silo communication
|
// Configure networking for better silo communication
|
||||||
|
var advertisedIP = Environment.GetEnvironmentVariable("ORLEANS_ADVERTISED_IP");
|
||||||
|
IPAddress advertisedIPAddress = null;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(advertisedIP) && IPAddress.TryParse(advertisedIP, out var ipAddress))
|
||||||
|
{
|
||||||
|
advertisedIPAddress = ipAddress;
|
||||||
|
}
|
||||||
|
else if (disableOrleansClustering)
|
||||||
|
{
|
||||||
|
advertisedIPAddress = IPAddress.Loopback;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (advertisedIPAddress != null)
|
||||||
|
{
|
||||||
|
siloBuilder.ConfigureEndpoints(advertisedIPAddress, 11111, 30000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
siloBuilder.ConfigureEndpoints(siloPort: 11111, gatewayPort: 30000);
|
||||||
|
}
|
||||||
|
|
||||||
siloBuilder
|
siloBuilder
|
||||||
.ConfigureEndpoints(siloPort: 11111, gatewayPort: 30000, advertisedIP: null, listenOnAnyHostAddress: true)
|
|
||||||
.Configure<EndpointOptions>(options =>
|
|
||||||
{
|
|
||||||
// Set the advertised IP address for clustering
|
|
||||||
var advertisedIP = Environment.GetEnvironmentVariable("ORLEANS_ADVERTISED_IP");
|
|
||||||
if (!string.IsNullOrEmpty(advertisedIP) && IPAddress.TryParse(advertisedIP, out var ipAddress))
|
|
||||||
{
|
|
||||||
options.AdvertisedIPAddress = ipAddress;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Fallback to localhost for single-node deployments or when clustering is disabled
|
|
||||||
options.AdvertisedIPAddress = disableOrleansClustering ? IPAddress.Loopback : IPAddress.Any;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.Configure<ClusterOptions>(options =>
|
.Configure<ClusterOptions>(options =>
|
||||||
{
|
{
|
||||||
// Configure cluster options with unique identifiers
|
// Configure cluster options with unique identifiers
|
||||||
|
|||||||
Reference in New Issue
Block a user