From 1ed7196de60b9114df193d4b8c3fbf05b2156e99 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Fri, 9 Jan 2026 15:18:43 +0100 Subject: [PATCH 1/2] redis.config.php: allow to configure redis.cluster Signed-off-by: Simon L. --- Containers/nextcloud/config/redis.config.php | 30 ++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Containers/nextcloud/config/redis.config.php b/Containers/nextcloud/config/redis.config.php index b59fe4ea..40ed860d 100644 --- a/Containers/nextcloud/config/redis.config.php +++ b/Containers/nextcloud/config/redis.config.php @@ -1,5 +1,5 @@ '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', @@ -17,7 +17,33 @@ if (getenv('REDIS_HOST')) { $CONFIG['redis']['dbindex'] = (int) getenv('REDIS_DB_INDEX'); } - if (getenv('REDIS_USER_AUTH') !== false) { + if (getenv('REDIS_USER_AUTH')) { $CONFIG['redis']['user'] = str_replace("&auth[]=", "", getenv('REDIS_USER_AUTH')); } +} else { + $CONFIG = array( + 'memcache.distributed' => '\OC\Memcache\Redis', + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis.cluster' => array( + 'password' => (string) getenv('REDIS_HOST_PASSWORD'), + 'timeout' => 0.0, + 'read_timeout' => 0.0, + 'failover_mode' => \RedisCluster::FAILOVER_ERROR, + 'seeds' => array_values(array_filter(array( + (getenv('REDIS_HOST') && getenv('REDIS_PORT')) ? (getenv('REDIS_HOST') . ':' . (string)getenv('REDIS_PORT')) : null, + (getenv('REDIS_HOST_2') && getenv('REDIS_PORT_2')) ? (getenv('REDIS_HOST_2') . ':' . (string)getenv('REDIS_PORT_2')) : null, + (getenv('REDIS_HOST_3') && getenv('REDIS_PORT_3')) ? (getenv('REDIS_HOST_3') . ':' . (string)getenv('REDIS_PORT_3')) : null, + (getenv('REDIS_HOST_4') && getenv('REDIS_PORT_4')) ? (getenv('REDIS_HOST_4') . ':' . (string)getenv('REDIS_PORT_4')) : null, + (getenv('REDIS_HOST_5') && getenv('REDIS_PORT_5')) ? (getenv('REDIS_HOST_5') . ':' . (string)getenv('REDIS_PORT_5')) : null, + (getenv('REDIS_HOST_6') && getenv('REDIS_PORT_6')) ? (getenv('REDIS_HOST_6') . ':' . (string)getenv('REDIS_PORT_6')) : null, + (getenv('REDIS_HOST_7') && getenv('REDIS_PORT_7')) ? (getenv('REDIS_HOST_7') . ':' . (string)getenv('REDIS_PORT_7')) : null, + (getenv('REDIS_HOST_8') && getenv('REDIS_PORT_8')) ? (getenv('REDIS_HOST_8') . ':' . (string)getenv('REDIS_PORT_8')) : null, + (getenv('REDIS_HOST_9') && getenv('REDIS_PORT_9')) ? (getenv('REDIS_HOST_9') . ':' . (string)getenv('REDIS_PORT_9')) : null, + ))), + ), + ); + + if (getenv('REDIS_USER_AUTH')) { + $CONFIG['redis.cluster']['user'] = str_replace("&auth[]=", "", getenv('REDIS_USER_AUTH')); + } } From 63bb5845dea91a7f41fb5ea821548065beccb0ff Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Thu, 15 Jan 2026 17:37:54 +0100 Subject: [PATCH 2/2] notify-push: refactor to use Nextcloud's config.php directly Signed-off-by: Simon L. --- Containers/notify-push/start.sh | 57 +++------------------------------ php/containers.json | 13 ++------ 2 files changed, 6 insertions(+), 64 deletions(-) diff --git a/Containers/notify-push/start.sh b/Containers/notify-push/start.sh index 26d74333..f4986ce6 100644 --- a/Containers/notify-push/start.sh +++ b/Containers/notify-push/start.sh @@ -3,12 +3,6 @@ if [ -z "$NEXTCLOUD_HOST" ]; then echo "NEXTCLOUD_HOST needs to be provided. Exiting!" exit 1 -elif [ -z "$POSTGRES_HOST" ]; then - echo "POSTGRES_HOST needs to be provided. Exiting!" - exit 1 -elif [ -z "$REDIS_HOST" ]; then - echo "REDIS_HOST needs to be provided. Exiting!" - exit 1 fi # Only start container if nextcloud is accessible @@ -28,7 +22,7 @@ elif [ "$CPU_ARCH" != "x86_64" ]; then fi # Add warning -if ! [ -f /nextcloud/custom_apps/notify_push/bin/"$CPU_ARCH"/notify_push ]; then +if ! [ -f /var/www/html/custom_apps/notify_push/bin/"$CPU_ARCH"/notify_push ]; then echo "The notify_push binary was not found." echo "Most likely is DNS resolution not working correctly." echo "You can try to fix this by configuring a DNS server globally in dockers daemon.json." @@ -44,52 +38,9 @@ fi echo "notify-push was started" -# Set a default value for POSTGRES_PORT -if [ -z "$POSTGRES_PORT" ]; then - POSTGRES_PORT=5432 -fi -# Set a default for redis db index -if [ -z "$REDIS_DB_INDEX" ]; then - REDIS_DB_INDEX=0 -fi -# Set a default value for REDIS_PORT -if [ -z "$REDIS_PORT" ]; then - REDIS_PORT=6379 -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 - -# Use the correct Postgres username -if [ "$POSTGRES_USER" = nextcloud ]; then - POSTGRES_USER="oc_$POSTGRES_USER" - export POSTGRES_USER -fi - -# URL-encode passwords -POSTGRES_PASSWORD="$(jq -rn --arg v "$POSTGRES_PASSWORD" '$v|@uri')" -REDIS_HOST_PASSWORD="$(jq -rn --arg v "$REDIS_HOST_PASSWORD" '$v|@uri')" - -# Postgres root cert -if [ -f "/nextcloud/data/certificates/POSTGRES" ]; then - CERT_OPTIONS="?sslmode=verify-ca&sslrootcert=/nextcloud/data/certificates/ca-bundle.crt" -# Mysql root cert -elif [ -f "/nextcloud/data/certificates/MYSQL" ]; then - CERT_OPTIONS="?sslmode=verify-ca&ssl-ca=/nextcloud/data/certificates/ca-bundle.crt" -fi - -# Set sensitive values as env -export DATABASE_URL="$DATABASE_TYPE://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB$CERT_OPTIONS" -export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST:$REDIS_PORT/$REDIS_DB_INDEX" - # Run it -/nextcloud/custom_apps/notify_push/bin/"$CPU_ARCH"/notify_push \ - --database-prefix="oc_" \ - --nextcloud-url "https://$NC_DOMAIN" \ - --port 7867 +/var/www/html/custom_apps/notify_push/bin/"$CPU_ARCH"/notify_push \ + --port 7867 \ + /var/www/html/config/config.php exec "$@" diff --git a/php/containers.json b/php/containers.json index 8c507f91..ce1a3b58 100644 --- a/php/containers.json +++ b/php/containers.json @@ -298,22 +298,13 @@ "volumes": [ { "source": "nextcloud_aio_nextcloud", - "destination": "/nextcloud", + "destination": "/var/www/html", "writeable": false } ], "environment": [ - "NC_DOMAIN=%NC_DOMAIN%", "NEXTCLOUD_HOST=nextcloud-aio-nextcloud", - "TZ=%TIMEZONE%", - "REDIS_HOST=nextcloud-aio-redis", - "REDIS_PORT=6379", - "REDIS_HOST_PASSWORD=%REDIS_PASSWORD%", - "POSTGRES_HOST=nextcloud-aio-database", - "POSTGRES_PORT=5432", - "POSTGRES_PASSWORD=%DATABASE_PASSWORD%", - "POSTGRES_DB=nextcloud_database", - "POSTGRES_USER=nextcloud" + "TZ=%TIMEZONE%" ], "restart": "unless-stopped", "read_only": true,