0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2024-11-06 06:14:57 +01:00

fix(entrypoint): Delay on auto-install to avoid error before retry

Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
This commit is contained in:
Josh Richards 2024-05-22 18:16:13 -04:00
parent 7a4823180d
commit 50cefd5557
10 changed files with 80 additions and 30 deletions

View file

@ -202,6 +202,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
file_env POSTGRES_USER file_env POSTGRES_USER
install=false install=false
db_wait='1s'
if [ -n "${SQLITE_DATABASE+x}" ]; then if [ -n "${SQLITE_DATABASE+x}" ]; then
echo "Installing with SQLite database" echo "Installing with SQLite database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -212,27 +213,31 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"' install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
install=true install=true
db_wait='10s'
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
echo "Installing with PostgreSQL database" echo "Installing with PostgreSQL database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"' install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
install=true install=true
db_wait='10s'
fi fi
if [ "$install" = true ]; then if [ "$install" = true ]; then
run_path pre-installation run_path pre-installation
echo "Starting nextcloud installation" echo "Starting Nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
echo "Waiting ($db_wait) for initialization of database to complete (NOTE: if this fails the first time we'll retry again in 10s)..."
sleep $db_wait
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
do do
echo "Retrying install..." echo "Retrying installation..."
try=$((try+1)) try=$((try+1))
sleep 10s sleep 10s
done done
if [ "$try" -gt "$max_retries" ]; then if [ "$try" -gt "$max_retries" ]; then
echo "Installing of nextcloud failed!" echo "Installation of Nextcloud failed!"
exit 1 exit 1
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then

View file

@ -202,6 +202,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
file_env POSTGRES_USER file_env POSTGRES_USER
install=false install=false
db_wait='1s'
if [ -n "${SQLITE_DATABASE+x}" ]; then if [ -n "${SQLITE_DATABASE+x}" ]; then
echo "Installing with SQLite database" echo "Installing with SQLite database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -212,27 +213,31 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"' install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
install=true install=true
db_wait='10s'
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
echo "Installing with PostgreSQL database" echo "Installing with PostgreSQL database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"' install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
install=true install=true
db_wait='10s'
fi fi
if [ "$install" = true ]; then if [ "$install" = true ]; then
run_path pre-installation run_path pre-installation
echo "Starting nextcloud installation" echo "Starting Nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
echo "Waiting ($db_wait) for initialization of database to complete (NOTE: if this fails the first time we'll retry again in 10s)..."
sleep $db_wait
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
do do
echo "Retrying install..." echo "Retrying installation..."
try=$((try+1)) try=$((try+1))
sleep 10s sleep 10s
done done
if [ "$try" -gt "$max_retries" ]; then if [ "$try" -gt "$max_retries" ]; then
echo "Installing of nextcloud failed!" echo "Installation of Nextcloud failed!"
exit 1 exit 1
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then

View file

@ -202,6 +202,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
file_env POSTGRES_USER file_env POSTGRES_USER
install=false install=false
db_wait='1s'
if [ -n "${SQLITE_DATABASE+x}" ]; then if [ -n "${SQLITE_DATABASE+x}" ]; then
echo "Installing with SQLite database" echo "Installing with SQLite database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -212,27 +213,31 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"' install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
install=true install=true
db_wait='10s'
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
echo "Installing with PostgreSQL database" echo "Installing with PostgreSQL database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"' install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
install=true install=true
db_wait='10s'
fi fi
if [ "$install" = true ]; then if [ "$install" = true ]; then
run_path pre-installation run_path pre-installation
echo "Starting nextcloud installation" echo "Starting Nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
echo "Waiting ($db_wait) for initialization of database to complete (NOTE: if this fails the first time we'll retry again in 10s)..."
sleep $db_wait
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
do do
echo "Retrying install..." echo "Retrying installation..."
try=$((try+1)) try=$((try+1))
sleep 10s sleep 10s
done done
if [ "$try" -gt "$max_retries" ]; then if [ "$try" -gt "$max_retries" ]; then
echo "Installing of nextcloud failed!" echo "Installation of Nextcloud failed!"
exit 1 exit 1
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then

View file

@ -202,6 +202,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
file_env POSTGRES_USER file_env POSTGRES_USER
install=false install=false
db_wait='1s'
if [ -n "${SQLITE_DATABASE+x}" ]; then if [ -n "${SQLITE_DATABASE+x}" ]; then
echo "Installing with SQLite database" echo "Installing with SQLite database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -212,27 +213,31 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"' install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
install=true install=true
db_wait='10s'
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
echo "Installing with PostgreSQL database" echo "Installing with PostgreSQL database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"' install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
install=true install=true
db_wait='10s'
fi fi
if [ "$install" = true ]; then if [ "$install" = true ]; then
run_path pre-installation run_path pre-installation
echo "Starting nextcloud installation" echo "Starting Nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
echo "Waiting ($db_wait) for initialization of database to complete (NOTE: if this fails the first time we'll retry again in 10s)..."
sleep $db_wait
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
do do
echo "Retrying install..." echo "Retrying installation..."
try=$((try+1)) try=$((try+1))
sleep 10s sleep 10s
done done
if [ "$try" -gt "$max_retries" ]; then if [ "$try" -gt "$max_retries" ]; then
echo "Installing of nextcloud failed!" echo "Installation of Nextcloud failed!"
exit 1 exit 1
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then

View file

@ -202,6 +202,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
file_env POSTGRES_USER file_env POSTGRES_USER
install=false install=false
db_wait='1s'
if [ -n "${SQLITE_DATABASE+x}" ]; then if [ -n "${SQLITE_DATABASE+x}" ]; then
echo "Installing with SQLite database" echo "Installing with SQLite database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -212,27 +213,31 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"' install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
install=true install=true
db_wait='10s'
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
echo "Installing with PostgreSQL database" echo "Installing with PostgreSQL database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"' install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
install=true install=true
db_wait='10s'
fi fi
if [ "$install" = true ]; then if [ "$install" = true ]; then
run_path pre-installation run_path pre-installation
echo "Starting nextcloud installation" echo "Starting Nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
echo "Waiting ($db_wait) for initialization of database to complete (NOTE: if this fails the first time we'll retry again in 10s)..."
sleep $db_wait
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
do do
echo "Retrying install..." echo "Retrying installation..."
try=$((try+1)) try=$((try+1))
sleep 10s sleep 10s
done done
if [ "$try" -gt "$max_retries" ]; then if [ "$try" -gt "$max_retries" ]; then
echo "Installing of nextcloud failed!" echo "Installation of Nextcloud failed!"
exit 1 exit 1
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then

View file

@ -202,6 +202,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
file_env POSTGRES_USER file_env POSTGRES_USER
install=false install=false
db_wait='1s'
if [ -n "${SQLITE_DATABASE+x}" ]; then if [ -n "${SQLITE_DATABASE+x}" ]; then
echo "Installing with SQLite database" echo "Installing with SQLite database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -212,27 +213,31 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"' install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
install=true install=true
db_wait='10s'
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
echo "Installing with PostgreSQL database" echo "Installing with PostgreSQL database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"' install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
install=true install=true
db_wait='10s'
fi fi
if [ "$install" = true ]; then if [ "$install" = true ]; then
run_path pre-installation run_path pre-installation
echo "Starting nextcloud installation" echo "Starting Nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
echo "Waiting ($db_wait) for initialization of database to complete (NOTE: if this fails the first time we'll retry again in 10s)..."
sleep $db_wait
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
do do
echo "Retrying install..." echo "Retrying installation..."
try=$((try+1)) try=$((try+1))
sleep 10s sleep 10s
done done
if [ "$try" -gt "$max_retries" ]; then if [ "$try" -gt "$max_retries" ]; then
echo "Installing of nextcloud failed!" echo "Installation of Nextcloud failed!"
exit 1 exit 1
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then

View file

@ -202,6 +202,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
file_env POSTGRES_USER file_env POSTGRES_USER
install=false install=false
db_wait='1s'
if [ -n "${SQLITE_DATABASE+x}" ]; then if [ -n "${SQLITE_DATABASE+x}" ]; then
echo "Installing with SQLite database" echo "Installing with SQLite database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -212,27 +213,31 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"' install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
install=true install=true
db_wait='10s'
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
echo "Installing with PostgreSQL database" echo "Installing with PostgreSQL database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"' install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
install=true install=true
db_wait='10s'
fi fi
if [ "$install" = true ]; then if [ "$install" = true ]; then
run_path pre-installation run_path pre-installation
echo "Starting nextcloud installation" echo "Starting Nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
echo "Waiting ($db_wait) for initialization of database to complete (NOTE: if this fails the first time we'll retry again in 10s)..."
sleep $db_wait
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
do do
echo "Retrying install..." echo "Retrying installation..."
try=$((try+1)) try=$((try+1))
sleep 10s sleep 10s
done done
if [ "$try" -gt "$max_retries" ]; then if [ "$try" -gt "$max_retries" ]; then
echo "Installing of nextcloud failed!" echo "Installation of Nextcloud failed!"
exit 1 exit 1
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then

