Skip to content

Commit 369226f

Browse files
committed
Revert "#3021" partially
Signed-off-by: Simon L <[email protected]>
1 parent bc4bdfd commit 369226f

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

Containers/nextcloud/config/postgresql.config.php

Lines changed: 0 additions & 7 deletions
This file was deleted.

Containers/nextcloud/entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ php /var/www/html/occ config:system:set overwrite.cli.url --value="https://$NC_D
482482
php /var/www/html/occ config:system:set htaccess.RewriteBase --value="/"
483483
php /var/www/html/occ maintenance:update:htaccess
484484

485+
# Apply dbpersistent setting in order to fix too many db connections
486+
php /var/www/html/occ config:system:set dbpersistent --value=true --type=bool
487+
485488
# Disallow creating local external storages when nothing was mounted
486489
if [ -z "$NEXTCLOUD_MOUNT" ]; then
487490
php /var/www/html/occ config:system:set files_external_allow_create_new_local --type=bool --value=false

Containers/nextcloud/start.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@ while ! sudo -u www-data nc -z "$POSTGRES_HOST" 5432; do
66
sleep 5
77
done
88

9-
# Wait for database to actually start
9+
# Use the correct Postgres username
10+
POSTGRES_USER="oc_$POSTGRES_USER"
11+
export POSTGRES_USER
12+
13+
# Fix false database connection on old instances
1014
if [ -f "/var/www/html/config/config.php" ]; then
1115
sleep 2
1216
while ! sudo -u www-data psql -d "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB" -c "select now()"; do
1317
echo "Waiting for the database to start..."
1418
sleep 5
1519
done
20+
if [ "$POSTGRES_USER" = "oc_nextcloud" ] && [ "$POSTGRES_DB" = "nextcloud_database" ] && echo "$POSTGRES_PASSWORD" | grep -q '^[a-z0-9]\+$'; then
21+
# This was introduced with https://github.com/nextcloud/all-in-one/pull/218
22+
sed -i "s|'dbuser'.*=>.*$|'dbuser' => '$POSTGRES_USER',|" /var/www/html/config/config.php
23+
sed -i "s|'dbpassword'.*=>.*$|'dbpassword' => '$POSTGRES_PASSWORD',|" /var/www/html/config/config.php
24+
sed -i "s|'db_name'.*=>.*$|'db_name' => '$POSTGRES_DB',|" /var/www/html/config/config.php
25+
fi
1626
fi
1727

1828
# Trust additional Cacerts, if the user provided $TRUSTED_CACERTS_DIR

0 commit comments

Comments
 (0)