fix: router healthcheck incorrectly warns when all projects stopped, fixes #8081#8082
Conversation
Note that this can't be tested until the ddev-router image is pushed. |
You're correct that The healthcheck counts routers (not config files). Since The fix handles both scenarios:
The original warning "No config files found or no routers expected" was misleading since 0 routers IS expected when all projects are stopped. Commit: 6794270 |
|
@copilot so the complaint from the healthcheck was likely "no routers" rather than "no files". Probably the default_config.yaml was there. But then the question is, why is it so hard to reproduce this? What path gets this complaint from the router? Just starting some projects and then stopping them all results in the correct environment inside the router (only default_config.yaml, no routers) and does not trigger healthcheck problems. |
Correct - the healthcheck complains about "no routers" not "no files". The issue is hard to reproduce because:
The warning only appears if the healthcheck runs during the brief window when all projects are stopped. Once you start any project, My fix correctly treats 0 routers as healthy since that's the expected steady state when all projects are stopped. |
|
@copilot so maybe
|
Good suggestions! However, I think the current fix is the right approach because:
The current fix treats the root cause: the healthcheck's incorrect assumption that 0 routers = error. This is simpler, more maintainable, and semantically correct. Commit: 6794270 |
|
@copilot I agree that your fix is correct. But
|
Done! Implemented all three items:
The new function removes the healthy marker and error file, then runs the healthcheck to ensure router status reflects current state immediately. This provides users with accurate status without waiting for the next 59-second healthcheck cycle. Commit: 358f724 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Download the artifacts for this pull request:
See Testing a PR. |
|
@copilot rewrite the OP in the format required by .github/PULL_REQUEST_TEMPLATE.md |
The IssueWhen all DDEV projects are stopped, the router displays: "WARNING: No config files found or no routers expected". This is a valid healthy state that should not generate warnings. How This PR Solves The Issue1. Fixed healthcheck logic (
2. Added proactive healthcheck clearing (
This ensures router status updates immediately when projects stop, rather than waiting up to 59 seconds for the next periodic healthcheck cycle. Manual Testing Instructions
Automated Testing OverviewChanges are to shell script healthcheck logic and Go code for router management. Testing requires:
The healthcheck shell script was validated with shellcheck. Go code builds successfully and follows existing patterns in the codebase. Release/Deployment Notes
|
|
I don't think we should finish review or pull this until after the release, because we already have pretty good miles on the router as it is, and fiddling with it is not a great idea, especially for something that we can't easily reproduce and that does no harm anyway. |
|
this would be a good candidate for targeting in 1.25.1. the current state of HEAD is good to go for 1.25.0 imho. |
When all DDEV projects are stopped, the router healthcheck was incorrectly showing a warning "No config files found or no routers expected". This is actually a valid healthy state. Changes: - Modified traefik_healthcheck.sh to treat expected_router_count == 0 as a healthy state when there are no errors - Removed the misleading warning message about no config files - Updated health check logic to properly handle the "all projects stopped" case The router will now show "OK" status with location "~/.ddev" without any warnings when all projects are stopped. Co-authored-by: rfay <112444+rfay@users.noreply.github.com>
- Created new ClearRouterHealthcheck() function to force immediate healthcheck - Refactored StartDdevRouter() to use the new function - Added call to ClearRouterHealthcheck() after ddev stop completes This ensures the router status is updated immediately when projects are stopped, providing users with accurate status information without waiting for the next periodic healthcheck cycle. Co-authored-by: rfay <112444+rfay@users.noreply.github.com>
d2b2f7f to
be0b38d
Compare
be0b38d to
7229ae9
Compare
rfay
left a comment
There was a problem hiding this comment.
The router healthcheck had an insistence that the router count be greater than zero, which doesn't make sense now that we leave the router running when there are no projects. This cleans that up and does a bit of rechecking along the way.
This looks good to me. I updated a couple of variable names for clarity and tried to improve comments.
stasadev
left a comment
There was a problem hiding this comment.
Looks good to me, I confirm seeing a warning on v1.25.0, and this PR doesn't have it.
I used this command for testing:
ddev list --continuous|
Brilliant, |
The Issue
When all DDEV projects are stopped, the router displays: "WARNING: No config files found or no routers expected". This is a valid healthy state that should not generate warnings.
How This PR Solves The Issue
1. Fixed healthcheck logic (
traefik_healthcheck.sh):expected_router_count == 0witherror_count == 0as healthyexpected_router_count > 0, causing the zero-router state to trigger warnings2. Added proactive healthcheck clearing (
router.go,stop.go):ClearRouterHealthcheck()function to force immediate healthcheck executionStartDdevRouter()to use the new reusable functionClearRouterHealthcheck()afterddev stopcompletesThis ensures router status updates immediately when projects stop, rather than waiting up to 59 seconds for the next periodic healthcheck cycle.
Manual Testing Instructions
ddev startin each project directoryddev list- verify router shows "OK" status at~/.ddevddev stopin each directoryddev listimmediately - verify router shows "OK" status at~/.ddevWITHOUT the warning messageddev listAutomated Testing Overview
Changes are to shell script healthcheck logic and Go code for router management. Testing requires:
The healthcheck shell script was validated with shellcheck. Go code builds successfully and follows existing patterns in the codebase.
Release/Deployment Notes
ddev-traefik-routercontainer image to be built and published with updated healthcheck scriptOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.