Im using orleans and running silos in many vm each vm has the image of the server(silo) we develop
all silos joins the cluster but only the first one get the status 3 but all others get status 2 and then 6 when i read logs i figure out that silos are not able to communicate with each other Note(all vms are running on the same network)
this is the server configuration
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Orleans.Configuration;
using System.Net;
using Softylines.OrleansApp.Silo;
try
{
StartSilo(args);
return 0;
}
catch (Exception ex)
{
Console.WriteLine(ex);
return 1;
}
static void StartSilo(string[ ] args)
{
string sqlServerConnectionString = "Server=192.168.30.35;Database=OrleansDb;User Id=sa;Password=Anis2004#;";
var builder = Host.CreateDefaultBuilder()
.UseOrleans((context, silo) =>
{
silo
.UseAdoNetClustering(options =>
{
options.Invariant = "System.Data.SqlClient";
options.ConnectionString = sqlServerConnectionString;
})
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "dev";
options.ServiceId = "aniss";
})
.Configure<EndpointOptions>(options =>
{
options.AdvertisedIPAddress = IPAddress.Parse("192.168.0.232");
options.SiloPort = 11111;
options.GatewayPort = 30000;
options.SiloListeningEndpoint = new IPEndPoint(IPAddress.Any, 11111);
options.GatewayListeningEndpoint = new IPEndPoint(IPAddress.Any, 30000);
})
.ConfigureEndpoints("192.168.0.232", 11111,
30000, listenOnAnyHostAddress: true)
.AddAdoNetGrainStorage(
name: "GrainStore",
configureOptions: options =>
{
options.ConnectionString = sqlServerConnectionString;
})
.UseDashboard(options =>
{
options.Username = "username";
options.Password = "password";
options.Host = "localhost";
options.Port = 9000;
options.HostSelf = true;
options.CounterUpdateIntervalMs = 1000;
})
.ConfigureLogging(logging =>
{
logging
.AddConsole();
});
});
var app = builder.Build();
app.Run();
}
the docker file
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 8080
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["Softylines.OrleansApp.Silo/Softylines.OrleansApp.Silo.csproj", "Softylines.OrleansApp.Silo/"]
COPY ["Softylines.OrleansApp.Grains/Softylines.OrleansApp.Grains.csproj", "Softylines.OrleansApp.Grains/"]
COPY ["Softylines.OrleansApp.Abstractions/Softylines.OrleansApp.Abstractions.csproj", "Softylines.OrleansApp.Abstractions/"]
RUN dotnet restore "Softylines.OrleansApp.Silo/Softylines.OrleansApp.Silo.csproj"
COPY . .
WORKDIR "/src/Softylines.OrleansApp.Silo"
RUN dotnet build "Softylines.OrleansApp.Silo.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Softylines.OrleansApp.Silo.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Softylines.OrleansApp.Silo.dll"]
and this is the compose i use each time in vms
services:
softylines.orleansapp.silo1:
image: kambo
build:
context: .
dockerfile: Softylines.OrleansApp.Silo/Dockerfile
ports:
- 11111:11111
- 30000:30000
the silo register itself on the membership table with the host ip which is hardcoded in each vm