From 3fac5b3943fbe2c923887340248127aa9cc37b2b Mon Sep 17 00:00:00 2001
From: duanhongyi <duanhongyi@doopai.com>
Date: Tue, 15 Jul 2025 23:01:24 +0800
Subject: [PATCH 1/5] chore(charts): simplify the svc url

---
 charts/valkey/templates/valkey-statefulset.yaml | 10 +++++-----
 charts/valkey/values.yaml                       |  7 -------
 rootfs/bin/valkey-start                         |  2 +-
 3 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/charts/valkey/templates/valkey-statefulset.yaml b/charts/valkey/templates/valkey-statefulset.yaml
index b14c700..be223df 100644
--- a/charts/valkey/templates/valkey-statefulset.yaml
+++ b/charts/valkey/templates/valkey-statefulset.yaml
@@ -40,7 +40,7 @@ spec:
               name: valkey-creds
               key: password
         - name: DRYCC_VALKEY_SENTINEL
-          value: {{ printf "drycc-valkey.%s.svc.%s" $.Release.Namespace $.Values.global.clusterDomain }}
+          value: drycc-valkey
         ports:
         - containerPort: 16379
         {{- with index .Values "proxy" "resources" }}
@@ -81,7 +81,7 @@ spec:
         args:
         - valkey-start
         - server
-        - $(POD_NAME).{{ printf "drycc-valkey.%s.svc.%s" $.Release.Namespace $.Values.global.clusterDomain }}
+        - $(POD_NAME).drycc-valkey
         {{- end }}
         ports:
         - containerPort: 6379
@@ -95,7 +95,7 @@ spec:
             fieldRef:
               fieldPath: metadata.name
         - name: DRYCC_VALKEY_SENTINEL
-          value: {{ printf "drycc-valkey.%s.svc.%s" $.Release.Namespace $.Values.global.clusterDomain }}
+          value: drycc-valkey
         - name: DRYCC_VALKEY_PASSWORD
           valueFrom:
             secretKeyRef:
@@ -156,7 +156,7 @@ spec:
         args:
         - valkey-start
         - sentinel
-        - $(POD_NAME).{{ printf "drycc-valkey.%s.svc.%s" $.Release.Namespace $.Values.global.clusterDomain }}
+        - $(POD_NAME).drycc-valkey
         {{- end }}
         ports:
         - containerPort: 26379
@@ -170,7 +170,7 @@ spec:
             fieldRef:
               fieldPath: metadata.name
         - name: DRYCC_VALKEY_SENTINEL
-          value: {{ printf "drycc-valkey.%s.svc.%s" $.Release.Namespace $.Values.global.clusterDomain }}
+          value: drycc-valkey
         - name: DRYCC_VALKEY_PASSWORD
           valueFrom:
             secretKeyRef:
diff --git a/charts/valkey/values.yaml b/charts/valkey/values.yaml
index 1908f37..bf19ca1 100644
--- a/charts/valkey/values.yaml
+++ b/charts/valkey/values.yaml
@@ -74,10 +74,3 @@ persistence:
   enabled: false # Set to true to enable persistence
   size: 5Gi
   storageClass: ""
-
-global:
-  # A domain name consists of one or more parts.
-  # Periods (.) are used to separate these parts.
-  # Each part must be 1 to 63 characters in length and can contain lowercase letters, digits, and hyphens (-).
-  # It must start and end with a lowercase letter or digit.
-  clusterDomain: "cluster.local"
diff --git a/rootfs/bin/valkey-start b/rootfs/bin/valkey-start
index a49639c..8ab7884 100755
--- a/rootfs/bin/valkey-start
+++ b/rootfs/bin/valkey-start
@@ -10,7 +10,7 @@ print_usage() {
     echo "server <announce-host>              start valkey server"
     echo "sentinel <announce-host>            start valkey sentinel"
     echo ""
-    echo "Such as 'valkey-start server valkey.valkey.svc.cluster.local' to start valkey server."
+    echo "Such as 'valkey-start server valkey.valkey.svc' to start valkey server."
 }
 
 remove_in_file() {

From 5f5f1f72502cc3540a141ecb84874a1025c4dfd6 Mon Sep 17 00:00:00 2001
From: duanhongyi <duanhongyi@doopai.com>
Date: Sun, 14 Sep 2025 01:24:04 +0800
Subject: [PATCH 2/5] chore(valkey): bump new version

---
 rootfs/Dockerfile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile
index f331428..99efde3 100644
--- a/rootfs/Dockerfile
+++ b/rootfs/Dockerfile
@@ -4,9 +4,9 @@ FROM registry.drycc.cc/drycc/base:${CODENAME}
 ENV DRYCC_UID=1001 \
   DRYCC_GID=1001 \
   DRYCC_HOME_DIR=/data \
-  VALKEY_VERSION="8.1.1" \
+  VALKEY_VERSION="8.1.3" \
   VALKEY_SENTINEL_PROXY_VERSION="1.0.2" \
-  REDIS_EXPORTER_VERSION="1.51.0"
+  REDIS_EXPORTER_VERSION="1.76.0"
 
 RUN groupadd drycc --gid ${DRYCC_GID} \
   && useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR}

From 22610f27ea65a99c9832619eecb57f05385050c6 Mon Sep 17 00:00:00 2001
From: duanhongyi <duanhongyi@doopai.com>
Date: Tue, 4 Nov 2025 08:48:15 +0800
Subject: [PATCH 3/5] chore(valkey): bump version to 9.0.0

---
 _test/test.sh     | 64 +++++++++++++++++------------------------------
 rootfs/Dockerfile |  8 +++---
 2 files changed, 27 insertions(+), 45 deletions(-)

diff --git a/_test/test.sh b/_test/test.sh
index badc3e8..574b989 100755
--- a/_test/test.sh
+++ b/_test/test.sh
@@ -2,12 +2,10 @@
 
 VERSION="$1"
 
-CONTAINER_NETWORK="valkey"
 CONTAINER_PROXY_NAME="valkey-benchmark-proxy"
 CONTAINER_MASTER_NAME="valkey-benchmark-master"
 CONTAINER_SLAVE1_NAME="valkey-benchmark-slave1"
 CONTAINER_SLAVE2_NAME="valkey-benchmark-slave2"
-DRYCC_VALKEY_SENTINEL=$CONTAINER_MASTER_NAME
 DRYCC_VALKEY_PASSWORD=123456
 
 function clean_before_exit {
@@ -19,87 +17,71 @@ trap clean_before_exit EXIT
 start-valkey-master() {
     podman run -d \
       --rm \
-      --network "$CONTAINER_NETWORK" \
-      --ip 192.168.253.10 \
-      --add-host="$CONTAINER_MASTER_NAME:192.168.253.10" \
-      --add-host="$CONTAINER_SLAVE1_NAME:192.168.253.11" \
-      --add-host="$CONTAINER_SLAVE2_NAME:192.168.253.12" \
       --env "REDISCLI_AUTH=$DRYCC_VALKEY_PASSWORD" \
-      --env "DRYCC_VALKEY_SENTINEL=$DRYCC_VALKEY_SENTINEL" \
       --env "DRYCC_VALKEY_PASSWORD=$DRYCC_VALKEY_PASSWORD" \
       --name "$CONTAINER_MASTER_NAME" \
       "registry.drycc.cc/drycc/valkey:$VERSION" \
-      valkey-start server $CONTAINER_MASTER_NAME
-    podman exec "$CONTAINER_MASTER_NAME" init-stack valkey-start sentinel $CONTAINER_MASTER_NAME &
+      sleep infinity
+
+    master_ip=$(podman exec "$CONTAINER_MASTER_NAME" hostname -i | tr -d '\r\n')
+    podman exec --env "DRYCC_VALKEY_SENTINEL=$master_ip" "$CONTAINER_MASTER_NAME" init-stack valkey-start server "$master_ip"  &
+    podman exec --env "DRYCC_VALKEY_SENTINEL=$master_ip" "$CONTAINER_MASTER_NAME" init-stack valkey-start sentinel "$master_ip" &
 }
 
 start-valkey-slave1() {
     podman run -d \
       --rm \
-      --network "$CONTAINER_NETWORK" \
-      --ip 192.168.253.11 \
-      --add-host="$CONTAINER_MASTER_NAME:192.168.253.10" \
-      --add-host="$CONTAINER_SLAVE1_NAME:192.168.253.11" \
-      --add-host="$CONTAINER_SLAVE2_NAME:192.168.253.12" \
       --env "REDISCLI_AUTH=$DRYCC_VALKEY_PASSWORD" \
-      --env "DRYCC_VALKEY_SENTINEL=$DRYCC_VALKEY_SENTINEL" \
       --env "DRYCC_VALKEY_PASSWORD=$DRYCC_VALKEY_PASSWORD" \
       --name "$CONTAINER_SLAVE1_NAME" \
       "registry.drycc.cc/drycc/valkey:$VERSION" \
-      valkey-start server $CONTAINER_SLAVE1_NAME
-    podman exec "$CONTAINER_SLAVE1_NAME" init-stack valkey-start sentinel $CONTAINER_SLAVE1_NAME &
+      sleep infinity
+
+    slave1_ip=$(podman exec -it "$CONTAINER_SLAVE1_NAME" hostname -i | tr -d '\r\n')
+    podman exec --env "DRYCC_VALKEY_SENTINEL=$master_ip" "$CONTAINER_SLAVE1_NAME" init-stack valkey-start server "$slave1_ip" &
+    podman exec --env "DRYCC_VALKEY_SENTINEL=$master_ip" "$CONTAINER_SLAVE1_NAME" init-stack valkey-start sentinel "$slave1_ip" &
 }
 
 start-valkey-slave2() {
     podman run -d \
       --rm \
-      --network "$CONTAINER_NETWORK" \
-      --ip 192.168.253.12 \
-      --add-host="$CONTAINER_MASTER_NAME:192.168.253.10" \
-      --add-host="$CONTAINER_SLAVE1_NAME:192.168.253.11" \
-      --add-host="$CONTAINER_SLAVE2_NAME:192.168.253.12" \
       --env "REDISCLI_AUTH=$DRYCC_VALKEY_PASSWORD" \
-      --env "DRYCC_VALKEY_SENTINEL=$DRYCC_VALKEY_SENTINEL" \
       --env "DRYCC_VALKEY_PASSWORD=$DRYCC_VALKEY_PASSWORD" \
       --name "$CONTAINER_SLAVE2_NAME" \
       "registry.drycc.cc/drycc/valkey:$VERSION" \
-      valkey-start server $CONTAINER_SLAVE2_NAME
-    podman exec "$CONTAINER_SLAVE2_NAME" init-stack valkey-start sentinel $CONTAINER_SLAVE2_NAME &
+      sleep infinity
+
+    slave2_ip=$(podman exec -it "$CONTAINER_SLAVE2_NAME" hostname -i | tr -d '\r\n')
+    podman exec --env "DRYCC_VALKEY_SENTINEL=$master_ip" "$CONTAINER_SLAVE2_NAME" init-stack valkey-start server "$slave2_ip" &
+    podman exec --env "DRYCC_VALKEY_SENTINEL=$master_ip" "$CONTAINER_SLAVE2_NAME" init-stack valkey-start sentinel "$slave2_ip" &
 }
 
 start-valkey-proxy() {
     podman run -d \
       --rm \
-      --network "$CONTAINER_NETWORK" \
-      --ip 192.168.253.13 \
-      --add-host="$CONTAINER_MASTER_NAME:192.168.253.10" \
-      --add-host="$CONTAINER_SLAVE1_NAME:192.168.253.11" \
-      --add-host="$CONTAINER_SLAVE2_NAME:192.168.253.12" \
       --env "REDISCLI_AUTH=$DRYCC_VALKEY_PASSWORD" \
-      --env "DRYCC_VALKEY_SENTINEL=$DRYCC_VALKEY_SENTINEL" \
       --env "DRYCC_VALKEY_PASSWORD=$DRYCC_VALKEY_PASSWORD" \
       --name "$CONTAINER_PROXY_NAME" \
       "registry.drycc.cc/drycc/valkey:$VERSION" \
-      valkey-start proxy
+      sleep infinity
+
+    podman exec --env "DRYCC_VALKEY_SENTINEL=$master_ip" "$CONTAINER_PROXY_NAME" init-stack valkey-start proxy &
 }
 
 clean-valkey() {
     {
-        podman stop -i "$CONTAINER_PROXY_NAME"
-        podman stop -i "$CONTAINER_SLAVE1_NAME"
-        podman stop -i "$CONTAINER_SLAVE2_NAME"
-        podman stop -i "$CONTAINER_MASTER_NAME"
-        podman network rm -f "$CONTAINER_NETWORK"
-    } 2>>/dev/null
+        podman kill "$CONTAINER_PROXY_NAME"
+        podman kill "$CONTAINER_SLAVE1_NAME"
+        podman kill "$CONTAINER_SLAVE2_NAME"
+        podman kill "$CONTAINER_MASTER_NAME"
+    } >>/dev/null 2>&1
 }
 
 clean-valkey
