mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
nextcloud¬ify-push: allow to adjust the DATABASE_TYPE
Signed-off-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
parent
9bf38d2795
commit
4be6d492ea
3 changed files with 23 additions and 6 deletions
|
|
@ -20,6 +20,11 @@ run_upgrade_if_needed_due_to_app_update() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Adjust DATABASE_TYPE to by Nextcloud supported value
|
||||
if [ "$DATABASE_TYPE" = postgres ]; then
|
||||
export DATABASE_TYPE=pgsql
|
||||
fi
|
||||
|
||||
# Only start container if redis is accessible
|
||||
# shellcheck disable=SC2153
|
||||
while ! nc -z "$REDIS_HOST" "6379"; do
|
||||
|
|
@ -237,12 +242,12 @@ if ! [ -f "$NEXTCLOUD_DATA_DIR/skip.update" ]; then
|
|||
);
|
||||
DATADIR_PERMISSION_CONF
|
||||
|
||||
echo "Installing with PostgreSQL database"
|
||||
echo "Installing with $DATABASE_TYPE database"
|
||||
# Set a default value for POSTGRES_PORT
|
||||
if [ -z "$POSTGRES_PORT" ]; then
|
||||
POSTGRES_PORT=5432
|
||||
fi
|
||||
INSTALL_OPTIONS+=(--database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST" --database-port "$POSTGRES_PORT")
|
||||
INSTALL_OPTIONS+=(--database "$DATABASE_TYPE" --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST" --database-port "$POSTGRES_PORT")
|
||||
|
||||
echo "Starting Nextcloud installation..."
|
||||
if ! php /var/www/html/occ maintenance:install "${INSTALL_OPTIONS[@]}"; then
|
||||
|
|
|
|||
|
|
@ -17,6 +17,11 @@ done
|
|||
POSTGRES_USER="oc_$POSTGRES_USER"
|
||||
export POSTGRES_USER
|
||||
|
||||
# Check that db type is not empty
|
||||
if [ -z "$DATABASE_TYPE" ]; then
|
||||
export DATABASE_TYPE=postgres
|
||||
fi
|
||||
|
||||
# Fix false database connection on old instances
|
||||
if [ -f "/var/www/html/config/config.php" ]; then
|
||||
sleep 2
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$NEXTCLOUD_HOST" ]; then
|
||||
echo "NEXTCLOUD_HOST need to be provided. Exiting!"
|
||||
echo "NEXTCLOUD_HOST needs to be provided. Exiting!"
|
||||
exit 1
|
||||
elif [ -z "$POSTGRES_HOST" ]; then
|
||||
echo "POSTGRES_HOST need to be provided. Exiting!"
|
||||
echo "POSTGRES_HOST needs to be provided. Exiting!"
|
||||
exit 1
|
||||
elif [ -z "$REDIS_HOST" ]; then
|
||||
echo "REDIS_HOST need to be provided. Exiting!"
|
||||
echo "REDIS_HOST needs to be provided. Exiting!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -52,9 +52,16 @@ fi
|
|||
if [ -z "$REDIS_DB_INDEX" ]; then
|
||||
REDIS_DB_INDEX=0
|
||||
fi
|
||||
# Set a default for db type
|
||||
if [ -z "$DATABASE_TYPE" ]; then
|
||||
DATABASE_TYPE=postgres
|
||||
elif [ "$DATABASE_TYPE" != postgres ] && [ "$DATABASE_TYPE" != mysql ]; then
|
||||
echo "DB type must be either postgres or mysql"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set sensitive values as env
|
||||
export DATABASE_URL="postgres://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB"
|
||||
export DATABASE_URL="$DATABASE_TYPE://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB"
|
||||
export REDIS_URL="redis://:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX"
|
||||
|
||||
# Run it
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue