Repository navigation
fix(traefik): Convert Traefik configuration errors to warnings instead of failures - #7967
Conversation
|
Download the artifacts for this pull request:
See Testing a PR. |
9ed58f9 to
b79feda
Compare
|
@copilot the OP here should be done in the format of .github/PULL_REQUEST_TEMPLATE.md. Update the OP to reflect the current status of the PR. Manual testing should include adding a project and doing Also reviewing the updated doc |
Updated the PR description to follow the template format in commit e9b43e1. The description now includes:
The manual testing section includes step-by-step instructions to:
|
- Modified traefik_healthcheck.sh to return success (exit 0) for configuration errors - Added WARNING prefix to error messages to make them warnings - Updated router status display to show warnings even when router is healthy - Users are directed to 'docker logs ddev-router' for detailed error information Co-authored-by: rfay <[email protected]>
e9b43e1 to
270c067
Compare
rfay
left a comment
There was a problem hiding this comment.
I think this might be OK, but it took a lot of effort to get green tests, and it wasn't clear why.
There was a problem hiding this comment.
Awesome improvement, which doesn't break ddev start !
Looks good to me with a small suggestion:
We need to add a link to troubleshooting docs, for example, when I break the ddev-router on Linux, users may not understand what to do with this warning:
# temporary set to 10 (it's reset automatically after reboot)
$ ddev poweroff
$ sudo sysctl -w fs.inotify.max_user_watches=10
$ ddev start
...
Warning: There are router configuration problems:
2025-12-26T20:09:12+02:00 ERR Cannot start the provider *file.Provider error="error adding file watcher: no space left on device"
Successfully started l12
...
# revert back without reboot
$ ddev poweroff
$ sudo sysctl -w fs.inotify.max_user_watches=524288
P.S. I don't know how I ended up with a broken cert from 2024, but this PR helped me realize that I have a problem with an empty default_cert.crt on my end:
$ ddev start
...
Starting ddev-router if necessary...
Container ddev-router Created
Container ddev-router Started
Warning: There are router configuration problems:
2025-12-26T19:41:27+02:00 ERR Error while creating certificate store error="failed to load X509 key pair: tls: failed to find any PEM data in certificate input" tlsStoreName=default
2025-12-26T19:41:27+02:00 ERR Error while creating certificate store error="failed to load X509 key pair: tls: failed to find any PEM data in certificate input" tlsStoreName=default
...
$ ls -la ~/.ddev/traefik/certs
total 12
drwxr-xr-x 2 stas stas 4096 Jun 26 2024 .
drwxr-xr-x 4 stas stas 4096 Jul 10 17:59 ..
-rw-r--r-- 1 stas stas 0 Nov 21 2024 default_cert.crt
-rw------- 1 stas stas 1704 Nov 21 2024 default_key.key
I remember seeing this error a long time ago, and googling it didn't help much. I finally fixed it by rm -r ~/.ddev/traefik.
Co-authored-by: Stanislav Zhuk <[email protected]>
Empty default_cert.crt files were being left in place instead of being regenerated, causing traefik startup errors. Now applies the same pattern from fileutil/embed.go to replace files that are empty or have #ddev-generated. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
|
I fixed that inline and will now (finally) do a PR that standardizes that check. |
Fixes broken merge from PR #7967 conflict. The script now: - Calculates expected router count from config files (yq) - Verifies actual loaded routers match expected count - Uses per_page=10000 to handle >100 routers - Reports mismatches as WARNING but still returns healthy (exit 0) This maintains the philosophy from #7967: detect and report router issues but do not inconvenience users by refusing to run. Generated with Claude Code Co-Authored-By: Claude Opus 4.5 <[email protected]>
Fixes broken merge from PR #7967 conflict. The script now: - Calculates expected router count from config files (yq) - Verifies actual loaded routers match expected count - Uses per_page=10000 to handle >100 routers - Reports mismatches as WARNING but still returns healthy (exit 0) This maintains the philosophy from #7967: detect and report router issues but do not inconvenience users by refusing to run. Generated with Claude Code Co-Authored-By: Claude Opus 4.5 <[email protected]>
The Issue
docker-compose.*.yamlresults in failure starting router "ERR EntryPoint doesn't exist" #7954PR #7442 introduced healthcheck validation that detects Traefik configuration errors and missing file-based routers. While this provides valuable visibility, it causes project startup failures when these errors exist, even though projects previously worked fine with these issues present.
Users reported that after updating DDEV, they couldn't start projects that previously started successfully. The strict healthcheck was failing due to:
docker-compose.*.yamlconfigurations.ddev/traefik/config/*.yamlfilesHow This PR Solves The Issue
This PR converts Traefik configuration errors from failures to warnings, allowing projects to start successfully while still providing visibility into configuration issues.
Changes made:
Modified
containers/ddev-traefik-router/traefik_healthcheck.sh:Added
containers/ddev-traefik-router/monitor-traefik-stderr.sh:/tmp/ddev-traefik-errors.txtfor later retrievalUpdated
containers/ddev-traefik-router/Dockerfile:Enhanced
pkg/ddevapp/router.go:GetRouterConfigErrors()function to read captured error messagesRenderRouterStatus()to display configuration errors even when router is healthyddev listandddev describeoutputUpdated
docs/content/users/extend/traefik-router.md:Updated
pkg/versionconstants/versionconstants.go:Manual Testing Instructions
Test with broken Traefik config:
Create a test project:
Add invalid Traefik configuration with non-existent entrypoint:
Start and verify behavior:
Expected result: Project starts successfully (does not fail)
Check status:
Expected result: Router shows as "OK" with warning message about configuration errors
Expected result: Shows router status with configuration error details
Check logs:
Expected result: Shows Traefik error about non-existent entrypoint
http-81Test normal project without errors:
Remove the broken config:
Expected result: Project starts normally, no warnings displayed
Verify documentation:
Review the updated documentation at
docs/content/users/extend/traefik-router.mdwhich now includes a section on "Warning: There are router configuration problems"Automated Testing Overview
No new automated tests were added as this primarily changes runtime behavior of the container healthcheck script and error reporting. The functionality is best validated through manual integration testing with actual Traefik configurations.
Release/Deployment Notes
Container Image Update: This PR includes changes to
ddev-traefik-routercontainer. A new image has been built and pushed with tag updated inpkg/versionconstants/versionconstants.go.Behavior Changes:
ddev listandddev describeoutput when configuration issues existdocker logs ddev-routerDocumentation: Updated Traefik router documentation to explain the warning messages and how to troubleshoot them.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.