From 2fc2be363aa03c4ff6e091a1f8163a942b34152f Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Mon, 13 Jan 2025 11:15:29 +0100 Subject: [PATCH 1/3] nextcloud: allow to configure redis user Signed-off-by: Simon L. --- Containers/nextcloud/Dockerfile | 2 +- Containers/nextcloud/config/redis.config.php | 4 ++++ Containers/notify-push/start.sh | 2 +- Containers/whiteboard/start.sh | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Containers/nextcloud/Dockerfile b/Containers/nextcloud/Dockerfile index e8999f75..172b57b5 100644 --- a/Containers/nextcloud/Dockerfile +++ b/Containers/nextcloud/Dockerfile @@ -147,7 +147,7 @@ RUN set -ex; \ \ { \ echo 'session.save_handler = redis'; \ - echo 'session.save_path = "tcp://${REDIS_HOST}:6379/${REDIS_DB_INDEX}?auth=${REDIS_HOST_PASSWORD}"'; \ + echo 'session.save_path = "tcp://${REDIS_HOST}:6379?database=${REDIS_DB_INDEX}&auth[]=${REDIS_USER}&auth[]=${REDIS_HOST_PASSWORD}"'; \ echo 'redis.session.locking_enabled = 1'; \ echo 'redis.session.lock_retries = -1'; \ echo 'redis.session.lock_wait_time = 10000'; \ diff --git a/Containers/nextcloud/config/redis.config.php b/Containers/nextcloud/config/redis.config.php index c99a9ec1..7e4edec2 100644 --- a/Containers/nextcloud/config/redis.config.php +++ b/Containers/nextcloud/config/redis.config.php @@ -18,4 +18,8 @@ if (getenv('REDIS_HOST')) { if (getenv('REDIS_DB_INDEX')) { $CONFIG['redis']['dbindex'] = (int) getenv('REDIS_DB_INDEX'); } + + if (getenv('REDIS_USER') !== false) { + $CONFIG['redis']['user'] = getenv('REDIS_USER'); + } } diff --git a/Containers/notify-push/start.sh b/Containers/notify-push/start.sh index 21b291d0..eda094d1 100644 --- a/Containers/notify-push/start.sh +++ b/Containers/notify-push/start.sh @@ -62,7 +62,7 @@ fi # Set sensitive values as env 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" +export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX" # Run it /nextcloud/custom_apps/notify_push/bin/"$CPU_ARCH"/notify_push \ diff --git a/Containers/whiteboard/start.sh b/Containers/whiteboard/start.sh index 8816ee7f..576bd094 100644 --- a/Containers/whiteboard/start.sh +++ b/Containers/whiteboard/start.sh @@ -11,7 +11,7 @@ if [ -z "$REDIS_DB_INDEX" ]; then REDIS_DB_INDEX=0 fi -export REDIS_URL="redis://:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX" +export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX" # Run it exec npm run server:start From 4acc9d8f41ad0bc3a22dad61286d096605413171 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Tue, 14 Jan 2025 14:25:17 +0100 Subject: [PATCH 2/3] add idea Signed-off-by: Simon L. --- Containers/nextcloud/Dockerfile | 2 +- Containers/nextcloud/config/redis.config.php | 4 ++-- Containers/notify-push/start.sh | 4 ++++ Containers/whiteboard/start.sh | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Containers/nextcloud/Dockerfile b/Containers/nextcloud/Dockerfile index 172b57b5..50692fbf 100644 --- a/Containers/nextcloud/Dockerfile +++ b/Containers/nextcloud/Dockerfile @@ -147,7 +147,7 @@ RUN set -ex; \ \ { \ echo 'session.save_handler = redis'; \ - echo 'session.save_path = "tcp://${REDIS_HOST}:6379?database=${REDIS_DB_INDEX}&auth[]=${REDIS_USER}&auth[]=${REDIS_HOST_PASSWORD}"'; \ + echo 'session.save_path = "tcp://${REDIS_HOST}:6379?database=${REDIS_DB_INDEX}${REDIS_USER_AUTH}&auth[]=${REDIS_HOST_PASSWORD}"'; \ echo 'redis.session.locking_enabled = 1'; \ echo 'redis.session.lock_retries = -1'; \ echo 'redis.session.lock_wait_time = 10000'; \ diff --git a/Containers/nextcloud/config/redis.config.php b/Containers/nextcloud/config/redis.config.php index 7e4edec2..80848974 100644 --- a/Containers/nextcloud/config/redis.config.php +++ b/Containers/nextcloud/config/redis.config.php @@ -19,7 +19,7 @@ if (getenv('REDIS_HOST')) { $CONFIG['redis']['dbindex'] = (int) getenv('REDIS_DB_INDEX'); } - if (getenv('REDIS_USER') !== false) { - $CONFIG['redis']['user'] = getenv('REDIS_USER'); + if (getenv('REDIS_USER_AUTH') !== false) { + $CONFIG['redis']['user'] = str_replace("&auth[]=", "", getenv('REDIS_USER_AUTH')); } } diff --git a/Containers/notify-push/start.sh b/Containers/notify-push/start.sh index eda094d1..6ff81fec 100644 --- a/Containers/notify-push/start.sh +++ b/Containers/notify-push/start.sh @@ -62,6 +62,10 @@ fi # Set sensitive values as env export DATABASE_URL="$DATABASE_TYPE://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB" +if [ -n "$REDIS_USER_AUTH" ]; then + # shellcheck disable=SC2001 + REDIS_USER="$(echo "$REDIS_USER_AUTH" | sed 's|&auth[]=||')" +fi export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX" # Run it diff --git a/Containers/whiteboard/start.sh b/Containers/whiteboard/start.sh index 576bd094..8390c923 100644 --- a/Containers/whiteboard/start.sh +++ b/Containers/whiteboard/start.sh @@ -11,6 +11,10 @@ if [ -z "$REDIS_DB_INDEX" ]; then REDIS_DB_INDEX=0 fi +if [ -n "$REDIS_USER_AUTH" ]; then + # shellcheck disable=SC2001 + REDIS_USER="$(echo "$REDIS_USER_AUTH" | sed 's|&auth[]=||')" +fi export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX" # Run it From b786415cfbec4f989893739889847003f43ab316 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Tue, 14 Jan 2025 14:39:32 +0100 Subject: [PATCH 3/3] Revert changes to notify-push and whiteboard Signed-off-by: Simon L. --- Containers/notify-push/start.sh | 4 ---- Containers/whiteboard/start.sh | 4 ---- 2 files changed, 8 deletions(-) diff --git a/Containers/notify-push/start.sh b/Containers/notify-push/start.sh index 6ff81fec..eda094d1 100644 --- a/Containers/notify-push/start.sh +++ b/Containers/notify-push/start.sh @@ -62,10 +62,6 @@ fi # Set sensitive values as env export DATABASE_URL="$DATABASE_TYPE://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB" -if [ -n "$REDIS_USER_AUTH" ]; then - # shellcheck disable=SC2001 - REDIS_USER="$(echo "$REDIS_USER_AUTH" | sed 's|&auth[]=||')" -fi export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX" # Run it diff --git a/Containers/whiteboard/start.sh b/Containers/whiteboard/start.sh index 8390c923..576bd094 100644 --- a/Containers/whiteboard/start.sh +++ b/Containers/whiteboard/start.sh @@ -11,10 +11,6 @@ if [ -z "$REDIS_DB_INDEX" ]; then REDIS_DB_INDEX=0 fi -if [ -n "$REDIS_USER_AUTH" ]; then - # shellcheck disable=SC2001 - REDIS_USER="$(echo "$REDIS_USER_AUTH" | sed 's|&auth[]=||')" -fi export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX" # Run it