2025-05-31 mariadb - master branch - PR 1 of 2 #804
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.
When I filed
docker-mariadb issue 163 I had hoped for a fairly quick fix.
The problem (for IOTstack) is not so much about the root password not being set on newly-initialised mariadb containers but how mariadb commands react when the root password has not been set.
In particular, the IOTstackBackup routines that handle instances of MariaDB trigger backups like this:
That command will fail if the root password was not set when the persistent store was initialised. Unless the user notices the resulting log message and interprets it correctly, the user will likely assume that database backups are occurring when, in fact, they are not.
This problem affects gitea, nextcloud and wordpress, as well as pure instances of mariadb.
The "solution" proposed here is to leverage the existing
cron
periodic jobs structure inside mariadb containers. Every 15 minutes a script will run to check whether the root password has been set, and set it if it has not been. The body of the script really only runs once per container launch, thereafter sensing it has already run and taking an early exit.This strategy will continue to work once Issue 163 is resolved. It will just become a no-op which can be removed safely at a later date. The approach is also unlikely to interfere with however a fix for Issue 163 is implemented.
The Gitea documentation has been updated to remove the "how to" instructions which only worked for that container-pair, in favour of this solution which will work for all relevant containers.