From b013e402bf7bbe4f69ed5ed61537efef898a7b11 Mon Sep 17 00:00:00 2001 From: drivebyer Date: Thu, 30 Nov 2023 22:53:31 +0800 Subject: [PATCH] patch ot-redis --- .github/workflows/release_manually.yml | 2 +- arm64/images/ot-redis/entrypoint.sh | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_manually.yml b/.github/workflows/release_manually.yml index 3bcf64d43..d33d20a36 100644 --- a/.github/workflows/release_manually.yml +++ b/.github/workflows/release_manually.yml @@ -517,7 +517,7 @@ jobs: uses: docker/build-push-action@v3.1.1 with: context: ./arm64/images/ot-redis - file: ./arm64/images/ot-redis/Dockerfile + file: ./arm64/images/ot-redis/Dockerfile-release github-token: ${{ secrets.GITHUB_TOKEN }} push: true platforms: ${{ env.BUILD_PLATFORM }} diff --git a/arm64/images/ot-redis/entrypoint.sh b/arm64/images/ot-redis/entrypoint.sh index e4688dafb..b11e17ca3 100644 --- a/arm64/images/ot-redis/entrypoint.sh +++ b/arm64/images/ot-redis/entrypoint.sh @@ -44,7 +44,7 @@ redis_mode_setup() { POD_IP=$(hostname -i) fi - sed -i -e "/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${POD_IP}/" "${DATA_DIR}/nodes.conf" + #sed -i -e "/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${POD_IP}/" "${DATA_DIR}/nodes.conf" else echo "Setting up redis in standalone mode" fi @@ -66,7 +66,26 @@ persistence_setup() { } external_config() { - echo "include ${EXTERNAL_CONFIG_FILE}" >> /etc/redis/redis.conf + # content in /etc/redis/external.conf.d/redis-external.conf like: + # $(hostname) ip port bus-port + # we need to find the line which contains the hostname of current pod + # and append it to /etc/redis/redis.conf + # append: + # 1. cluster-announce-ip + # 2. cluster-announce-port + # 3. cluster-announce-bus-port + + local hostname=$(hostname) + local line=$(grep "${hostname}" "${EXTERNAL_CONFIG_FILE}") + local ip=$(echo "${line}" | awk '{print $2}') + local port=$(echo "${line}" | awk '{print $3}') + local bus_port=$(echo "${line}" | awk '{print $4}') + + echo "cluster-announce-ip ${ip}" >> /etc/redis/redis.conf + echo "cluster-announce-port ${port}" >> /etc/redis/redis.conf + echo "cluster-announce-bus-port ${bus_port}" >> /etc/redis/redis.conf + + #echo "include ${EXTERNAL_CONFIG_FILE}" >> /etc/redis/redis.conf } start_redis() {