-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabling use of Sockets with MySQL #547
base: main
Are you sure you want to change the base?
Conversation
This Pull Request has not been updated for more than 1year |
I rebased the PR to the tip of main. The failing checks do not seem to be related to my changes, or am I wrong? |
This Pull Request has not been updated for more than 1year |
I rebased to main and now all check pass :) |
Since this looks easy enough and doesn't break the existing tests for port based mysql, I am going to merge the changes in the container themselves. However, considering that the docker-compose file is mostly just an example here, in which case maybe it should be as a example config in docs. Or, we can add a test case for it, along with a mysql container so we can run it during tests. |
Dear all,
while trying to set up Mailman using Docker, I noticed that using Sockets + MySQL was a no-go.
My setup: Host system has a massive MySQL instance that I want to use in all of my containers. For ease of networking, I map the socket into the containers that require a DB connection. Easy enough.
Usually, there is two ways using sockets can work:
A) replace the hostname with the socket's path, e.g.
mysql://user:pass@/opt/db.sock?parameter=value
(optionally url-encoded to get rid of the slashes) orB) use any hostname (usually 127.0.0.1) and append the parameter
unix_socket=/opt/db.sock
to the query string.Django seems to support option A) and only A, but the MySQL admin tool used for the startup ping check does not support that. To circumvent this, I check the query for
unix_socket
.I created an example Docker config in
docker-compose-mysql-socket.yaml
.Since I believe many others also use this kind of setup and I would love to just use your ready-made containers, I want this upstreamed!