fix(apphost): pin MongoDB to mongo:7 with mongo-data-v7 volume#346
Conversation
- Add .WithImageTag("7") to prevent MongoDB 8.x AVX/SIGSEGV crash (exit 139)
- Rename volume to mongo-data-v7 to avoid featureCompatibilityVersion 8.2
mismatch crash (exit 62) when reusing an 8.x-initialised volume
- Bump Aspire.AppHost.Sdk from 13.3.2 to 13.3.3 to align with Directory.Packages.props
- Add MongoDbContainerConfigurationTests regression suite (Gimli)
- Update squad history and decisions for boromir, gimli, sam
Closes #345
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🏗️ PR Added to Squad Triage QueueThis PR has been labeled with Next steps:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes local Aspire MongoDB startup failures by pinning the AppHost MongoDB container to MongoDB 7 and moving it to a version-suffixed data volume, with regression coverage and squad process notes.
Changes:
- Pins AppHost MongoDB to
mongo:7andmongo-data-v7. - Aligns the AppHost SDK version with centralized Aspire package versions.
- Adds AppHost regression tests and documents the operational decision/history.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/AppHost/AppHost.cs |
Applies the MongoDB image tag and data volume fix. |
src/AppHost/AppHost.csproj |
Bumps the Aspire AppHost SDK to 13.3.3. |
tests/AppHost.Tests/MongoDbContainerConfigurationTests.cs |
Adds regression coverage for the MongoDB image and volume configuration. |
.squad/decisions.md |
Records the decision and validation for the MongoDB pin/volume rename. |
.squad/agents/sam/history.md |
Adds investigation notes for the Web/MongoDB wiring diagnosis. |
.squad/agents/gimli/history.md |
Adds test coverage work history for the AppHost MongoDB regression tests. |
.squad/agents/boromir/history.md |
Adds infrastructure findings and validation history for the AppHost fix. |
| Pin the MongoDB container image to a stable tag in AppHost.cs: | ||
|
|
||
| ```csharp | ||
| var mongo = builder.AddMongoDB("mongodb") | ||
| .WithImageTag("8.0") // pin away from 8.2 which SIGSEGVs | ||
| .WithDataVolume("mongo-data") |
|
|
||
| ### mongo:8.2 (Aspire.Hosting.MongoDB 13.3.3 default) causes exit 139 (SIGSEGV) | ||
|
|
||
| When diagnosing MongoDB container crashes under Aspire, check the image tag first. Exit code 139 is SIGSEGV — an image-level crash, not an application wiring defect. The fix is to pin the container image with `.WithImageTag("8.0")` in AppHost. Web timeout logs are downstream symptoms of the container crash and should not be mistaken for wiring bugs. |
Test Results Summary479 tests 478 ✅ 26s ⏱️ Results for commit 2c116de. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #346 +/- ##
=======================================
Coverage 80.14% 80.14%
=======================================
Files 68 68
Lines 1682 1682
Branches 201 201
=======================================
Hits 1348 1348
Misses 244 244
Partials 90 90 🚀 New features to boost your workflow:
|
Append Scribe correction superseding the earlier mongo:8.0 guidance with the accepted mongo:7 plus mongo-data-v7 fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
## Summary Closes #348 Working as Boromir (DevOps/Infra) + Sam (Backend) + Gimli (Tester). ## Root Cause After PR #346 (mongo:7 + mongo-data-v7 fix) was merged, MongoDB containers continued crashing in the running environment. Investigation revealed the active Aspire AppHost was built from the **main repo's stale local `dev` branch** — 2 commits behind `origin/dev`, still launching `mongo:8.2` → exit 139 (SIGSEGV/AVX). Identified via: `ps aux | grep AppHost.dll` — DLL path revealed the wrong repo root. ## Changes ### Boromir (DevOps/Infra) - Pulled and rebuilt main repo AppHost (`git pull origin dev` + `dotnet build`) — **0 errors**, MongoDB now uses `mongo:7` + `mongo-data-v7`. - Added rule 6 to `.squad/skills/mongodb-dba-patterns/SKILL.md`: sync main repo before starting Aspire; use `ps aux | grep AppHost.dll` to identify the active build. - Added investigation findings to `boromir/history.md`. ### Sam (Backend) - Full backend audit: `MongoDbBlogPostRepository`, `MongoDbCategoryRepository`, `BlogDbContext`, `Program.cs` — all correct. **No production code change required.** - Added findings to `sam/history.md`. ### Gimli (Tester) - Added `SeedMyBlogData_Makes_Seeded_Posts_Visible_On_The_Blog_Page` integration test to `MongoSeedDataIntegrationTests` — asserts seeded posts are visible via the real AppHost-wired Web/MongoDB path. - Added findings to `gimli/history.md`. ## Validation - `MongoDbContainerConfigurationTests` — 4/4 ✅ - `Web.Tests.Integration` (Testcontainers) — 29/29 ✅ - All pre-push gates passed (markdownlint, build, unit tests, integration tests) ✅ - AppHost.Tests build: 0 errors, 0 warnings ✅ ## Volume State | Volume | Status | |---|---| | `mongo-data` |⚠️ FCV-contaminated (mongo:8.2 data, UUID-format). Do not use with mongo:7. | | `mongo-data-v7` | ✅ Clean, numeric-ident format, lock file 0 bytes. Safe for mongo:7. | --------- Co-authored-by: Boromir <boromir@squad.dev> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Fixes two cascading AppHost/MongoDB container crashes introduced when
Aspire.Hosting.MongoDB13.3.3 defaulted tomongo:8.2.Root causes
mongo:8.2requires AVX CPU instructions; virtualized hosts that don't expose AVX segfault immediatelymongo:7via.WithImageTag("7")mongo-datavolume was initialised bymongo:8.2(featureCompatibilityVersion8.2); MongoDB 7 rejects data files from a newer major versionmongo-data-v7Changes
src/AppHost/AppHost.cs—.WithImageTag("7")+.WithDataVolume("mongo-data-v7")on theAddMongoDBchainsrc/AppHost/AppHost.csproj—Aspire.AppHost.Sdkbumped13.3.2→13.3.3to align withDirectory.Packages.propstests/AppHost.Tests/MongoDbContainerConfigurationTests.cs— new regression suite (4 tests) asserting image tag, volume name, and source-level guardsNo application business logic was changed. No secrets or connection strings are included.
Testing
Review gate
Aragorn: CONDITIONALLY APPROVED — no code changes required, gate clears on AppHost.Tests 0 failures. ✅ Condition satisfied.
Closes #345