Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom sentinel port #64

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Dockerfile.sentinel
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ FROM alpine:3.15

ARG TARGETARCH

ENV SENTINEL_PORT=26379

LABEL version=1.0 \
arch=$TARGETARCH \
description="A production grade performance tuned redis docker image created by Opstree Solutions"
Expand Down Expand Up @@ -50,7 +52,7 @@ VOLUME ["/sentinel-data"]

WORKDIR /sentinel-data

EXPOSE 26379
EXPOSE ${SENTINEL_PORT}

USER 1000

Expand Down
7 changes: 7 additions & 0 deletions entrypoint-sentinel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ acl_setup(){
fi
}

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

start_sentinel() {
echo "Starting sentinel service ....."
exec redis-sentinel /etc/redis/sentinel.conf
Expand All @@ -84,6 +90,7 @@ main_function() {
sentinel_mode_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-Sentinel.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)" -p 26379 ping
redis-cli --tls --cert "${REDIS_TLS_CERT}" --key "${REDIS_TLS_CERT_KEY}" --cacert "${REDIS_TLS_CA_KEY}" -h "$(hostname)" -p "${SENTINEL_PORT}" ping
else
redis-cli -h "$(hostname)" -p 26379 ping
redis-cli -h "$(hostname)" -p "${SENTINEL_PORT}" ping
fi
}

Expand Down
1 change: 0 additions & 1 deletion sentinel.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
port 26379
daemonize no
pidfile /var/run/redis-sentinel.pid
logfile ""
Expand Down