-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from TimeWarpEngineering/Cramer/2024-05-21/As…
…pire Cramer/2024 05 21/aspire
- Loading branch information
Showing
107 changed files
with
1,676 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
TimeWarp.Architecture/Source/ContainerApps/Aspire/Aspire.AppHost/Constants.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace TimeWarp.Architecture.Aspire; | ||
|
||
internal class Constants | ||
{ | ||
public const string CosmosDbResourceName = "cosmos"; | ||
public const string CosmosDbConnectionStringName = CosmosDbResourceName; | ||
public const string CosmosDbDatabaseName = "CosmosDbContext"; | ||
public const string ApiServerProjectResourceName = "api"; | ||
public const string WebServerProjectResourceName = "web"; | ||
public const string GrpcServerProjectResourceName = "grpc"; | ||
public const string YarpProjectResourceName = "yarp"; | ||
public const string YarpResourceName = "ingress"; | ||
} |
1 change: 1 addition & 0 deletions
1
TimeWarp.Architecture/Source/ContainerApps/Aspire/Aspire.AppHost/GlobalUsings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global using static TimeWarp.Architecture.Aspire.Constants; |
38 changes: 31 additions & 7 deletions
38
TimeWarp.Architecture/Source/ContainerApps/Aspire/Aspire.AppHost/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,44 @@ | ||
IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(args); | ||
|
||
IResourceBuilder<ProjectResource> apiServer =builder.AddProject<Projects.Api_Server>("api-server"); | ||
IResourceBuilder<ProjectResource> grpcServer = builder.AddProject<Projects.Grpc_Server>("grpc-server"); | ||
IResourceBuilder<AzureCosmosDBResource> cosmos = builder.AddAzureCosmosDB(CosmosDbResourceName); | ||
IResourceBuilder<AzureCosmosDBResource> cosmosdb = cosmos.AddDatabase(CosmosDbDatabaseName); | ||
#if DEBUG | ||
cosmosdb.RunAsEmulator(); | ||
#endif | ||
IResourceBuilder<ProjectResource> apiServer =builder.AddProject<Projects.Api_Server>(ApiServerProjectResourceName); | ||
IResourceBuilder<ProjectResource> grpcServer = builder.AddProject<Projects.Grpc_Server>(GrpcServerProjectResourceName); | ||
|
||
IResourceBuilder<ProjectResource> webServer = | ||
builder | ||
.AddProject<Projects.Web_Server>("web-server") | ||
.AddProject<Projects.Web_Server>(WebServerProjectResourceName) | ||
.WithExternalHttpEndpoints() | ||
.WithReference(cosmosdb) | ||
.WithReference(apiServer) | ||
.WithReference(grpcServer); | ||
|
||
webServer.WithReference(webServer); | ||
|
||
builder.AddProject<Projects.Yarp>("yarp") | ||
.WithReference(apiServer) | ||
.WithReference(webServer) | ||
.WithReference(grpcServer); | ||
// builder.AddProject<Projects.Yarp>(YarpProjectResourceName) | ||
// .WithReference(apiServer) | ||
// .WithReference(webServer) | ||
// .WithReference(grpcServer); | ||
|
||
// Using Configuration File | ||
// builder.AddYarp(YarpResourceName) | ||
// .WithHttpEndpoint(port: 8001) | ||
// .WithReference(apiServer) | ||
// .WithReference(webServer) | ||
// .WithReference(grpcServer) | ||
// .LoadFromConfiguration("ReverseProxy"); | ||
|
||
// Using Code based routes | ||
builder.AddYarp(YarpResourceName) | ||
.WithHttpEndpoint(port: 8001) | ||
// .WithHttpsEndpoint(port: 8002) | ||
.WithEnvironment("ASPNETCORE_ENVIRONMENT", "Development") | ||
.Route(routeId: "spa", target: webServer, path: "/{**catch-all}") | ||
.Route(routeId: "api-server-api", target: apiServer, path: "/api/{**catch-all}") | ||
.Route(routeId: "web-server-api", target: webServer, path: "/api/web-server/{**catch-all}") | ||
.Route(routeId: "grpc", target: grpcServer, path: "/grpc/{**catch-all}", preservePath:false); | ||
|
||
builder.Build().Run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.