-podman network create --subnet=192.168.253.0/24 "$CONTAINER_NETWORK"
 start-valkey-master
 start-valkey-slave1
 start-valkey-slave2
 start-valkey-proxy
-
 echo "run valkey proxy benchmark..."
 podman exec "$CONTAINER_PROXY_NAME" init-stack valkey-benchmark -p 16379 -a $DRYCC_VALKEY_PASSWORD
 
diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile
index 99efde3..f1b0e46 100644
--- a/rootfs/Dockerfile
+++ b/rootfs/Dockerfile
@@ -1,12 +1,12 @@
 ARG CODENAME
 FROM registry.drycc.cc/drycc/base:${CODENAME}
 
-ENV DRYCC_UID=1001 \
+ARG DRYCC_UID=1001 \
   DRYCC_GID=1001 \
   DRYCC_HOME_DIR=/data \
-  VALKEY_VERSION="8.1.3" \
-  VALKEY_SENTINEL_PROXY_VERSION="1.0.2" \
-  REDIS_EXPORTER_VERSION="1.76.0"
+  VALKEY_VERSION="9.0.0" \
+  VALKEY_SENTINEL_PROXY_VERSION="2.0.0" \
+  REDIS_EXPORTER_VERSION="1.80.0"
 
 RUN groupadd drycc --gid ${DRYCC_GID} \
   && useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR}

