Replies: 1 comment 1 reply
|
Hi @jerrac - Until a few years ago we mounted the docker sock into the router and used docker notifications to get updates. That unfortunately is a security disaster, because on a normal rootful docker instance it means that the container has full control of docker and thus of anything the docker server has access to on the host (which on rootful docker is a lot). You can find many, many discussions about this on google especially
However, you might be able to make it work with: ~/.ddev/router-compose.docker.yaml (note: no leading dot, must match glob ~/.ddev/traefik/static_config.docker.yaml: I note that the traefik swarm provider is not the same as the docker provider, so you might have different results. Another technique you could use for your particular application is to run a simple docker listener or traefik instance whose only job is to log labels it hears about. |
Uh oh!
There was an error while loading. Please reload this page.
First, the docs make it clear that DDEV generates static file configuration for Traefik, and that the way to modify Traefik configuration is via static files. (Not to mention the utter lack of anyone else asking about this when I searched....) So I get that this request might not fit in very well. But I'm going to try anyway. :)
Before I get into the details of my request, I did try a few different methods of modifying the router config using
~/.ddev/.router-compose.custom.yamland~/.ddev/traefik/static_config.watch_docker.yamlfiles. It feels like it should be possible, but I kept gettingCannot connect to the Docker daemon at unix://< whichever path I tried mounting /var/run/docker.sock at for the current try >. Is the docker daemon runningerrors after applying the config via poweroff and then start. (If this should be possible, let me know and I'll switch to a support request...)On to why I am asking.
I use Traefik in production via the Docker and Docker Swarm providers. Which means there are times I need to test how my labels are applied locally before deploying to production. DDEV, also, is a development tool, and can't represent my production environment.
The specific issue that triggered my attempts to get this work is that I'm modifying how I configure some services that run inside the image I use in production. Since that config is completely outside of DDEV's scope, I am running a custom docker compose that uses labels to tell Traefik how to route to it. This is how I used to do my development before I found DDEV. Those labels would let me visit the website/app I'm working on to confirm my configuration changes work.
Now, I could run another instance of Traefik. But I've done that. And it introduces the need to change which port is in the url every time DDEV needs to change. And that can happen frequently enough that it makes using DDEV frustrating.
I could also copy my Dockerfile settings into my project's .ddev web image, but then I have to remember to update both that file, and my main file. Plus, that would result in an image based on DDEV, which is not what my production image is going to look like.
The TL;DR boils down to DDEV being a development environment that doesn't represent production close enough for certain kinds of configurations to be worked on. Therefore I need a way to route traffic to my non-DDEV service when I'm working on something DDEV can't help with.
Does that all make sense?
For implementation, I'm not familiar with DDEV's internals at all, and therefore have no real clue how it should be implemented.
Thanks for taking the time to read, and maybe consider, this. :)
All reactions