View file

@ -202,6 +202,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
file_env POSTGRES_USER file_env POSTGRES_USER
install=false install=false
db_wait='1s'
if [ -n "${SQLITE_DATABASE+x}" ]; then if [ -n "${SQLITE_DATABASE+x}" ]; then
echo "Installing with SQLite database" echo "Installing with SQLite database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -212,27 +213,31 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"' install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
install=true install=true
db_wait='10s'
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
echo "Installing with PostgreSQL database" echo "Installing with PostgreSQL database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"' install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
install=true install=true
db_wait='10s'
fi fi
if [ "$install" = true ]; then if [ "$install" = true ]; then
run_path pre-installation run_path pre-installation
echo "Starting nextcloud installation" echo "Starting Nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
echo "Waiting ($db_wait) for initialization of database to complete (NOTE: if this fails the first time we'll retry again in 10s)..."
sleep $db_wait
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
do do
echo "Retrying install..." echo "Retrying installation..."
try=$((try+1)) try=$((try+1))
sleep 10s sleep 10s
done done
if [ "$try" -gt "$max_retries" ]; then if [ "$try" -gt "$max_retries" ]; then
echo "Installing of nextcloud failed!" echo "Installation of Nextcloud failed!"
exit 1 exit 1
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then

View file

@ -202,6 +202,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
file_env POSTGRES_USER file_env POSTGRES_USER
install=false install=false
db_wait='1s'
if [ -n "${SQLITE_DATABASE+x}" ]; then if [ -n "${SQLITE_DATABASE+x}" ]; then
echo "Installing with SQLite database" echo "Installing with SQLite database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -212,27 +213,31 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"' install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
install=true install=true
db_wait='10s'
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
echo "Installing with PostgreSQL database" echo "Installing with PostgreSQL database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"' install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
install=true install=true
db_wait='10s'
fi fi
if [ "$install" = true ]; then if [ "$install" = true ]; then
run_path pre-installation run_path pre-installation
echo "Starting nextcloud installation" echo "Starting Nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
echo "Waiting ($db_wait) for initialization of database to complete (NOTE: if this fails the first time we'll retry again in 10s)..."
sleep $db_wait
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
do do
echo "Retrying install..." echo "Retrying installation..."
try=$((try+1)) try=$((try+1))
sleep 10s sleep 10s
done done
if [ "$try" -gt "$max_retries" ]; then if [ "$try" -gt "$max_retries" ]; then
echo "Installing of nextcloud failed!" echo "Installation of Nextcloud failed!"
exit 1 exit 1
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then

View file

@ -202,6 +202,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
file_env POSTGRES_USER file_env POSTGRES_USER
install=false install=false
db_wait='1s'
if [ -n "${SQLITE_DATABASE+x}" ]; then if [ -n "${SQLITE_DATABASE+x}" ]; then
echo "Installing with SQLite database" echo "Installing with SQLite database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -212,27 +213,31 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"' install_options=$install_options' --database mysql --database-name "$MYSQL_DATABASE" --database-user "$MYSQL_USER" --database-pass "$MYSQL_PASSWORD" --database-host "$MYSQL_HOST"'
install=true install=true
db_wait='10s'
elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then elif [ -n "${POSTGRES_DB+x}" ] && [ -n "${POSTGRES_USER+x}" ] && [ -n "${POSTGRES_PASSWORD+x}" ] && [ -n "${POSTGRES_HOST+x}" ]; then
echo "Installing with PostgreSQL database" echo "Installing with PostgreSQL database"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"' install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"'
install=true install=true
db_wait='10s'
fi fi
if [ "$install" = true ]; then if [ "$install" = true ]; then
run_path pre-installation run_path pre-installation
echo "Starting nextcloud installation" echo "Starting Nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
echo "Waiting ($db_wait) for initialization of database to complete (NOTE: if this fails the first time we'll retry again in 10s)..."
sleep $db_wait
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ] until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
do do
echo "Retrying install..." echo "Retrying installation..."
try=$((try+1)) try=$((try+1))
sleep 10s sleep 10s
done done
if [ "$try" -gt "$max_retries" ]; then if [ "$try" -gt "$max_retries" ]; then
echo "Installing of nextcloud failed!" echo "Installation of Nextcloud failed!"
exit 1 exit 1
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then