Exit after successful retry
I was playing around with setting up Nextcloud 23.0 using docker-compose on a rather slow virtual machine. This results in MariaDB taking quite a while to be fully setup during the first run. entrypoint.sh properly start the retry logic at https://github.com/nextcloud/docker/blob/master/23/apache/entrypoint.sh#L156-L167. After a while I checked the logs and I saw the following two messages right next to each other:
Nextcloud was successfully installed installing of nextcloud failed!
This was followed by the log message nextcloud exited with code 1 and the installation process being aborted.
Looking at the retry logic it looks flawed. Due to the fact that it runs occ maintenance:install before checking if there are any retries left it
- ends up doing
11instead of10retries (in addition to the initial attempt). - can happen that the final call to
occ maintenance:installsucceeds but the check whether the number of retries was exceeded at https://github.com/nextcloud/docker/blob/master/23/apache/entrypoint.sh#L164-L167 still evaluates totrueresulting in the successful installation being aborted.
IMO https://github.com/nextcloud/docker/blob/master/23/apache/entrypoint.sh#L158 should be changed to
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
to avoid both issues.