Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

blizzard4591
Copy link

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) or
B) 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!

@github-actions
Copy link

This Pull Request has not been updated for more than 1year

@blizzard4591
Copy link
Author

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?

Copy link

This Pull Request has not been updated for more than 1year

@blizzard4591
Copy link
Author

I rebased to main and now all check pass :)

@maxking
Copy link
Owner

maxking commented Sep 20, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants