Fix for issue #420, entrypoint has a race condition where installation fails if DB is not ready in time. #1435
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.
The NextCloud installer seems to set a default DB user and password in config.php if the first installation attempt fails (see issue nextcloud/server#41074 ) . This PR gets around that issue by waiting for the DB service to become available before proceeding with installation.
This adds wait-for-it to
/usr/bin
in the dockerfile templates. The script is called in entrypoint.sh right before installation is attempted.A helper function
get_host_string()
is also added to set default ports for MySQL/Postgres if no port is provided in the DB host string.I attempted to implement the
wait_for()
function from wait-for-it into the entrypoint script directly, but ran into various issues (including the use of/bin/sh
by entrypoint.sh instead of/bin/bash
, which complicated things a bit). Calling the script just works without any issues, but that does mean adding another file to the docker image.Not sure if running the update script to update the files in 19/20/21 is required as part of the pull request, so I opted not to.