Repository navigation
Conversation
## Short Summary (TL;DR) `ddev start` now creates and seeds the `ddev-router-traefik` volume before it creates the project's containers, so the seed runs before web holds `ddev-global-cache`. ## The Issue - For ddev#8895 and ddev#7372 `ensureRouterTraefikVolume` creates `ddev-router-traefik` and copies `ddev-global-cache/traefik` into it, so an existing `acme.json` keeps its Let's Encrypt certificates. It ran only when the router started, which is after web. Web holds `ddev-global-cache` read-write, and Apple `container` then refuses the seed container's read-only attachment. The seed failed, the new volume was removed, and the same happened at every router start. ## How This PR Solves The Issue `start()` calls `ensureRouterTraefikVolume` right after it creates the project's volumes, unless the router is disabled. This is before `start-chown` and before compose creates web. The call in `PushGlobalTraefikConfig` stays for the other paths that start the router. When the volume exists, the call is one `VolumeExists` check. This fixes the first project to start. When another project already runs, its web still holds `ddev-global-cache`, but then the router normally runs too and the volume already exists. ## Manual Testing Instructions ```bash ddev utility download-ddev --pr 9044 export PATH="$HOME/tmp/ddev-download-ddev/pr-9044:$PATH" ddev poweroff docker volume rm ddev-router-traefik mkdir -p ~/tmp/e1 && cd ~/tmp/e1 ddev config --project-type=php ddev start docker volume inspect -f '{{.CreatedAt}}' ddev-router-traefik docker inspect -f '{{.Created}}' ddev-e1-web # Expect the volume to be created before the web container ``` ## Automated Testing Overview New `TestRouterTraefikVolumeSeededBeforeWeb` removes the volume and plants a file in `ddev-global-cache/traefik`. It then starts a project and checks that the router sees the file and that the volume is older than the web container. Without this change it fails on the ordering check. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UrTUMxNNNiQiA9QxsieVTQ
|
Download this PR's build for your OS and architecture with: ddev utility download-ddev --pr 9044Or download the artifact for your OS and architecture directly:
See Testing a PR. |
stasadev
left a comment
There was a problem hiding this comment.
Works for me, with a small note.
Claude Code compared this PR with the latest main build on Docker 29: remove ddev-router-traefik, put a marker in ddev-global-cache/traefik, then ddev start a new project. On main the volume is created 6s after web, with this PR 8s before, and the router sees the marker in both. The new test fails on the ordering check when only the ddevapp.go change is reverted. Apple container wasn't tested.
🤖 Reviewed with assistance from Claude Code
| // Seed the router volume before web holds ddev-global-cache, since some | ||
| // providers refuse to attach a volume another container holds read-write. | ||
| if !IsRouterDisabled(app) { | ||
| if err = ensureRouterTraefikVolume(); err != nil { |
There was a problem hiding this comment.
Optional: this call runs without the ddev-router setup lock that the call in StartDdevRouter has. If two projects start at once while the volume is missing, one can see the volume half-seeded, push its config and start the router, and then the cp -a overwrites that config with the older files from ddev-global-cache. It's a small window, but the lock is cheap:
if !IsRouterDisabled(app) {
unlock := dockerutil.AcquireGlobalLock("ddev-router setup")
err = ensureRouterTraefikVolume()
unlock()
if err != nil {
util.Warning("%v", err)
}
}|
Comment by Claude Code, at @rfay's request. Moving this to draft: it will change completely after #9045. This PR exists because web mounts There's also no need for this code to touch or copy from |
|
Comment by Claude Code, at @rfay's request. Closing this. #9045 stopped web and db from mounting
That leaves one case: on Apple The test's marker check is the only test of seeding |
…nd prune rebase notes, for ddev#7372 [skip ci] ddev#9040 is now upstream, so the branch no longer carries the FindImagesByLabels re-check. Record ddev#9044 as closed unmerged, and drop the sections reviewing past rebases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd prune rebase notes, for ddev#7372 [skip ci] ddev#9040 is now upstream, so the branch no longer carries the FindImagesByLabels re-check. Record ddev#9044 as closed unmerged, and drop the sections reviewing past rebases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd prune rebase notes, for ddev#7372 [skip ci] ddev#9040 is now upstream, so the branch no longer carries the FindImagesByLabels re-check. Record ddev#9044 as closed unmerged, and drop the sections reviewing past rebases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd prune rebase notes, for ddev#7372 [skip ci] ddev#9040 is now upstream, so the branch no longer carries the FindImagesByLabels re-check. Record ddev#9044 as closed unmerged, and drop the sections reviewing past rebases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd prune rebase notes, for ddev#7372 [skip ci] ddev#9040 is now upstream, so the branch no longer carries the FindImagesByLabels re-check. Record ddev#9044 as closed unmerged, and drop the sections reviewing past rebases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd prune rebase notes, for ddev#7372 [skip ci] ddev#9040 is now upstream, so the branch no longer carries the FindImagesByLabels re-check. Record ddev#9044 as closed unmerged, and drop the sections reviewing past rebases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Dependencies: none, but this PR and #9042 both add a test at the end of
pkg/ddevapp/router_test.go. Whichever merges second needs a small rebase.One of seven PRs for #8895, which can be reviewed separately: #9040, #9041, #9042, #9043, #9044, #9045, #9046.
Short Summary (TL;DR)
ddev startnow creates and seeds theddev-router-traefikvolume before it creates the project's containers, so the seed runs before web holdsddev-global-cache.The Issue
ensureRouterTraefikVolumecreatesddev-router-traefikand copiesddev-global-cache/traefikinto it, so an existingacme.jsonkeeps its Let's Encrypt certificates. It ran only when the router started, which is after web. Web holdsddev-global-cacheread-write, and Applecontainerthen refuses the seed container's read-only attachment. The seed failed, the new volume was removed, and the same happened at every router start.How This PR Solves The Issue
start()callsensureRouterTraefikVolumeright after it creates the project's volumes, unless the router is disabled. This is beforestart-chownand before compose creates web. The call inPushGlobalTraefikConfigstays for the other paths that start the router. When the volume exists, the call is oneVolumeExistscheck.This fixes the first project to start. When another project already runs, its web still holds
ddev-global-cache, but then the router normally runs too and the volume already exists.Manual Testing Instructions
Automated Testing Overview
New
TestRouterTraefikVolumeSeededBeforeWebremoves the volume and plants a file inddev-global-cache/traefik. It then starts a project and checks that the router sees the file and that the volume is older than the web container. Without this change it fails on the ordering check.🤖 Developed with assistance from Claude Code
https://claude.ai/code/session_01UrTUMxNNNiQiA9QxsieVTQ
Generated by Claude Code