Enabling use of Sockets with MySQL #547
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!