Open jbergstroem opened 1 year ago
Findings:
this makes this image deviate from the original mariadb one a bit too much for me
This is what the original does:
$ mariadb -h localhost --protocol tcp -e 'select 1'
If you set up this repo using the PR and remove your environment variables you'd see the same result.
Edit: if you check the original issue about adding this functionality to MariaDB; they are talking about the same thing / what I am trying to do as default: https://github.com/MariaDB/mariadb-docker/issues/94
The cleanest approach to me from a production standpoint is to initialize your container, no longer pass credentials in your compose, then mount a config that contains authentication in a [mariadb-client]
directive. Even with that, what I'm suggesting in this PR would work just fine (no variables are set -> just connect without passing credentials, reading from config instead).
I would add it to the documentation / best practices. That would be a great way to unit test this as well.
What do you think?
Instead of grepping for an existing daemon, we now run a query similar to how
mysqladmin
does it (connects to server/db and runsselect 1
).Todo
docker inspect --format "{{json .State.Health }}"
- I could just lean on similar query / logic)