Add LoadBalancer bundle to Elsa.Server
This commit introduces a new bundle for load balancing into the Elsa.Server solution. It includes initial configuration files, launch settings, and reverse proxy setup. The load balancer is configured with a RoundRobin policy and the project references the Yarp.ReverseProxy package.
This commit is contained in:
parent
baeeedc650
commit
a720688bfd
|
|
@ -0,0 +1,13 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Yarp.ReverseProxy"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
1
src/bundles/Elsa.Server.LoadBalancer/FodyWeavers.xml
Normal file
1
src/bundles/Elsa.Server.LoadBalancer/FodyWeavers.xml
Normal file
|
|
@ -0,0 +1 @@
|
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd" />
|
||||
5
src/bundles/Elsa.Server.LoadBalancer/Program.cs
Normal file
5
src/bundles/Elsa.Server.LoadBalancer/Program.cs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddReverseProxy().LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
|
||||
var app = builder.Build();
|
||||
app.MapReverseProxy();
|
||||
app.Run();
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:28212",
|
||||
"sslPort": 44310
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5272",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7036;http://localhost:5272",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/bundles/Elsa.Server.LoadBalancer/appsettings.json
Normal file
29
src/bundles/Elsa.Server.LoadBalancer/appsettings.json
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ReverseProxy": {
|
||||
"Routes": {
|
||||
"route1": {
|
||||
"ClusterId": "cluster1",
|
||||
"Match": {
|
||||
"Path": "{**catch-all}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Clusters": {
|
||||
"cluster1": {
|
||||
"LoadBalancingPolicy": "RoundRobin",
|
||||
"Destinations": {
|
||||
"cluster1/destination1": {
|
||||
"Address": "https://localhost:5001/"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue