Skip to content

fix: remove nginx proxy router, fixes #5940 - #6739

Merged
rfay merged 13 commits into
ddev:masterfrom
rfay:20241118_rfay_remove_nginx_proxy
Nov 22, 2024
Merged

rfay merged 13 commits into
ddev:masterfrom
rfay:20241118_rfay_remove_nginx_proxy

Conversation

@rfay

@rfay rfay commented Nov 18, 2024

Copy link
Copy Markdown
Member

The Issue

Remove the deprecated nginx proxy router

Manual Testing Instructions

Try setting router to nginx-proxy router
Make sure ordinary things work

@github-actions github-actions Bot added bugfix dependencies Pull requests that update a dependency file labels Nov 18, 2024
@github-actions

github-actions Bot commented Nov 18, 2024 •

Copy link
Copy Markdown

@rfay
rfay marked this pull request as ready for review November 19, 2024 01:20
@rfay
rfay requested review from a team as code owners November 19, 2024 01:20
@rfay
rfay requested a review from stasadev November 19, 2024 01:20

@stasadev stasadev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have containers/ddev-nginx-proxy-router, right?

configGlobalCommand.Flags().String("xdebug-ide-location", "", "For less usual IDE locations specify where the IDE is running for Xdebug to reach it")
configGlobalCommand.Flags().Bool("use-traefik", true, "If true, use Traefik for ddev-router")
_ = configGlobalCommand.Flags().MarkDeprecated("use-traefik", "please use --router instead")
configGlobalCommand.Flags().String("router", globalconfigTypes.RouterTypeTraefik, fmt.Sprintf("Valid router types are %s, default is %s", strings.Join(globalconfigTypes.GetValidRouterTypes(), ", "), globalconfigTypes.RouterTypeDefault))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd better mark the --router flag as deprecated, just like we did for --use-traefik above.
Or make it accept traefik only.

@rfay

rfay commented Nov 19, 2024

Copy link
Copy Markdown
Member Author

We shouldn't have containers/ddev-nginx-proxy-router, right?

I was reluctant to just remove it right away. Do you disagree? It would be reasonable either way. It's obviously there in the source code.

@rfay
rfay force-pushed the 20241118_rfay_remove_nginx_proxy branch from 2a0e7b7 to 5683c16 Compare November 19, 2024 19:25
@stasadev

Copy link
Copy Markdown
Member

I was reluctant to just remove it right away. Do you disagree? It would be reasonable either way. It's obviously there in the source code.

I'm okay with it, just asked if this was intentional to leave it there.

@rfay
rfay force-pushed the 20241118_rfay_remove_nginx_proxy branch from 5683c16 to 609634e Compare November 20, 2024 05:08
@rfay
rfay requested a review from stasadev November 20, 2024 05:36

@stasadev stasadev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I use nginx-proxy with v1.23.5, and then switch to this PR:

$ ddev version
FATA[0000] unable to read global config: invalid router: nginx-proxy, valid router types are [traefik]

I guess we should change nginx-proxy to traefik automatically?

@rfay

rfay commented Nov 20, 2024

Copy link
Copy Markdown
Member Author

I agree.

@rfay
rfay force-pushed the 20241118_rfay_remove_nginx_proxy branch 2 times, most recently from c0f5aa9 to 43b3bb3 Compare November 20, 2024 19:34
Comment thread pkg/globalconfig/global_config.go Outdated
return fmt.Errorf("invalid router: %s, valid router types are %v", DdevGlobalConfig.Router, types.GetValidRouterTypes())
output.UserOut.Printf("\nThe only valid router type is %s, but you have router: %s in your global configuration, using %s instead.\n", types.RouterTypeTraefik, DdevGlobalConfig.Router, types.RouterTypeTraefik)
DdevGlobalConfig.Router = types.RouterTypeTraefik
return nil

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return was added here to show a warning for the user each time, but when I tested it with:

router: nginx-proxy
xdebug_ide_location: "blablabla"

DDEV didn't complain about wrong xdebug_ide_location.

I don't think it's worth skipping all the further validation checks here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks for catching the erroneous return there.

@rfay
rfay force-pushed the 20241118_rfay_remove_nginx_proxy branch from 3c3669a to abd08ec Compare November 22, 2024 14:14
@rfay
rfay force-pushed the 20241118_rfay_remove_nginx_proxy branch from abd08ec to f6c9506 Compare November 22, 2024 14:15
@rfay
rfay requested a review from stasadev November 22, 2024 17:48

@stasadev stasadev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

I tested upgrade/downgrade. DDEV did a great job in all cases.

Regarding the code in containers/ddev-nginx-proxy-router:
We need to keep it because we still use this image for versions 1.23.5 and earlier, and we are required to provide the source code (as requested by Docker-Sponsored Open Source Program). So, until the Docker image is available, we should keep it.

@rfay
rfay merged commit 877f095 into ddev:master Nov 22, 2024
@rfay
rfay deleted the 20241118_rfay_remove_nginx_proxy branch November 22, 2024 22:49
rfay added a commit to rfay/ddev that referenced this pull request Oct 19, 2026
…kip buildkite]

The router no longer mounts a `ddev-router-letsencrypt` volume at `/etc/letsencrypt` or sets `LETSENCRYPT_EMAIL` and `USE_LETSENCRYPT`, because nothing has used them since the nginx-proxy router was removed. Let's Encrypt works as before, through Traefik's `acme.json`.

The volume and the env vars were for Certbot in the old nginx-proxy router. Traefik has always kept its ACME state in `/mnt/ddev-global-cache/traefik/acme.json`, and [ddev#6739](ddev#6739) removed the nginx router but left these in the router compose template. The `use_letsencrypt` help text in the generated `global_config.yaml` still said certificates come "via Certbot".

It removes the mount, the volume definition and the two env vars from the router compose template, along with the template keys that only fed them, and corrects the help text. Existing `ddev-router-letsencrypt` volumes are left in place, which is harmless since they only hold Certbot data that Traefik can't use.

A real certificate needs a host with public DNS, but the ACME path can be checked anywhere against the Let's Encrypt staging server:

```bash
ddev utility download-ddev --pr 8977
export PATH="$HOME/tmp/ddev-download-ddev/pr-8977:$PATH"
ddev poweroff
printf 'certificatesResolvers:\n  acme-tlsChallenge:\n    acme:\n      caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"\n' > ~/.ddev/traefik/static_config.staging.yaml
ddev config global --use-letsencrypt=true
mkdir -p ~/tmp/le-test && cd ~/tmp/le-test && ddev config --project-type=php && ddev start
docker inspect ddev-router --format '{{range .Mounts}}{{.Name}}:{{.Destination}} {{end}}'
docker exec ddev-router stat -c '%a' acme.json
docker logs ddev-router 2>&1 | grep -i acme
rm ~/.ddev/traefik/static_config.staging.yaml && ddev config global --use-letsencrypt=false && ddev delete -Oy le-test
```

🤖 Developed with assistance from [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants