From 83d5e72596ce76bc7adb02be53a8009ccc2fccee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Tue, 31 May 2022 09:39:13 +0200 Subject: [PATCH] Add `NEXTCLOUD_INIT_LOCK` to enable shared html volume update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- README.md | 4 ++++ docker-entrypoint.sh | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bb5b8717..b40349cf 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,10 @@ The install and update script is only triggered when a default command is used ( - `NEXTCLOUD_UPDATE` (default: `0`) +If you share your html folder with multiple docker containers, you might want to avoid multiple processes updating the same shared volume + +- `NEXTCLOUD_INIT_LOCK` (not set by default) Set it to true to enable initialization locking. Other containers will wait for the current process to finish updating the html volume to continue. + If you want to use Redis you have to create a separate [Redis](https://hub.docker.com/_/redis/) container in your setup / in your docker-compose file. To inform Nextcloud about the Redis container, pass in the following parameters: - `REDIS_HOST` (not set by default) Name of Redis container diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 6c8f35f4..309524f6 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -103,12 +103,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # If another process is syncing the html folder, wait for - # it to be done, then escape initalization + # it to be done, then escape initalization. + # You need to define the NEXTCLOUD_INIT_LOCK environment variable lock=/var/www/html/nextcloud-init-sync.lock count=0 limit=10 - if [ -f "$lock" ]; then + if [ -f "$lock" ] && [ -n "${NEXTCLOUD_INIT_LOCK+x}" ]; then until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ] do count=$((count+1))