-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(entrypoint): Delay on auto-install to avoid error before retry #2222
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
max_retries=10 | ||
try=0 | ||
echo "Waiting ($db_wait) for initialization of database to complete (NOTE: if this fails the first time we'll retry again in 10s)..." | ||
sleep $db_wait | ||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] | |
until run_as "php /var/www/html/occ maintenance:install $install_options" 2> /tmp/install_error || [ "$try" -gt "$max_retries" ] |
try=$((try+1)) | ||
sleep 10s | ||
done | ||
if [ "$try" -gt "$max_retries" ]; then | ||
echo "Installing of nextcloud failed!" | ||
echo "Installation of Nextcloud failed!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "Installation of Nextcloud failed!" | |
echo "Installation of Nextcloud failed!" | |
cat /tmp/install_error |
I get the idea ( I contribute rarely here, so maybe don't take into account my comment), but usually adding a sleep somewhere is not the best idea. So I think, what you try to avoid is the scary error. Then, why not hiding it? I did a suggestion, that might work to hide it ( I didn't tested ). Hope it helps :) |
I'm not fully convinced to just add a random You can speed-up MariaDB initialisation with |
The start-up of new MariaDB/MySQL container + creation of the initial user specified via the
MYSQL_*
variables can take about ~4-6s even in a relatively capable/fast environment:MariaDB container startup log with timestamps
When attempting a fully automated Nextcloud installation (i.e. populating a
NEXTCLOUD_*
variables in Compose), this can trigger a failure of the install attempt the first time around. This generates a scary looking error before we retry 10 seconds later:Scary stack trace if database container happens to not be fully initialized yet
Yes, we retry it 10s later and it all works out, but we can avoid this entirely by doing the delay before we even hit the retry cycle.
This PR: