From 0be52642ecc3607cdcd7c3ad20f38860f38d075e Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 10 Oct 2024 11:08:36 -0400 Subject: [PATCH 1/4] feat(entrypoint): add debug mode for entrypoint Signed-off-by: Josh --- docker-entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8e178f2e..5033d4d0 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,5 +1,9 @@ #!/bin/sh set -eu +if [ -n "${IMAGE_DEBUG+x}" ]; then + echo "**Image debugging enabled**" + set -x +fi # version_greater A B returns whether A > B version_greater() { From fb63647e7e21898fb7f9c8ad2c88ff8ca59b505d Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 16 Oct 2024 10:15:56 -0400 Subject: [PATCH 2/4] feat: optional debugging mode for maintenace:instance + rsync Signed-off-by: Josh --- docker-entrypoint.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 5033d4d0..9fa58bca 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,5 +1,6 @@ #!/bin/sh set -eu + if [ -n "${IMAGE_DEBUG+x}" ]; then echo "**Image debugging enabled**" set -x @@ -169,10 +170,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP echo "Upgrading nextcloud from $installed_version ..." run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before fi + rsync_options='' + if [ -n "${IMAGE_DEBUG+x}" ]; then + rsync_options='-vv' + fi if [ "$(id -u)" = 0 ]; then - rsync_options="-rlDog --chown $user:$group" + rsync_options="$rsync_options -rlDog --chown $user:$group" else - rsync_options="-rlD" + rsync_options="$rsync_options -rlD" fi rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ @@ -192,8 +197,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP install=false if [ -n "${NEXTCLOUD_ADMIN_USER+x}" ] && [ -n "${NEXTCLOUD_ADMIN_PASSWORD+x}" ]; then + install_options='' + if [ -n "${IMAGE_DEBUG+x}" ]; then + install_options='-v ' + fi # shellcheck disable=SC2016 - install_options='-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"' + install_options=$install_options'-n --admin-user "$NEXTCLOUD_ADMIN_USER" --admin-pass "$NEXTCLOUD_ADMIN_PASSWORD"' if [ -n "${NEXTCLOUD_DATA_DIR+x}" ]; then # shellcheck disable=SC2016 install_options=$install_options' --data-dir "$NEXTCLOUD_DATA_DIR"' @@ -231,9 +240,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP try=0 until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options" do - echo "Retrying install..." + echo "Nextcloud installation failed; will retry in 10s..." try=$((try+1)) sleep 10s + echo "Retrying nextcloud install now... ($try of $max_retries attempts)" done if [ "$try" -gt "$max_retries" ]; then echo "Installing of nextcloud failed!" From 7403dcda6b522a1d3d1cf6d186ff3aeb10de6458 Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 16 Oct 2024 10:22:25 -0400 Subject: [PATCH 3/4] docs: Add IMAGE_DEBUG to README Signed-off-by: Josh --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index d8f41dcb..da0a26f4 100644 --- a/README.md +++ b/README.md @@ -631,6 +631,15 @@ docker exec container-name chown -R www-data:root /var/www/html ``` After changing the permissions, restart the container and the permission errors should disappear. + +# Troubleshooting + +The Nextcloud image entrypoint supports a debug (verbose) mode that can be toggled on via an environment variable. This can be used to troubleshoot container start-up, Nextcloud installation, entrypoint changes, etc. + +- `IMAGE_DEBUG=1` + +Note the container log will be highly verbose with this on! + # Help (Questions / Issues) **If you have any questions or problems while using the image, please ask for assistance on the Help Forum first (https://help.nextcloud.com)**. From dd663d60c69954c0b50b68c4d870f9910ddbfab9 Mon Sep 17 00:00:00 2001 From: rugk Date: Fri, 8 Nov 2024 00:38:16 +0100 Subject: [PATCH 4/4] Add example command for copying (#2327) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As for https://github.com/nextcloud/docker/issues/2266 and the re-appearing message IMHO, it is quite convenient to have a command to copy here if you just have not changed any config files… Signed-off-by: rugk --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index ab6608ad..8933161e 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,10 @@ During a fresh Nextcloud installation, the latest version (from the image) of th The copied files, however, are **not** automatically overwritten whenever you update your environment with a newer Nextcloud image. This is to prevent local changes in `/var/www/html/config` from being unexpectedly overwritten. This may lead to your image-specific configuration files becoming outdated and image functionality not matching that which is documented. A warning will be generated in the container log output when outdated image-specific configuration files are detected at startup in a running container. When you see this warning, you should manually compare (or copy) the files from `/usr/src/nextcloud/config` to `/var/www/html/config`. +A command to copy these configs would e.g. be: +```console +docker exec sh -c "cp /usr/src/nextcloud/config/*.php /var/www/html/config" +``` As long as you have not modified any of the provided config files in `/var/www/html/config` (other than `config.php`) or only added new ones with names that do not conflict with the image specific ones, copying the new ones into place should be safe (but check the source path `/usr/src/nextcloud/config` for any newly named config files to avoid new overlaps just in case).