Skip to content

Commit

Permalink
Support custom redis port
Browse files Browse the repository at this point in the history
Signed-off-by: drivebyer <[email protected]>
  • Loading branch information
drivebyer committed Dec 8, 2023
1 parent de03283 commit a1d34e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ LABEL maintainer="Opstree Solutions"

ARG TARGETARCH

ENV REDIS_PORT=6379

LABEL version=1.0 \
arch=$TARGETARCH \
description="A production grade performance tuned redis docker image created by Opstree Solutions"
Expand Down
7 changes: 7 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ persistence_setup() {
fi
}

port_setup() {
{
echo port "${REDIS_PORT}"
} >> /etc/redis/redis.conf
}

external_config() {
echo "include ${EXTERNAL_CONFIG_FILE}" >> /etc/redis/redis.conf
}
Expand Down Expand Up @@ -139,6 +145,7 @@ main_function() {
persistence_setup
tls_setup
acl_setup
port_setup
if [[ -f "${EXTERNAL_CONFIG_FILE}" ]]; then
external_config
fi
Expand Down
4 changes: 2 additions & 2 deletions healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ check_redis_health() {
export REDISCLI_AUTH="${REDIS_PASSWORD}"
fi
if [[ "${TLS_MODE}" == "true" ]]; then
redis-cli --tls --cert "${REDIS_TLS_CERT}" --key "${REDIS_TLS_CERT_KEY}" --cacert "${REDIS_TLS_CA_KEY}" -h "$(hostname)" ping
redis-cli --tls --cert "${REDIS_TLS_CERT}" --key "${REDIS_TLS_CERT_KEY}" --cacert "${REDIS_TLS_CA_KEY}" -h "$(hostname)" -p "${REDIS_PORT}" ping
else
redis-cli -h "$(hostname)" ping
redis-cli -h "$(hostname)" -p "${REDIS_PORT}" ping
fi
}

Expand Down

0 comments on commit a1d34e5

Please sign in to comment.