mirror of
https://github.com/nextcloud/docker.git
synced 2024-11-17 10:41:49 +01:00
Allow simultaneous initialization of common html volume
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
parent
e76b7cab35
commit
35b8ebf954
2 changed files with 104 additions and 81 deletions
|
@ -101,6 +101,24 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
|||
else
|
||||
rsync_options="-rlD"
|
||||
fi
|
||||
|
||||
# If another process is syncing the html folder, wait for
|
||||
# it to be done, then escape initalization
|
||||
lock=/var/www/html/nextcloud-init-sync.lock
|
||||
count=0
|
||||
|
||||
if [ -f "$lock" ]; then
|
||||
until [ ! -f "$lock" ]
|
||||
do
|
||||
count=$((count+1))
|
||||
wait=$((count*10))
|
||||
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
|
||||
sleep $wait
|
||||
done
|
||||
echo "The other process is done, assuming complete initialization"
|
||||
else
|
||||
# Prevent multiple images syncing simultaneously
|
||||
touch $lock
|
||||
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||
|
||||
for dir in config data custom_apps themes; do
|
||||
|
@ -109,9 +127,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
|||
fi
|
||||
done
|
||||
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||
echo "Initializing finished"
|
||||
|
||||
#install
|
||||
# Install
|
||||
if [ "$installed_version" = "0.0.0.0" ]; then
|
||||
echo "New nextcloud instance"
|
||||
|
||||
|
@ -152,21 +169,21 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
|||
fi
|
||||
|
||||
if [ "$install" = true ]; then
|
||||
echo "starting nextcloud installation"
|
||||
echo "Starting nextcloud installation"
|
||||
max_retries=10
|
||||
try=0
|
||||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||
do
|
||||
echo "retrying install..."
|
||||
echo "Retrying install..."
|
||||
try=$((try+1))
|
||||
sleep 10s
|
||||
done
|
||||
if [ "$try" -gt "$max_retries" ]; then
|
||||
echo "installing of nextcloud failed!"
|
||||
echo "Installing of nextcloud failed!"
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
|
||||
echo "setting trusted domains…"
|
||||
echo "Setting trusted domains…"
|
||||
NC_TRUSTED_DOMAIN_IDX=1
|
||||
for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
|
||||
DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
|
@ -175,10 +192,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
|||
done
|
||||
fi
|
||||
else
|
||||
echo "running web-based installer on first connect!"
|
||||
echo "Please run the web-based installer on first connect!"
|
||||
fi
|
||||
fi
|
||||
#upgrade
|
||||
# Upgrade
|
||||
else
|
||||
run_as 'php /var/www/html/occ upgrade'
|
||||
|
||||
|
@ -188,6 +205,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
|||
rm -f /tmp/list_before /tmp/list_after
|
||||
|
||||
fi
|
||||
|
||||
# Initialization done, reset lock
|
||||
rm $lock
|
||||
echo "Initializing finished"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
/custom_apps/
|
||||
/themes/
|
||||
/version.php
|
||||
/nextcloud-init-sync.lock
|
||||
|
|
Loading…
Reference in a new issue