Repository navigation
feat: add .NET Aspire AppHost and ServiceDefaults - #1488
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Only register OpenTelemetry when an OTLP endpoint is configured so Application Insights telemetry in production is unchanged - Extract and test the local-migration decision - Test that Vimeo HttpClients opt out of the default resilience handler - Clarify production resilience behavior in the README Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds .NET Aspire 13.6.5 to
mainfor local development.New projects
src/DevBetterWeb.AppHost(Aspire.AppHost.Sdk 13.6.5, net11.0)sql) with a persistent lifetime and data volume, plus theDevBetterWebdatabase (devbetterdb). docker-compose only defines SQL Server, so that's the only dependency modeled.DevBetterWeb.Webruns with theDevBetterWeb.Web - DEVlaunch profile. It gets the database asConnectionStrings:DefaultConnection, waits for the database, has an HTTP health check on/health, and is passedApplyLocalMigrations=true.ASPIRE010is suppressed so it uses the DCP/dashboard NuGet packages, which means it runs without the Aspire CLI installed (CI included).src/DevBetterWeb.ServiceDefaults: adds OpenTelemetry, health checks (/healthand/alive), the standard HTTP resilience handler and service discovery.Web wiring (
Program.cs)AddServiceDefaults()andMapDefaultEndpoints(), replacing the ad-hocAddHealthChecks()/MapHealthChecks("/health")./healthstays mapped in all environments, as before.OTEL_EXPORTER_OTLP_ENDPOINTis set (i.e. under Aspire). Application Insights 3.x is built on OpenTelemetry, so this keeps production telemetry unchanged.writeToProviders), so structured logs show up in the dashboard without duplicate console output. Production logging is unchanged.ApplyLocalMigrationsis true (MigrationServiceExtensions.ShouldApplyLocalMigrations).DomainEventHandler<T>consumed scopedIHandle<T>. In production, those handlers captured scoped services such as the DbContext. Mediator now usesServiceLifetime.Scoped.Resilience
IHttpClientFactoryclient in all environments: timeouts, circuit breaker, and retries for safe methods only (DisableForUnsafeHttpMethods), so payments, webhooks and emails are never retried.VimeoApi,VimeoOEmbed,VimeoTusApi) opt out withRemoveAllResilienceHandlers(), because uploads use 60-minute timeouts.Docs
aspire run/dotnet run --project src/DevBetterWeb.AppHost, the persistent container, where the SQL password is stored, and the telemetry/resilience notes.Tests
tests/DevBetterWeb.AppHost.Tests(Aspire.Hosting.Testing): builds the app model without starting containers, so Docker isn't needed. It asserts:ConnectionStrings__DefaultConnectionandApplyLocalMigrations/healthand/alivereturn200 Healthy.ResilienceHandlerwhile other clients do. Mutation-checked: removing the opt-out fails the test.ShouldApplyLocalMigrationstruth table.Verification
dotnet BuildTestFormat.cs: the build is clean and all tests pass (AppHost 4, Functional 5, Tests 118, Unit 183).dotnet formatstep fails, but it fails the same way onorigin/main(about 11.1k diagnostics in files this PR doesn't touch). The new files in this PR are format-clean. A repo-wide format pass should be a separate follow-up.sql,devbetterdbandweball reported Running/Healthy./health,/aliveand/returned 200..claude/plans/2026-11-15-issue-1484-add-aspire.md.Follow-ups (not in this PR)
DailyCheckServiceandStartupNotificationServiceare production-only singleton hosted services that inject scopedIMediator/IRepository<T>. They should create a scope withIServiceScopeFactory. This captive dependency already existed before this PR.Fixes #1484
🤖 Generated with Claude Code