Skip to content

Commit

Permalink
Merge pull request #16 from thangchung/feat/up-aspire82
Browse files Browse the repository at this point in the history
Upgrade aspire to 8.2.1 and add YARP standalone
  • Loading branch information
thangchung authored Sep 30, 2024
2 parents 2468e20 + 661d603 commit de87ce0
Show file tree
Hide file tree
Showing 15 changed files with 417 additions and 328 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<NoWarn>$(NoWarn);NU1507</NoWarn>
<GarbageCollectionAdaptationMode>1</GarbageCollectionAdaptationMode>
</PropertyGroup>
</Project>
156 changes: 81 additions & 75 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,78 +1,84 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<AspnetVersion>8.0.5</AspnetVersion>
<MicrosoftExtensionsVersion>8.4.0</MicrosoftExtensionsVersion>
<EfVersion>8.0.4</EfVersion>
<AspireVersion>8.1.0</AspireVersion>
<OpenTelemetryVersion>1.9.0</OpenTelemetryVersion>
<AspirantVersion>0.0.4</AspirantVersion>
<HealthCheckVersion>8.0.1</HealthCheckVersion>
<AspVersioningVersion>8.1.0</AspVersioningVersion>
<MassTransitVersion>8.2.4</MassTransitVersion>
<MartenVersion>7.10.1</MartenVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.AspNet.WebApi.Core" Version="5.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.6" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="$(AspnetVersion)" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="$(EfVersion)" PrivateAssets="all" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(EfVersion)" />
<PackageVersion Include="Microsoft.OpenApi" Version="1.6.10" />
<PackageVersion Include="Asp.Versioning.Http" Version="$(AspVersioningVersion)" />
<PackageVersion Include="Asp.Versioning.Mvc.ApiExplorer" Version="$(AspVersioningVersion)" />
<PackageVersion Include="Asp.Versioning.Http.Client" Version="$(AspVersioningVersion)" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="MediatR" Version="12.4.0" />
<PackageVersion Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageVersion Include="FluentValidation" Version="11.9.2" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="Riok.Mapperly" Version="3.5.1" ExcludeAssets="runtime" PrivateAssets="all" />
<PackageVersion Include="MassTransit" Version="$(MassTransitVersion)" />
<PackageVersion Include="MassTransit.RabbitMQ" Version="$(MassTransitVersion)" />
<PackageVersion Include="Marten.AspNetCore" Version="$(MartenVersion)" />
<PackageVersion Include="Marten" Version="$(MartenVersion)" />
<PackageVersion Include="Yarp.ReverseProxy" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
<!-- Aspire -->
<PackageVersion Include="Aspire.Hosting" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.AppHost" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.RabbitMQ" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.Redis" Version="$(AspireVersion)" />
<PackageVersion Include="Aspirant.Hosting" Version="$(AspirantVersion)" />
<PackageVersion Include="Aspirant.Hosting.Yarp" Version="$(AspirantVersion)" />
<PackageVersion Include="Aspirant.Hosting.Testing" Version="$(AspirantVersion)" />
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<AspnetVersion>8.0.6</AspnetVersion>
<MicrosoftExtensionsVersion>8.4.0</MicrosoftExtensionsVersion>
<EfVersion>8.0.8</EfVersion>
<AspireVersion>8.2.1</AspireVersion>
<OpenTelemetryVersion>1.9.0</OpenTelemetryVersion>
<AspirantVersion>0.0.4</AspirantVersion>
<HealthCheckVersion>8.0.1</HealthCheckVersion>
<AspVersioningVersion>8.1.0</AspVersioningVersion>
<MassTransitVersion>8.2.4</MassTransitVersion>
<MartenVersion>7.10.1</MartenVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.AspNet.WebApi.Core" Version="5.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(AspnetVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="$(AspnetVersion)" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="$(EfVersion)" PrivateAssets="all" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(EfVersion)" />
<PackageVersion Include="Microsoft.OpenApi" Version="1.6.10" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="MediatR" Version="12.4.0" />
<PackageVersion Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageVersion Include="FluentValidation" Version="11.9.2" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="Riok.Mapperly" Version="3.5.1" ExcludeAssets="runtime" PrivateAssets="all" />
<PackageVersion Include="MassTransit" Version="$(MassTransitVersion)" />
<PackageVersion Include="MassTransit.RabbitMQ" Version="$(MassTransitVersion)" />
<PackageVersion Include="Marten.AspNetCore" Version="$(MartenVersion)" />
<PackageVersion Include="Marten" Version="$(MartenVersion)" />
<PackageVersion Include="Yarp.ReverseProxy" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<!-- Asp Versioning -->
<PackageVersion Include="Asp.Versioning.Http" Version="$(AspVersioningVersion)" />
<PackageVersion Include="Asp.Versioning.Mvc.ApiExplorer" Version="$(AspVersioningVersion)" />
<PackageVersion Include="Asp.Versioning.Http.Client" Version="$(AspVersioningVersion)" />
</ItemGroup>
<ItemGroup>
<!-- Aspire -->
<PackageVersion Include="Aspire.Hosting" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.AppHost" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.RabbitMQ" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.Redis" Version="$(AspireVersion)" />
<PackageVersion Include="Aspirant.Hosting" Version="$(AspirantVersion)" />
<PackageVersion Include="Aspirant.Hosting.Yarp" Version="$(AspirantVersion)" />
<PackageVersion Include="Aspirant.Hosting.Testing" Version="$(AspirantVersion)" />
<PackageVersion Include="WireMock.Net.Aspire" Version="0.0.1-preview-05" />
<!-- Aspire Custom Extensions -->
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="8.7.0" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="$(AspireVersion)" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="$(OpenTelemetryVersion)" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="$(OpenTelemetryVersion)" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="$(OpenTelemetryVersion)" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="$(OpenTelemetryVersion)" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="$(OpenTelemetryVersion)" />
<PackageVersion Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.3.0-beta.2" />
<PackageVersion Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.2.0-beta.4" />
</ItemGroup>
<ItemGroup>
<!-- Healthchecks -->
<PackageVersion Include="AspNetCore.HealthChecks.Uris" Version="$(HealthCheckVersion)" />
<PackageVersion Include="AspNetCore.HealthChecks.NpgSql" Version="$(HealthCheckVersion)" />
<PackageVersion Include="AspNetCore.HealthChecks.Rabbitmq" Version="$(HealthCheckVersion)" />
<PackageVersion Include="AspNetCore.HealthChecks.Redis" Version="$(HealthCheckVersion)" />
</ItemGroup>
<ItemGroup>
<!-- Testing -->
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="xunit" Version="2.5.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageVersion Include="MSTest" Version="3.2.0" />
<PackageVersion Include="ReportGenerator" Version="5.3.6" />
</ItemGroup>
<!-- Aspire Custom Extensions -->
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="8.7.0" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="$(AspireVersion)" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery.Abstractions" Version="$(AspireVersion)" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery.Yarp" Version="$(AspireVersion)" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery.Dns" Version="$(AspireVersion)" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="$(OpenTelemetryVersion)" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="$(OpenTelemetryVersion)" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="$(OpenTelemetryVersion)" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="$(OpenTelemetryVersion)" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="$(OpenTelemetryVersion)" />
<!--<PackageVersion Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.3.0-beta.2" />
<PackageVersion Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.2.0-beta.4" />-->
</ItemGroup>
<ItemGroup>
<!-- Healthchecks -->
<PackageVersion Include="AspNetCore.HealthChecks.Uris" Version="$(HealthCheckVersion)" />
<PackageVersion Include="AspNetCore.HealthChecks.NpgSql" Version="$(HealthCheckVersion)" />
<PackageVersion Include="AspNetCore.HealthChecks.Rabbitmq" Version="$(HealthCheckVersion)" />
<PackageVersion Include="AspNetCore.HealthChecks.Redis" Version="$(HealthCheckVersion)" />
</ItemGroup>
<ItemGroup>
<!-- Testing -->
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="xunit" Version="2.5.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageVersion Include="MSTest" Version="3.2.0" />
<PackageVersion Include="ReportGenerator" Version="5.3.6" />
</ItemGroup>
</Project>
3 changes: 1 addition & 2 deletions app-host/CoffeeShop.AppHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting" />
<PackageReference Include="Aspire.Hosting.AppHost" />
<PackageReference Include="Aspire.Hosting.PostgreSQL" />
<PackageReference Include="Aspire.Hosting.Redis" />
<PackageReference Include="Aspire.Hosting.RabbitMQ" />
<PackageReference Include="Aspirant.Hosting" />
<PackageReference Include="Aspirant.Hosting.Yarp" />
<PackageReference Include="Yarp.ReverseProxy" />
</ItemGroup>

Expand All @@ -32,6 +30,7 @@
<ProjectReference Include="..\counter-api\CoffeeShop.CounterApi.csproj" />
<ProjectReference Include="..\barista-api\CoffeeShop.BaristaApi.csproj" />
<ProjectReference Include="..\kitchen-api\CoffeeShop.KitchenApi.csproj" />
<ProjectReference Include="..\yarp\CoffeeShop.Yarp\CoffeeShop.Yarp.csproj" />
</ItemGroup>

</Project>
38 changes: 18 additions & 20 deletions app-host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,35 @@
var rabbitmq = builder.AddRabbitMQ("rabbitmq").WithHealthCheck().WithManagementPlugin();

var productApi = builder.AddProject<Projects.CoffeeShop_ProductApi>("product-api")
.WithSwaggerUI();
.WithSwaggerUI();

var counterApi = builder.AddProject<Projects.CoffeeShop_CounterApi>("counter-api")
.WithReference(productApi)
.WithReference(rabbitmq)
.WaitFor(rabbitmq)
.WithSwaggerUI();
.WithReference(productApi)
.WithReference(rabbitmq)
.WaitFor(rabbitmq)
.WithSwaggerUI();

builder.AddProject<Projects.CoffeeShop_BaristaApi>("barista-api")
.WithReference(rabbitmq)
.WaitFor(rabbitmq);
.WithReference(rabbitmq)
.WaitFor(rabbitmq);

builder.AddProject<Projects.CoffeeShop_KitchenApi>("kitchen-api")
.WithReference(rabbitmq)
.WaitFor(rabbitmq);
.WithReference(rabbitmq)
.WaitFor(rabbitmq);

var orderSummaryApi = builder.AddProject<Projects.CoffeeShop_OrderSummary>("order-summary")
.WithReference(postgres)
.WithReference(rabbitmq)
.WaitFor(postgres)
.WaitFor(rabbitmq)
.WithSwaggerUI();

var isHttps = builder.Configuration["DOTNET_LAUNCH_PROFILE"] == "https";
var ingressPort = int.TryParse(builder.Configuration["Ingress:Port"], out var port) ? port : (int?)null;
.WithReference(postgres)
.WithReference(rabbitmq)
.WaitFor(postgres)
.WaitFor(rabbitmq)
.WithSwaggerUI();

builder.AddYarp("ingress")
.WithEndpoint(scheme: isHttps ? "https" : "http", port: ingressPort)
builder.AddProject<Projects.CoffeeShop_Yarp>("yarp")
.WithReference(productApi)
.WithReference(counterApi)
.WithReference(orderSummaryApi)
.LoadFromConfiguration("ReverseProxy");
.WaitFor(productApi)
.WaitFor(counterApi)
.WaitFor(orderSummaryApi);

builder.Build().Run();
Loading

0 comments on commit de87ce0

Please sign in to comment.