Hallo,
i have created a repository to optimise development on Mac, using Traefik to handle multiple projects.
I'm not able to make the correct configuration inside traefik and docker-compose file, in order to access to mysql containers from any tool.
This is the issue and the repository on github: https://github.com/zioDocker/DockerDevelopmentOnMac/issues/4
Yes i know that the configuration is missing...
i have tried, looking into the documentation and set up a configuration but i was not able to make it works... so i asked
If I remember correctly, the tcp connection of mysql is not making use of TLS and thus, no SNI. Therefore, you can't use the HostSNI(my-db) matcher like that. You rather have to use it as a wildcard HostSNI(*) and connect to the Traefik Container on Port 3306, as this is the port of your mysql entrypoint.
Thanks u very much for your effort... it works now.....
I was so stupid... after having change the rule... i forgot to expose again the port 3306....
Just one question: is there a way to handle two database connections having the same params?
Technically if u have 2 docker-compose files, with same db containers and same environment variables, in docker they work because they run on two different services.
The problem comes when u try to connect to them using Traefik, because using the same wildcad(*) for both, Traefik has not chance to distinguish them.
i.e. try to use your configuration for two projects...
From what I understand in this case you must have 1 port to 1 database. If you want to access 2 databases, you must have 2 ports (2 entrypoints), each one for a different database.