mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-10 07:47:59 +00:00
Merge pull request #4433 from davidmehren/postgres_port
Add a config option for the postgres database port
This commit is contained in:
commit
de5aeb64d4
5 changed files with 30 additions and 5 deletions
|
|
@ -212,7 +212,11 @@ if ! [ -f "$NEXTCLOUD_DATA_DIR/skip.update" ]; then
|
|||
DATADIR_PERMISSION_CONF
|
||||
|
||||
echo "Installing with PostgreSQL database"
|
||||
INSTALL_OPTIONS+=(--database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST")
|
||||
# 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")
|
||||
|
||||
echo "Starting Nextcloud installation..."
|
||||
if ! php /var/www/html/occ maintenance:install "${INSTALL_OPTIONS[@]}"; then
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
nc -z "$POSTGRES_HOST" 5432 || exit 0
|
||||
# Set a default value for POSTGRES_PORT
|
||||
if [ -z "$POSTGRES_PORT" ]; then
|
||||
POSTGRES_PORT=5432
|
||||
fi
|
||||
|
||||
|
||||
# POSTGRES_HOST must be set in the containers env vars and POSTGRES_PORT has a default above
|
||||
# shellcheck disable=SC2153
|
||||
nc -z "$POSTGRES_HOST" "$POSTGRES_PORT" || exit 0
|
||||
|
||||
if ! nc -z localhost 9000; then
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set a default value for POSTGRES_PORT
|
||||
if [ -z "$POSTGRES_PORT" ]; then
|
||||
POSTGRES_PORT=5432
|
||||
fi
|
||||
|
||||
# Only start container if database is accessible
|
||||
while ! sudo -u www-data nc -z "$POSTGRES_HOST" 5432; do
|
||||
# POSTGRES_HOST must be set in the containers env vars and POSTGRES_PORT has a default above
|
||||
# shellcheck disable=SC2153
|
||||
while ! sudo -u www-data nc -z "$POSTGRES_HOST" "$POSTGRES_PORT"; do
|
||||
echo "Waiting for database to start..."
|
||||
sleep 5
|
||||
done
|
||||
|
|
@ -13,7 +20,7 @@ export POSTGRES_USER
|
|||
# Fix false database connection on old instances
|
||||
if [ -f "/var/www/html/config/config.php" ]; then
|
||||
sleep 2
|
||||
while ! sudo -u www-data psql -d "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB" -c "select now()"; do
|
||||
while ! sudo -u www-data psql -d "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB" -c "select now()"; do
|
||||
echo "Waiting for the database to start..."
|
||||
sleep 5
|
||||
done
|
||||
|
|
|
|||
|
|
@ -44,8 +44,12 @@ fi
|
|||
|
||||
echo "notify-push was started"
|
||||
|
||||
# Set a default value for POSTGRES_PORT
|
||||
if [ -z "$POSTGRES_PORT" ]; then
|
||||
POSTGRES_PORT=5432
|
||||
fi
|
||||
# Set sensitive values as env
|
||||
export DATABASE_URL="postgres://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB"
|
||||
export DATABASE_URL="postgres://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB"
|
||||
export REDIS_URL="redis://:$REDIS_HOST_PASSWORD@$REDIS_HOST"
|
||||
|
||||
# Run it
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@
|
|||
],
|
||||
"environment": [
|
||||
"POSTGRES_HOST=nextcloud-aio-database",
|
||||
"POSTGRES_PORT=5432",
|
||||
"POSTGRES_PASSWORD=%DATABASE_PASSWORD%",
|
||||
"POSTGRES_DB=nextcloud_database",
|
||||
"POSTGRES_USER=nextcloud",
|
||||
|
|
@ -266,6 +267,7 @@
|
|||
"REDIS_HOST=nextcloud-aio-redis",
|
||||
"REDIS_HOST_PASSWORD=%REDIS_PASSWORD%",
|
||||
"POSTGRES_HOST=nextcloud-aio-database",
|
||||
"POSTGRES_PORT=5432",
|
||||
"POSTGRES_PASSWORD=%DATABASE_PASSWORD%",
|
||||
"POSTGRES_DB=nextcloud_database",
|
||||
"POSTGRES_USER=nextcloud"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue