diff --git a/DysonNetwork.Control/AppHost.cs b/DysonNetwork.Control/AppHost.cs index 2aab456..71c40f2 100644 --- a/DysonNetwork.Control/AppHost.cs +++ b/DysonNetwork.Control/AppHost.cs @@ -1,7 +1,12 @@ +using System.Net; +using System.Net.Sockets; using Aspire.Hosting.Yarp.Transforms; +using Microsoft.Extensions.Hosting; var builder = DistributedApplication.CreateBuilder(args); +var isDev = builder.Environment.IsDevelopment(); + // Database was configured separately in each service. // var database = builder.AddPostgres("database"); @@ -9,42 +14,55 @@ var cache = builder.AddRedis("cache"); var queue = builder.AddNats("queue").WithJetStream(); var ringService = builder.AddProject("ring") - .WithReference(queue) - .WithHttpHealthCheck() - .WithEndpoint(5001, 5001, "https", name: "grpc"); + .WithReference(queue); var passService = builder.AddProject("pass") .WithReference(cache) .WithReference(queue) - .WithReference(ringService) - .WithHttpHealthCheck() - .WithEndpoint(5001, 5001, "https", name: "grpc"); + .WithReference(ringService); var driveService = builder.AddProject("drive") .WithReference(cache) .WithReference(queue) .WithReference(passService) - .WithReference(ringService) - .WithHttpHealthCheck() - .WithEndpoint(5001, 5001, "https", name: "grpc"); + .WithReference(ringService); var sphereService = builder.AddProject("sphere") .WithReference(cache) .WithReference(queue) .WithReference(passService) .WithReference(ringService) - .WithReference(driveService) - .WithHttpHealthCheck() - .WithEndpoint(5001, 5001, "https", name: "grpc"); + .WithReference(driveService); var developService = builder.AddProject("develop") .WithReference(cache) .WithReference(passService) - .WithReference(ringService) - .WithHttpHealthCheck() - .WithEndpoint(5001, 5001, "https", name: "grpc"); + .WithReference(ringService); + +List> services = + [ringService, passService, driveService, sphereService, developService]; + +for (var idx = 0; idx < services.Count; idx++) +{ + var service = services[idx]; + var grpcPort = 7002 + idx; + + if (isDev) + { + service.WithEnvironment("GRPC_PORT", grpcPort.ToString()); + + var httpPort = 8001 + idx; + service.WithEnvironment("HTTP_PORTS", httpPort.ToString()); + service.WithHttpEndpoint(httpPort, targetPort: null, isProxied: false, name: "http"); + } + else + { + service.WithHttpEndpoint(8080, targetPort: null, isProxied: false, name: "http"); + } + + service.WithEndpoint(isDev ? grpcPort : 7001, isDev ? null : 7001, "https", name: "grpc", isProxied: false); +} // Extra double-ended references ringService.WithReference(passService); builder.AddYarp("gateway") - .WithHostPort(5000) .WithConfiguration(yarp => { var ringCluster = yarp.AddCluster(ringService.GetEndpoint("http")); @@ -75,4 +93,4 @@ builder.AddYarp("gateway") builder.AddDockerComposeEnvironment("docker-compose"); -builder.Build().Run(); +builder.Build().Run(); \ No newline at end of file diff --git a/DysonNetwork.Develop/Properties/launchSettings.json b/DysonNetwork.Develop/Properties/launchSettings.json index 32476e3..7d13ff2 100644 --- a/DysonNetwork.Develop/Properties/launchSettings.json +++ b/DysonNetwork.Develop/Properties/launchSettings.json @@ -5,7 +5,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "http://localhost:5156", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -14,7 +13,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "https://localhost:7192;http://localhost:5156", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/DysonNetwork.Drive/Properties/launchSettings.json b/DysonNetwork.Drive/Properties/launchSettings.json index d4fe22b..7d13ff2 100644 --- a/DysonNetwork.Drive/Properties/launchSettings.json +++ b/DysonNetwork.Drive/Properties/launchSettings.json @@ -5,7 +5,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "http://localhost:5090", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -14,7 +13,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "https://localhost:7092;http://localhost:5090", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/DysonNetwork.Pass/Properties/launchSettings.json b/DysonNetwork.Pass/Properties/launchSettings.json index 23c7313..7d13ff2 100644 --- a/DysonNetwork.Pass/Properties/launchSettings.json +++ b/DysonNetwork.Pass/Properties/launchSettings.json @@ -5,7 +5,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "http://localhost:5216", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -14,7 +13,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "https://localhost:7058;http://localhost:5216", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/DysonNetwork.Ring/DysonNetwork.Ring.csproj b/DysonNetwork.Ring/DysonNetwork.Ring.csproj index dc52c8e..09a50ce 100644 --- a/DysonNetwork.Ring/DysonNetwork.Ring.csproj +++ b/DysonNetwork.Ring/DysonNetwork.Ring.csproj @@ -5,7 +5,7 @@ enable enable Linux - DysonNetwork.Pusher + DysonNetwork.Ring diff --git a/DysonNetwork.Ring/Properties/launchSettings.json b/DysonNetwork.Ring/Properties/launchSettings.json index 982a366..7d13ff2 100644 --- a/DysonNetwork.Ring/Properties/launchSettings.json +++ b/DysonNetwork.Ring/Properties/launchSettings.json @@ -5,7 +5,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "http://localhost:5212", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -14,7 +13,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "https://localhost:7259;http://localhost:5212", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/DysonNetwork.Shared/Http/KestrelConfiguration.cs b/DysonNetwork.Shared/Http/KestrelConfiguration.cs index 3dfaa93..ccc62d0 100644 --- a/DysonNetwork.Shared/Http/KestrelConfiguration.cs +++ b/DysonNetwork.Shared/Http/KestrelConfiguration.cs @@ -16,7 +16,6 @@ public static class KestrelConfiguration long maxRequestBodySize = 50 * 1024 * 1024 ) { - builder.Host.UseContentRoot(Directory.GetCurrentDirectory()); builder.WebHost.ConfigureKestrel(options => { options.Limits.MaxRequestBodySize = maxRequestBodySize; @@ -31,7 +30,7 @@ public static class KestrelConfiguration listenOptions.UseHttps(selfSignedCert); }); - var httpPorts = configuration.GetValue("HTTP_PORTS", "5000") + var httpPorts = configuration.GetValue("HTTP_PORTS", "6000") .Split(',', StringSplitOptions.RemoveEmptyEntries) .Select(p => int.Parse(p.Trim())) .ToArray(); diff --git a/DysonNetwork.Sphere/Properties/launchSettings.json b/DysonNetwork.Sphere/Properties/launchSettings.json index a6ab6aa..7d13ff2 100644 --- a/DysonNetwork.Sphere/Properties/launchSettings.json +++ b/DysonNetwork.Sphere/Properties/launchSettings.json @@ -5,7 +5,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "http://localhost:5071", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -14,7 +13,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "https://localhost:7099;http://localhost:5071", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/DysonNetwork.sln.DotSettings.user b/DysonNetwork.sln.DotSettings.user index 72dd347..fbceea4 100644 --- a/DysonNetwork.sln.DotSettings.user +++ b/DysonNetwork.sln.DotSettings.user @@ -32,6 +32,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded