Fix orleans local
This commit is contained in:
@@ -97,9 +97,10 @@ public static class ApiBootstrap
|
|||||||
|
|
||||||
return hostBuilder.UseOrleans(siloBuilder =>
|
return hostBuilder.UseOrleans(siloBuilder =>
|
||||||
{
|
{
|
||||||
// Configure clustering with improved networking or use localhost clustering if disabled
|
// Configure clustering - force localhost clustering in development mode
|
||||||
if (!disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString))
|
if (!disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString) && isProduction)
|
||||||
{
|
{
|
||||||
|
// Only use ADO.NET clustering in production
|
||||||
siloBuilder
|
siloBuilder
|
||||||
.UseAdoNetClustering(options =>
|
.UseAdoNetClustering(options =>
|
||||||
{
|
{
|
||||||
@@ -109,12 +110,12 @@ public static class ApiBootstrap
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Fallback to localhost clustering for testing or when database is unavailable
|
// Use localhost clustering for development or when database is unavailable
|
||||||
siloBuilder.UseLocalhostClustering();
|
siloBuilder.UseLocalhostClustering();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Conditionally configure reminder service based on flag
|
// Conditionally configure reminder service based on flag - only in production with ADO.NET clustering
|
||||||
if (runOrleansGrains && !disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString))
|
if (runOrleansGrains && !disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString) && isProduction)
|
||||||
{
|
{
|
||||||
siloBuilder.UseAdoNetReminderService(options =>
|
siloBuilder.UseAdoNetReminderService(options =>
|
||||||
{
|
{
|
||||||
@@ -131,8 +132,17 @@ public static class ApiBootstrap
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Use basic endpoint configuration that works reliably in Docker
|
// Use localhost for development, proper hostname for production
|
||||||
siloBuilder.ConfigureEndpoints(siloPort: 11111, gatewayPort: 30000);
|
if (isProduction)
|
||||||
|
{
|
||||||
|
// In production, use all interfaces
|
||||||
|
siloBuilder.ConfigureEndpoints(IPAddress.Any, 11111, 30000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// In development, use localhost
|
||||||
|
siloBuilder.ConfigureEndpoints(IPAddress.Loopback, 11111, 30000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
siloBuilder
|
siloBuilder
|
||||||
@@ -202,9 +212,10 @@ public static class ApiBootstrap
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure grain storage - use ADO.NET for production or memory for fallback
|
// Configure grain storage - use ADO.NET for production or memory for development/fallback
|
||||||
if (!disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString))
|
if (!disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString) && isProduction)
|
||||||
{
|
{
|
||||||
|
// Use ADO.NET storage in production
|
||||||
siloBuilder
|
siloBuilder
|
||||||
.AddAdoNetGrainStorage("bot-store", options =>
|
.AddAdoNetGrainStorage("bot-store", options =>
|
||||||
{
|
{
|
||||||
@@ -229,7 +240,7 @@ public static class ApiBootstrap
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Fallback to memory storage when database is unavailable
|
// Use memory storage for development or when database is unavailable
|
||||||
siloBuilder
|
siloBuilder
|
||||||
.AddMemoryGrainStorage("bot-store")
|
.AddMemoryGrainStorage("bot-store")
|
||||||
.AddMemoryGrainStorage("registry-store")
|
.AddMemoryGrainStorage("registry-store")
|
||||||
|
|||||||
Reference in New Issue
Block a user