playground/DashboardSeparateHost/README.md
This example demonstrates how to host the Orleans Dashboard in a separate web application that connects to an Orleans cluster as a client.
This approach separates the dashboard web service from your silos.
The example consists of two components:
dotnet run
The application will:
Once running, open your browser to the default ports (typically https://localhost:5001 or http://localhost:5000).
var siloHost = Host.CreateDefaultBuilder(args)
.UseOrleans((_, builder) =>
{
builder.UseDevelopmentClustering(options =>
options.PrimarySiloEndpoint = new IPEndPoint(IPAddress.Loopback, 11111));
builder.ConfigureEndpoints(IPAddress.Loopback, 11111, 30000);
builder.AddDashboard();
// ... other configuration
})
.Build();
var dashboardBuilder = WebApplication.CreateBuilder(args);
// Configure Orleans client
dashboardBuilder.UseOrleansClient(clientBuilder =>
{
clientBuilder.UseStaticClustering(options =>
options.Gateways.Add(new IPEndPoint(IPAddress.Loopback, 30000).ToGatewayUri()));
// Add dashboard services
clientBuilder.AddDashboard();
});
var app = dashboardBuilder.Build();
// Map dashboard endpoints
app.MapOrleansDashboard();
await app.RunAsync();
┌─────────────────┐
│ Silo Host │
│ (Port 11111) │
│ Gateway: 30000 │
└────────▲────────┘
│
│ Orleans Client Connection
│
┌────────┴────────┐
│ Dashboard │
│ Web App │
│ (Port 5000) │
└─────────────────┘
dashboardBuilder.UseOrleansClient(clientBuilder =>
{
clientBuilder.UseStaticClustering(options =>
{
options.Gateways.Add(new IPEndPoint(IPAddress.Parse("10.0.0.1"), 30000).ToGatewayUri());
options.Gateways.Add(new IPEndPoint(IPAddress.Parse("10.0.0.2"), 30000).ToGatewayUri());
});
clientBuilder.AddDashboard();
});
app.MapOrleansDashboard(routePrefix: "/dashboard");
app.MapOrleansDashboard().RequireAuthorization();
[!WARNING] The Orleans Dashboard is designed for development and testing scenarios only. It is not recommended for production deployments as it can have a significant performance impact on your cluster.