From db9b6c4d6a0c1e38d73dd0be2d3db5ac573c2428 Mon Sep 17 00:00:00 2001 From: Tony Lee Date: Wed, 14 Jun 2023 17:24:33 +0800 Subject: [PATCH 1/6] chore/fix-REDIS_RDB_POLICY-logic Signed-off-by: Tony Lee --- .../6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh b/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh index bd0efe6519e6e..b7d456efac06c 100644 --- a/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh +++ b/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh @@ -406,9 +406,7 @@ redis_configure_default() { redis_conf_set appendonly "${REDIS_AOF_ENABLED}" #The value stored in $i here is the number of seconds and times of save rules in redis rdb mode - if [ -z "${REDIS_RDB_POLICY}" ];then - redis_conf_set save "" - else + if [ ! -z "${REDIS_RDB_POLICY}" ];then for i in ${REDIS_RDB_POLICY};do redis_conf_set save "${i//#/ }" done From 067c6d6b1e72a402fe1e07a8173d6f0c64d598a0 Mon Sep 17 00:00:00 2001 From: Tony Lee Date: Wed, 14 Jun 2023 17:27:36 +0800 Subject: [PATCH 2/6] add for 7,0 Signed-off-by: Tony Lee --- .../7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh b/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh index bd0efe6519e6e..b7d456efac06c 100644 --- a/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh +++ b/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh @@ -406,9 +406,7 @@ redis_configure_default() { redis_conf_set appendonly "${REDIS_AOF_ENABLED}" #The value stored in $i here is the number of seconds and times of save rules in redis rdb mode - if [ -z "${REDIS_RDB_POLICY}" ];then - redis_conf_set save "" - else + if [ ! -z "${REDIS_RDB_POLICY}" ];then for i in ${REDIS_RDB_POLICY};do redis_conf_set save "${i//#/ }" done From cd05ce7943820f7c14cdf82b1a9209f37e7f7d53 Mon Sep 17 00:00:00 2001 From: Tony Lee Date: Wed, 14 Jun 2023 17:43:30 +0800 Subject: [PATCH 3/6] add disabled option Signed-off-by: Tony Lee --- .../debian-11/rootfs/opt/bitnami/scripts/libredis.sh | 10 +++++++--- .../debian-11/rootfs/opt/bitnami/scripts/libredis.sh | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh b/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh index b7d456efac06c..c9e8511d8618e 100644 --- a/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh +++ b/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh @@ -407,9 +407,13 @@ redis_configure_default() { #The value stored in $i here is the number of seconds and times of save rules in redis rdb mode if [ ! -z "${REDIS_RDB_POLICY}" ];then - for i in ${REDIS_RDB_POLICY};do - redis_conf_set save "${i//#/ }" - done + if [ "${REDIS_RDB_POLICY}" == "disabled" ]; then + redis_conf_set save "" + else + for i in ${REDIS_RDB_POLICY};do + redis_conf_set save "${i//#/ }" + done + fi fi redis_conf_set port "$REDIS_PORT_NUMBER" diff --git a/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh b/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh index b7d456efac06c..c9e8511d8618e 100644 --- a/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh +++ b/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh @@ -407,9 +407,13 @@ redis_configure_default() { #The value stored in $i here is the number of seconds and times of save rules in redis rdb mode if [ ! -z "${REDIS_RDB_POLICY}" ];then - for i in ${REDIS_RDB_POLICY};do - redis_conf_set save "${i//#/ }" - done + if [ "${REDIS_RDB_POLICY}" == "disabled" ]; then + redis_conf_set save "" + else + for i in ${REDIS_RDB_POLICY};do + redis_conf_set save "${i//#/ }" + done + fi fi redis_conf_set port "$REDIS_PORT_NUMBER" From 11451b30f226068583d5d0bd3ac5d22fe7ba74b9 Mon Sep 17 00:00:00 2001 From: Tony Lee Date: Tue, 20 Jun 2023 22:59:55 +0800 Subject: [PATCH 4/6] add space Signed-off-by: Tony Lee --- .../6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh | 4 ++-- .../7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh b/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh index c9e8511d8618e..15733a42c8a61 100644 --- a/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh +++ b/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh @@ -406,11 +406,11 @@ redis_configure_default() { redis_conf_set appendonly "${REDIS_AOF_ENABLED}" #The value stored in $i here is the number of seconds and times of save rules in redis rdb mode - if [ ! -z "${REDIS_RDB_POLICY}" ];then + if [ ! -z "${REDIS_RDB_POLICY}" ]; then if [ "${REDIS_RDB_POLICY}" == "disabled" ]; then redis_conf_set save "" else - for i in ${REDIS_RDB_POLICY};do + for i in ${REDIS_RDB_POLICY}; do redis_conf_set save "${i//#/ }" done fi diff --git a/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh b/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh index c9e8511d8618e..15733a42c8a61 100644 --- a/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh +++ b/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh @@ -406,11 +406,11 @@ redis_configure_default() { redis_conf_set appendonly "${REDIS_AOF_ENABLED}" #The value stored in $i here is the number of seconds and times of save rules in redis rdb mode - if [ ! -z "${REDIS_RDB_POLICY}" ];then + if [ ! -z "${REDIS_RDB_POLICY}" ]; then if [ "${REDIS_RDB_POLICY}" == "disabled" ]; then redis_conf_set save "" else - for i in ${REDIS_RDB_POLICY};do + for i in ${REDIS_RDB_POLICY}; do redis_conf_set save "${i//#/ }" done fi From 63092861729702ddd97d41a9031339e078c6b848 Mon Sep 17 00:00:00 2001 From: Tony Lee Date: Mon, 3 Jul 2023 10:21:24 +0800 Subject: [PATCH 5/6] add space Signed-off-by: Tony Lee --- .../6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh | 2 +- .../7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh b/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh index 15733a42c8a61..e0ff56945bc17 100644 --- a/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh +++ b/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh @@ -55,7 +55,7 @@ redis_conf_set() { [[ "$value" = "" ]] && value="\"$value\"" # Determine whether to enable the configuration for RDB persistence, if yes, do not enable the replacement operation - if [ "${key}" == "save" ];then + if [ "${key}" == "save" ]; then echo "${key} ${value}" >> "${REDIS_BASE_DIR}/etc/redis.conf" else replace_in_file "${REDIS_BASE_DIR}/etc/redis.conf" "^#*\s*${key} .*" "${key} ${value}" false diff --git a/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh b/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh index 15733a42c8a61..e0ff56945bc17 100644 --- a/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh +++ b/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh @@ -55,7 +55,7 @@ redis_conf_set() { [[ "$value" = "" ]] && value="\"$value\"" # Determine whether to enable the configuration for RDB persistence, if yes, do not enable the replacement operation - if [ "${key}" == "save" ];then + if [ "${key}" == "save" ]; then echo "${key} ${value}" >> "${REDIS_BASE_DIR}/etc/redis.conf" else replace_in_file "${REDIS_BASE_DIR}/etc/redis.conf" "^#*\s*${key} .*" "${key} ${value}" false From 162d3163b0de47860140c144249aa6f721c8818f Mon Sep 17 00:00:00 2001 From: Tony Lee Date: Tue, 18 Jul 2023 17:07:45 +0800 Subject: [PATCH 6/6] Add env var REDIS_RDB_POLICY_DISABLED Signed-off-by: Tony Lee --- .../debian-11/rootfs/opt/bitnami/scripts/libredis.sh | 12 ++++++------ .../debian-11/rootfs/opt/bitnami/scripts/libredis.sh | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh b/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh index e0ff56945bc17..8156a5c5702f4 100644 --- a/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh +++ b/bitnami/redis-cluster/6.2/debian-11/rootfs/opt/bitnami/scripts/libredis.sh @@ -406,14 +406,14 @@ redis_configure_default() { redis_conf_set appendonly "${REDIS_AOF_ENABLED}" #The value stored in $i here is the number of seconds and times of save rules in redis rdb mode - if [ ! -z "${REDIS_RDB_POLICY}" ]; then - if [ "${REDIS_RDB_POLICY}" == "disabled" ]; then + if is_empty_value "$REDIS_RDB_POLICY"; then + if is_boolean_yes "$REDIS_RDB_POLICY_DISABLED"; then redis_conf_set save "" - else - for i in ${REDIS_RDB_POLICY}; do - redis_conf_set save "${i//#/ }" - done fi + else + for i in ${REDIS_RDB_POLICY}; do + redis_conf_set save "${i//#/ }" + done fi redis_conf_set port "$REDIS_PORT_NUMBER" diff --git a/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh b/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh index e0ff56945bc17..8156a5c5702f4 100644 --- a/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh +++ b/bitnami/redis-cluster/7.0/debian-11/rootfs/opt/bitnami/scripts/libredis.sh @@ -406,14 +406,14 @@ redis_configure_default() { redis_conf_set appendonly "${REDIS_AOF_ENABLED}" #The value stored in $i here is the number of seconds and times of save rules in redis rdb mode - if [ ! -z "${REDIS_RDB_POLICY}" ]; then - if [ "${REDIS_RDB_POLICY}" == "disabled" ]; then + if is_empty_value "$REDIS_RDB_POLICY"; then + if is_boolean_yes "$REDIS_RDB_POLICY_DISABLED"; then redis_conf_set save "" - else - for i in ${REDIS_RDB_POLICY}; do - redis_conf_set save "${i//#/ }" - done fi + else + for i in ${REDIS_RDB_POLICY}; do + redis_conf_set save "${i//#/ }" + done fi redis_conf_set port "$REDIS_PORT_NUMBER"