mirror of
https://github.com/nextcloud/docker.git
synced 2025-01-27 16:08:25 +01:00
Merge pull request #1905 from remram44/lock
This commit is contained in:
commit
aac4d09c74
11 changed files with 341 additions and 525 deletions
|
@ -99,6 +99,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
} > /usr/local/etc/php/conf.d/redis-session.ini
|
} > /usr/local/etc/php/conf.d/redis-session.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If another process is syncing the html folder, wait for
|
||||||
|
# it to be done, then escape initalization.
|
||||||
|
(
|
||||||
|
if ! flock -n 9; then
|
||||||
|
# If we couldn't get it immediately, show a message, then wait for real
|
||||||
|
echo "Another process is initializing Nextcloud. Waiting..."
|
||||||
|
flock 9
|
||||||
|
fi
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/version.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
|
@ -124,31 +133,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
rsync_options="-rlD"
|
rsync_options="-rlD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If another process is syncing the html folder, wait for
|
|
||||||
# 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" ] && [ -n "${NEXTCLOUD_INIT_LOCK+x}" ]; then
|
|
||||||
until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ]
|
|
||||||
do
|
|
||||||
count=$((count+1))
|
|
||||||
wait=$((count*10))
|
|
||||||
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
|
|
||||||
sleep $wait
|
|
||||||
done
|
|
||||||
if [ "$count" -gt "$limit" ]; then
|
|
||||||
echo "Timeout while waiting for an ongoing initialization"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
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/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
for dir in config data custom_apps themes; do
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
@ -234,17 +219,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialization done, reset lock
|
|
||||||
rm $lock
|
|
||||||
echo "Initializing finished"
|
echo "Initializing finished"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Update htaccess after init if requested
|
# Update htaccess after init if requested
|
||||||
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
||||||
fi
|
fi
|
||||||
|
) 9> /var/www/html/nextcloud-init-sync.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -99,6 +99,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
} > /usr/local/etc/php/conf.d/redis-session.ini
|
} > /usr/local/etc/php/conf.d/redis-session.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If another process is syncing the html folder, wait for
|
||||||
|
# it to be done, then escape initalization.
|
||||||
|
(
|
||||||
|
if ! flock -n 9; then
|
||||||
|
# If we couldn't get it immediately, show a message, then wait for real
|
||||||
|
echo "Another process is initializing Nextcloud. Waiting..."
|
||||||
|
flock 9
|
||||||
|
fi
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/version.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
|
@ -124,31 +133,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
rsync_options="-rlD"
|
rsync_options="-rlD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If another process is syncing the html folder, wait for
|
|
||||||
# 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" ] && [ -n "${NEXTCLOUD_INIT_LOCK+x}" ]; then
|
|
||||||
until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ]
|
|
||||||
do
|
|
||||||
count=$((count+1))
|
|
||||||
wait=$((count*10))
|
|
||||||
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
|
|
||||||
sleep $wait
|
|
||||||
done
|
|
||||||
if [ "$count" -gt "$limit" ]; then
|
|
||||||
echo "Timeout while waiting for an ongoing initialization"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
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/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
for dir in config data custom_apps themes; do
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
@ -234,17 +219,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialization done, reset lock
|
|
||||||
rm $lock
|
|
||||||
echo "Initializing finished"
|
echo "Initializing finished"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Update htaccess after init if requested
|
# Update htaccess after init if requested
|
||||||
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
||||||
fi
|
fi
|
||||||
|
) 9> /var/www/html/nextcloud-init-sync.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -99,6 +99,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
} > /usr/local/etc/php/conf.d/redis-session.ini
|
} > /usr/local/etc/php/conf.d/redis-session.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If another process is syncing the html folder, wait for
|
||||||
|
# it to be done, then escape initalization.
|
||||||
|
(
|
||||||
|
if ! flock -n 9; then
|
||||||
|
# If we couldn't get it immediately, show a message, then wait for real
|
||||||
|
echo "Another process is initializing Nextcloud. Waiting..."
|
||||||
|
flock 9
|
||||||
|
fi
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/version.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
|
@ -124,31 +133,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
rsync_options="-rlD"
|
rsync_options="-rlD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If another process is syncing the html folder, wait for
|
|
||||||
# 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" ] && [ -n "${NEXTCLOUD_INIT_LOCK+x}" ]; then
|
|
||||||
until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ]
|
|
||||||
do
|
|
||||||
count=$((count+1))
|
|
||||||
wait=$((count*10))
|
|
||||||
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
|
|
||||||
sleep $wait
|
|
||||||
done
|
|
||||||
if [ "$count" -gt "$limit" ]; then
|
|
||||||
echo "Timeout while waiting for an ongoing initialization"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
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/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
for dir in config data custom_apps themes; do
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
@ -234,17 +219,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialization done, reset lock
|
|
||||||
rm $lock
|
|
||||||
echo "Initializing finished"
|
echo "Initializing finished"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Update htaccess after init if requested
|
# Update htaccess after init if requested
|
||||||
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
||||||
fi
|
fi
|
||||||
|
) 9> /var/www/html/nextcloud-init-sync.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -99,6 +99,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
} > /usr/local/etc/php/conf.d/redis-session.ini
|
} > /usr/local/etc/php/conf.d/redis-session.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If another process is syncing the html folder, wait for
|
||||||
|
# it to be done, then escape initalization.
|
||||||
|
(
|
||||||
|
if ! flock -n 9; then
|
||||||
|
# If we couldn't get it immediately, show a message, then wait for real
|
||||||
|
echo "Another process is initializing Nextcloud. Waiting..."
|
||||||
|
flock 9
|
||||||
|
fi
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/version.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
|
@ -124,31 +133,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
rsync_options="-rlD"
|
rsync_options="-rlD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If another process is syncing the html folder, wait for
|
|
||||||
# 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" ] && [ -n "${NEXTCLOUD_INIT_LOCK+x}" ]; then
|
|
||||||
until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ]
|
|
||||||
do
|
|
||||||
count=$((count+1))
|
|
||||||
wait=$((count*10))
|
|
||||||
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
|
|
||||||
sleep $wait
|
|
||||||
done
|
|
||||||
if [ "$count" -gt "$limit" ]; then
|
|
||||||
echo "Timeout while waiting for an ongoing initialization"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
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/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
for dir in config data custom_apps themes; do
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
@ -234,17 +219,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialization done, reset lock
|
|
||||||
rm $lock
|
|
||||||
echo "Initializing finished"
|
echo "Initializing finished"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Update htaccess after init if requested
|
# Update htaccess after init if requested
|
||||||
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
||||||
fi
|
fi
|
||||||
|
) 9> /var/www/html/nextcloud-init-sync.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -99,6 +99,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
} > /usr/local/etc/php/conf.d/redis-session.ini
|
} > /usr/local/etc/php/conf.d/redis-session.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If another process is syncing the html folder, wait for
|
||||||
|
# it to be done, then escape initalization.
|
||||||
|
(
|
||||||
|
if ! flock -n 9; then
|
||||||
|
# If we couldn't get it immediately, show a message, then wait for real
|
||||||
|
echo "Another process is initializing Nextcloud. Waiting..."
|
||||||
|
flock 9
|
||||||
|
fi
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/version.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
|
@ -124,31 +133,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
rsync_options="-rlD"
|
rsync_options="-rlD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If another process is syncing the html folder, wait for
|
|
||||||
# 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" ] && [ -n "${NEXTCLOUD_INIT_LOCK+x}" ]; then
|
|
||||||
until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ]
|
|
||||||
do
|
|
||||||
count=$((count+1))
|
|
||||||
wait=$((count*10))
|
|
||||||
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
|
|
||||||
sleep $wait
|
|
||||||
done
|
|
||||||
if [ "$count" -gt "$limit" ]; then
|
|
||||||
echo "Timeout while waiting for an ongoing initialization"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
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/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
for dir in config data custom_apps themes; do
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
@ -234,17 +219,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialization done, reset lock
|
|
||||||
rm $lock
|
|
||||||
echo "Initializing finished"
|
echo "Initializing finished"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Update htaccess after init if requested
|
# Update htaccess after init if requested
|
||||||
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
||||||
fi
|
fi
|
||||||
|
) 9> /var/www/html/nextcloud-init-sync.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -99,6 +99,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
} > /usr/local/etc/php/conf.d/redis-session.ini
|
} > /usr/local/etc/php/conf.d/redis-session.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If another process is syncing the html folder, wait for
|
||||||
|
# it to be done, then escape initalization.
|
||||||
|
(
|
||||||
|
if ! flock -n 9; then
|
||||||
|
# If we couldn't get it immediately, show a message, then wait for real
|
||||||
|
echo "Another process is initializing Nextcloud. Waiting..."
|
||||||
|
flock 9
|
||||||
|
fi
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/version.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
|
@ -124,31 +133,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
rsync_options="-rlD"
|
rsync_options="-rlD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If another process is syncing the html folder, wait for
|
|
||||||
# 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" ] && [ -n "${NEXTCLOUD_INIT_LOCK+x}" ]; then
|
|
||||||
until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ]
|
|
||||||
do
|
|
||||||
count=$((count+1))
|
|
||||||
wait=$((count*10))
|
|
||||||
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
|
|
||||||
sleep $wait
|
|
||||||
done
|
|
||||||
if [ "$count" -gt "$limit" ]; then
|
|
||||||
echo "Timeout while waiting for an ongoing initialization"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
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/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
for dir in config data custom_apps themes; do
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
@ -234,17 +219,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialization done, reset lock
|
|
||||||
rm $lock
|
|
||||||
echo "Initializing finished"
|
echo "Initializing finished"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Update htaccess after init if requested
|
# Update htaccess after init if requested
|
||||||
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
||||||
fi
|
fi
|
||||||
|
) 9> /var/www/html/nextcloud-init-sync.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -99,6 +99,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
} > /usr/local/etc/php/conf.d/redis-session.ini
|
} > /usr/local/etc/php/conf.d/redis-session.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If another process is syncing the html folder, wait for
|
||||||
|
# it to be done, then escape initalization.
|
||||||
|
(
|
||||||
|
if ! flock -n 9; then
|
||||||
|
# If we couldn't get it immediately, show a message, then wait for real
|
||||||
|
echo "Another process is initializing Nextcloud. Waiting..."
|
||||||
|
flock 9
|
||||||
|
fi
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/version.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
|
@ -124,31 +133,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
rsync_options="-rlD"
|
rsync_options="-rlD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If another process is syncing the html folder, wait for
|
|
||||||
# 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" ] && [ -n "${NEXTCLOUD_INIT_LOCK+x}" ]; then
|
|
||||||
until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ]
|
|
||||||
do
|
|
||||||
count=$((count+1))
|
|
||||||
wait=$((count*10))
|
|
||||||
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
|
|
||||||
sleep $wait
|
|
||||||
done
|
|
||||||
if [ "$count" -gt "$limit" ]; then
|
|
||||||
echo "Timeout while waiting for an ongoing initialization"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
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/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
for dir in config data custom_apps themes; do
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
@ -234,17 +219,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialization done, reset lock
|
|
||||||
rm $lock
|
|
||||||
echo "Initializing finished"
|
echo "Initializing finished"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Update htaccess after init if requested
|
# Update htaccess after init if requested
|
||||||
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
||||||
fi
|
fi
|
||||||
|
) 9> /var/www/html/nextcloud-init-sync.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -99,6 +99,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
} > /usr/local/etc/php/conf.d/redis-session.ini
|
} > /usr/local/etc/php/conf.d/redis-session.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If another process is syncing the html folder, wait for
|
||||||
|
# it to be done, then escape initalization.
|
||||||
|
(
|
||||||
|
if ! flock -n 9; then
|
||||||
|
# If we couldn't get it immediately, show a message, then wait for real
|
||||||
|
echo "Another process is initializing Nextcloud. Waiting..."
|
||||||
|
flock 9
|
||||||
|
fi
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/version.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
|
@ -124,31 +133,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
rsync_options="-rlD"
|
rsync_options="-rlD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If another process is syncing the html folder, wait for
|
|
||||||
# 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" ] && [ -n "${NEXTCLOUD_INIT_LOCK+x}" ]; then
|
|
||||||
until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ]
|
|
||||||
do
|
|
||||||
count=$((count+1))
|
|
||||||
wait=$((count*10))
|
|
||||||
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
|
|
||||||
sleep $wait
|
|
||||||
done
|
|
||||||
if [ "$count" -gt "$limit" ]; then
|
|
||||||
echo "Timeout while waiting for an ongoing initialization"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
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/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
for dir in config data custom_apps themes; do
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
@ -234,17 +219,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialization done, reset lock
|
|
||||||
rm $lock
|
|
||||||
echo "Initializing finished"
|
echo "Initializing finished"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Update htaccess after init if requested
|
# Update htaccess after init if requested
|
||||||
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
||||||
fi
|
fi
|
||||||
|
) 9> /var/www/html/nextcloud-init-sync.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -99,6 +99,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
} > /usr/local/etc/php/conf.d/redis-session.ini
|
} > /usr/local/etc/php/conf.d/redis-session.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If another process is syncing the html folder, wait for
|
||||||
|
# it to be done, then escape initalization.
|
||||||
|
(
|
||||||
|
if ! flock -n 9; then
|
||||||
|
# If we couldn't get it immediately, show a message, then wait for real
|
||||||
|
echo "Another process is initializing Nextcloud. Waiting..."
|
||||||
|
flock 9
|
||||||
|
fi
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/version.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
|
@ -124,31 +133,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
rsync_options="-rlD"
|
rsync_options="-rlD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If another process is syncing the html folder, wait for
|
|
||||||
# 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" ] && [ -n "${NEXTCLOUD_INIT_LOCK+x}" ]; then
|
|
||||||
until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ]
|
|
||||||
do
|
|
||||||
count=$((count+1))
|
|
||||||
wait=$((count*10))
|
|
||||||
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
|
|
||||||
sleep $wait
|
|
||||||
done
|
|
||||||
if [ "$count" -gt "$limit" ]; then
|
|
||||||
echo "Timeout while waiting for an ongoing initialization"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
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/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
for dir in config data custom_apps themes; do
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
@ -234,17 +219,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialization done, reset lock
|
|
||||||
rm $lock
|
|
||||||
echo "Initializing finished"
|
echo "Initializing finished"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Update htaccess after init if requested
|
# Update htaccess after init if requested
|
||||||
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
||||||
fi
|
fi
|
||||||
|
) 9> /var/www/html/nextcloud-init-sync.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -139,11 +139,7 @@ The install and update script is only triggered when a default command is used (
|
||||||
|
|
||||||
- `NEXTCLOUD_UPDATE` (default: `0`)
|
- `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
|
You might want to make sure the htaccess is up to date after each container update. Especially on multiple swarm nodes as any discrepancy will make your server unusable.
|
||||||
|
|
||||||
- `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.
|
|
||||||
|
|
||||||
You might also want to make sure the htaccess is up to date after each container update. Especially on multiple swarm nodes as any discrepancy will make your server unusable.
|
|
||||||
|
|
||||||
- `NEXTCLOUD_INIT_HTACCESS` (not set by default) Set it to true to enable run `occ maintenance:update:htaccess` after container initialization.
|
- `NEXTCLOUD_INIT_HTACCESS` (not set by default) Set it to true to enable run `occ maintenance:update:htaccess` after container initialization.
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
} > /usr/local/etc/php/conf.d/redis-session.ini
|
} > /usr/local/etc/php/conf.d/redis-session.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If another process is syncing the html folder, wait for
|
||||||
|
# it to be done, then escape initalization.
|
||||||
|
(
|
||||||
|
if ! flock -n 9; then
|
||||||
|
# If we couldn't get it immediately, show a message, then wait for real
|
||||||
|
echo "Another process is initializing Nextcloud. Waiting..."
|
||||||
|
flock 9
|
||||||
|
fi
|
||||||
|
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/version.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
|
@ -124,31 +133,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
rsync_options="-rlD"
|
rsync_options="-rlD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If another process is syncing the html folder, wait for
|
|
||||||
# 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" ] && [ -n "${NEXTCLOUD_INIT_LOCK+x}" ]; then
|
|
||||||
until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ]
|
|
||||||
do
|
|
||||||
count=$((count+1))
|
|
||||||
wait=$((count*10))
|
|
||||||
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
|
|
||||||
sleep $wait
|
|
||||||
done
|
|
||||||
if [ "$count" -gt "$limit" ]; then
|
|
||||||
echo "Timeout while waiting for an ongoing initialization"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
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/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
for dir in config data custom_apps themes; do
|
for dir in config data custom_apps themes; do
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
@ -234,17 +219,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialization done, reset lock
|
|
||||||
rm $lock
|
|
||||||
echo "Initializing finished"
|
echo "Initializing finished"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Update htaccess after init if requested
|
# Update htaccess after init if requested
|
||||||
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
if [ -n "${NEXTCLOUD_INIT_HTACCESS+x}" ] && [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
run_as 'php /var/www/html/occ maintenance:update:htaccess'
|
||||||
fi
|
fi
|
||||||
|
) 9> /var/www/html/nextcloud-init-sync.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
Loading…
Reference in a new issue