Skip to content

Commit

Permalink
patch ot-redis
Browse files Browse the repository at this point in the history
  • Loading branch information
drivebyer committed Nov 30, 2023
1 parent 3864bc5 commit b013e40
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release_manually.yml
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ jobs:
uses: docker/[email protected]
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 }}
Expand Down
23 changes: 21 additions & 2 deletions arm64/images/ot-redis/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand Down

0 comments on commit b013e40

Please sign in to comment.