From 149f5d8b8bfad1f45eebf3562f69ecb38fe531f2 Mon Sep 17 00:00:00 2001
From: duanhongyi <duanhongyi@doopai.com>
Date: Tue, 9 Dec 2025 12:46:03 +0800
Subject: [PATCH 4/5] chore(Dockerfile): bump valkey-sentinel-proxy version

---
 README.md         | 2 +-
 rootfs/Dockerfile | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 28cb9d5..ea5a0de 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ Different components use different db, as follows:
 
 * `controller` use db 0
 * `passport` use db 1
-* `fluentbit` and `logger` use db 2
+* `grafana` use db 2
 * `manager` use db 10
 * `helmbroker` use db 11
 
diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile
index f1b0e46..6068bee 100644
--- a/rootfs/Dockerfile
+++ b/rootfs/Dockerfile
@@ -5,8 +5,8 @@ ARG DRYCC_UID=1001 \
   DRYCC_GID=1001 \
   DRYCC_HOME_DIR=/data \
   VALKEY_VERSION="9.0.0" \
-  VALKEY_SENTINEL_PROXY_VERSION="2.0.0" \
-  REDIS_EXPORTER_VERSION="1.80.0"
+  VALKEY_SENTINEL_PROXY_VERSION="2.0.1" \
+  REDIS_EXPORTER_VERSION="1.80.1"
 
 RUN groupadd drycc --gid ${DRYCC_GID} \
   && useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR}

From 7b4c255bce9114bcd1987fa504124510ff27bc04 Mon Sep 17 00:00:00 2001
From: duanhongyi <duanhongyi@doopai.com>
Date: Wed, 8 Apr 2026 18:35:00 +0800
Subject: [PATCH 5/5] feat(proxy): wait for sentinel readiness before starting
 proxy

---
 rootfs/bin/valkey-start | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/rootfs/bin/valkey-start b/rootfs/bin/valkey-start
index 8ab7884..d8204d8 100755
--- a/rootfs/bin/valkey-start
+++ b/rootfs/bin/valkey-start
@@ -25,7 +25,23 @@ get_master_info() {
     eval "$command"
 }
 
+wait_for_valkey() {
+    local host="${1:?host is required}"
+    local port="${2:?port is required}"
+    local retries="${3:-30}"
+    log "Waiting for valkey (${host}:${port}) to be ready..."
+    for ((i = 1; i <= retries; i += 1)); do
+        if valkey-cli -h "$host" -p "$port" ping 2>/dev/null | grep -q PONG; then
+            log "Valkey (${host}:${port}) is ready."
+            return 0
+        fi
+        sleep 2s
+    done
+    error "Valkey (${host}:${port}) did not become ready in time"
+}
+
 start_valkey_proxy() {
+    wait_for_valkey "${DRYCC_VALKEY_SENTINEL}" "${SENTINEL_PORT}"
     exec valkey-sentinel-proxy \
         --listen=:16379 \
         --master=drycc \
