Skip to content

Update Aspire to 8.2 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Reference architecture for using **Event Driven .NET** abstractions and librarie
- [.NET Core SDK](https://dotnet.microsoft.com/download) (8.0 or greater)
- [Docker Desktop](https://www.docker.com/products/docker-desktop)
- MongoDB Docker: `docker run --name mongo -d -p 27017:27017 -v /tmp/mongo/data:/data/db mongo`
- [MongoDB Client](https://studio3t.com/download/):
- Download Studio 3T only.
- [MongoDB Client](https://robomongo.org/):
- Download Studio 3T.
- Add connection to localhost on port 27017.
- [Dapr](https://dapr.io/) (Distributed Application Runtime)
- [Install Dapr CLI](https://docs.dapr.io/getting-started/install-dapr-cli/)
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "8.0.300",
"rollForward": "latestPatch",
"allowPrerelease": true
}
Expand Down
4 changes: 2 additions & 2 deletions reference-architecture/Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

<ItemGroup>
<PackageReference Include="EventDriven.CQRS.Extensions" Version="2.0.0" />
<PackageReference Include="EventDriven.EventBus.Abstractions" Version="1.4.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="EventDriven.EventBus.Abstractions" Version="1.5.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions reference-architecture/CustomerService/CustomerService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="EventDriven.CQRS.Abstractions" Version="2.1.0" />
<PackageReference Include="EventDriven.CQRS.Extensions" Version="2.0.0" />
<PackageReference Include="EventDriven.DependencyInjection.URF.Mongo" Version="1.2.2" />
<PackageReference Include="EventDriven.EventBus.Dapr" Version="1.4.0" />
<PackageReference Include="MongoDB.Driver" Version="2.23.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="URF.Core.Mongo" Version="7.0.0" />
<PackageReference Include="EventDriven.DependencyInjection.URF.Mongo" Version="1.3.0" />
<PackageReference Include="EventDriven.EventBus.Dapr" Version="1.6.0" />
<PackageReference Include="MongoDB.Driver" Version="2.28.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
<PackageReference Include="URF.Core.Mongo" Version="8.2.28" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"CustomerService": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5656",
"applicationUrl": "https://localhost:5656;http://localhost:5657",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"specs": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5656;http://localhost:5657",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Specs"
}
}
}
}
12 changes: 6 additions & 6 deletions reference-architecture/OrderService/OrderService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="EventDriven.CQRS.Abstractions" Version="2.1.0" />
<PackageReference Include="EventDriven.CQRS.Extensions" Version="2.0.0" />
<PackageReference Include="EventDriven.DependencyInjection.URF.Mongo" Version="1.2.2" />
<PackageReference Include="EventDriven.EventBus.Dapr" Version="1.4.0" />
<PackageReference Include="EventDriven.EventBus.EventCache.Mongo" Version="1.4.0" />
<PackageReference Include="MongoDB.Driver" Version="2.23.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="URF.Core.Mongo" Version="7.0.0" />
<PackageReference Include="EventDriven.DependencyInjection.URF.Mongo" Version="1.3.0" />
<PackageReference Include="EventDriven.EventBus.Dapr" Version="1.6.0" />
<PackageReference Include="EventDriven.EventBus.EventCache.Mongo" Version="1.6.0" />
<PackageReference Include="MongoDB.Driver" Version="2.28.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
<PackageReference Include="URF.Core.Mongo" Version="8.2.28" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 12 additions & 2 deletions reference-architecture/OrderService/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"OrderService": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5757",
"applicationUrl": "https://localhost:5757;http://localhost:5758",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"specs": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5757;http://localhost:5758",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Specs"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
var builder = DistributedApplication.CreateBuilder(args);

// TODO: Uncomment if Dapr installed on Mac with Homebrew. See https://github.com/dotnet/aspire-samples/issues/67
// builder.AddDapr(configure => configure.DaprPath = "/opt/homebrew/Cellar/dapr-cli/1.12.0/bin/dapr");

// To set Dapr log level pass dapr options to WithDaprSidecar method instead of string app id
// var customerDaprOptions = new DaprSidecarOptions { AppId = "customer-service", LogLevel = "debug", EnableApiLogging = true };
// var orderDaprOptions = new DaprSidecarOptions { AppId = "order-service", LogLevel = "debug", EnableApiLogging = true };

var pubSub = builder.AddDaprPubSub("pubsub");

builder.AddProject<Projects.CustomerService>("customer-service")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15240",
"applicationUrl": "https://localhost:17098;http://localhost:15138",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16117"
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:16117",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:16118"
}
},
"specs": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15240",
"applicationUrl": "https://localhost:17098;http://localhost:15138",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Specs",
"DOTNET_ENVIRONMENT": "Specs",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16117"
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:16117",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:16118"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting" Version="8.0.0-preview.2.23619.3" />
<PackageReference Include="Aspire.Hosting.Dapr" Version="8.0.0-preview.2.23619.3" />
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.2.0" />
<PackageReference Include="Aspire.Hosting.Dapr" Version="8.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using OpenTelemetry.Logs;
using Microsoft.Extensions.ServiceDiscovery;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;

// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.Hosting;

// Adds common .NET Aspire services: service discovery, resilience, health checks, and OpenTelemetry.
// This project should be referenced by each service project in your solution.
// To learn more about using this project, see https://aka.ms/dotnet/aspire/service-defaults
public static class Extensions
{
public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBuilder builder)
Expand All @@ -26,9 +29,15 @@ public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBu
http.AddStandardResilienceHandler();

// Turn on service discovery by default
http.UseServiceDiscovery();
http.AddServiceDiscovery();
});

// Uncomment the following to restrict the allowed schemes for service discovery.
// builder.Services.Configure<ServiceDiscoveryOptions>(options =>
// {
// options.AllowedSchemes = ["https"];
// });

return builder;
}

Expand All @@ -43,20 +52,16 @@ public static IHostApplicationBuilder ConfigureOpenTelemetry(this IHostApplicati
builder.Services.AddOpenTelemetry()
.WithMetrics(metrics =>
{
metrics.AddRuntimeInstrumentation()
.AddBuiltInMeters();
metrics.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddRuntimeInstrumentation();
})
.WithTracing(tracing =>
{
if (builder.Environment.IsDevelopment())
{
// We want to view all traces in development
tracing.SetSampler(new AlwaysOnSampler());
}

tracing.AddAspNetCoreInstrumentation()
.AddGrpcClientInstrumentation()
.AddHttpClientInstrumentation();
// Uncomment the following line to enable gRPC instrumentation (requires the OpenTelemetry.Instrumentation.GrpcNetClient package)
//.AddGrpcClientInstrumentation()
.AddHttpClientInstrumentation();
});

builder.AddOpenTelemetryExporters();
Expand All @@ -70,18 +75,15 @@ private static IHostApplicationBuilder AddOpenTelemetryExporters(this IHostAppli

if (useOtlpExporter)
{
builder.Services.Configure<OpenTelemetryLoggerOptions>(logging => logging.AddOtlpExporter());
builder.Services.ConfigureOpenTelemetryMeterProvider(metrics => metrics.AddOtlpExporter());
builder.Services.ConfigureOpenTelemetryTracerProvider(tracing => tracing.AddOtlpExporter());
builder.Services.AddOpenTelemetry().UseOtlpExporter();
}

// Uncomment the following lines to enable the Prometheus exporter (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package)
// builder.Services.AddOpenTelemetry()
// .WithMetrics(metrics => metrics.AddPrometheusExporter());

// Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.Exporter package)
// builder.Services.AddOpenTelemetry()
// .UseAzureMonitor();
// Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.AspNetCore package)
//if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
//{
// builder.Services.AddOpenTelemetry()
// .UseAzureMonitor();
//}

return builder;
}
Expand All @@ -97,24 +99,20 @@ public static IHostApplicationBuilder AddDefaultHealthChecks(this IHostApplicati

public static WebApplication MapDefaultEndpoints(this WebApplication app)
{
// Uncomment the following line to enable the Prometheus endpoint (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package)
// app.MapPrometheusScrapingEndpoint();

// All health checks must pass for app to be considered ready to accept traffic after starting
app.MapHealthChecks("/health");

// Only health checks tagged with the "live" tag must pass for app to be considered alive
app.MapHealthChecks("/alive", new HealthCheckOptions
// Adding health checks endpoints to applications in non-development environments has security implications.
// See https://aka.ms/dotnet/aspire/healthchecks for details before enabling these endpoints in non-development environments.
if (app.Environment.IsDevelopment())
{
Predicate = r => r.Tags.Contains("live")
});
// All health checks must pass for app to be considered ready to accept traffic after starting
app.MapHealthChecks("/health");

// Only health checks tagged with the "live" tag must pass for app to be considered alive
app.MapHealthChecks("/alive", new HealthCheckOptions
{
Predicate = r => r.Tags.Contains("live")
});
}

return app;
}

private static MeterProviderBuilder AddBuiltInMeters(this MeterProviderBuilder meterProviderBuilder) =>
meterProviderBuilder.AddMeter(
"Microsoft.AspNetCore.Hosting",
"Microsoft.AspNetCore.Server.Kestrel",
"System.Net.Http");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />

<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="8.0.0-preview.2.23619.3" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.7.0" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.9.1" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="8.2.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.6.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.5.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions test/CustomerService.Tests/CustomerService.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.18.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ public class ReferenceArchSpecsSettings
public Guid OrderPubSub2Id { get; set; }
public string? CustomerServiceBaseAddress { get; set; }
public string? OrderServiceBaseAddress { get; set; }
public bool StartTyeProcess { get; set; }
public TimeSpan TyeProcessTimeout { get; set; }
public TimeSpan AddressUpdateTimeout { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EventDriven.DependencyInjection" Version="1.1.0" />
<PackageReference Include="EventDriven.DependencyInjection.URF.Mongo" Version="1.2.2" />
<PackageReference Include="EventDriven.DependencyInjection" Version="1.2.0" />
<PackageReference Include="EventDriven.DependencyInjection.URF.Mongo" Version="1.3.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.57" />
<PackageReference Include="SpecFlow.xUnit" Version="3.9.74" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="FluentAssertions" Version="6.12.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy