Unverified Commit cda1c307 authored by Abhishek Dubey's avatar Abhishek Dubey Committed by GitHub

Added support for redis 7 (#15)

Signed-off-by: default avatariamabhishek-dubey <abhishekbhardwaj510@gmail.com>
Signed-off-by: default avatariamabhishek-dubey <abhishekbhardwaj510@gmail.com>
parent 662e516d
...@@ -41,10 +41,14 @@ COPY setupMasterSlave.sh /usr/bin/setupMasterSlave.sh ...@@ -41,10 +41,14 @@ COPY setupMasterSlave.sh /usr/bin/setupMasterSlave.sh
COPY healthcheck.sh /usr/bin/healthcheck.sh COPY healthcheck.sh /usr/bin/healthcheck.sh
RUN chown -R redis:redis /etc/redis
VOLUME ["/data"] VOLUME ["/data"]
WORKDIR /data WORKDIR /data
EXPOSE 6379 EXPOSE 6379
USER 1000
ENTRYPOINT ["/usr/bin/entrypoint.sh"] ENTRYPOINT ["/usr/bin/entrypoint.sh"]
...@@ -19,10 +19,12 @@ common_operation() { ...@@ -19,10 +19,12 @@ common_operation() {
set_redis_password() { set_redis_password() {
if [[ -z "${REDIS_PASSWORD}" ]]; then if [[ -z "${REDIS_PASSWORD}" ]]; then
echo "Redis is running without password which is not recommended" echo "Redis is running without password which is not recommended"
echo "protected-mode no" >> /etc/redis/redis.conf
else else
{ {
echo masterauth "${REDIS_PASSWORD}" echo masterauth "${REDIS_PASSWORD}"
echo requirepass "${REDIS_PASSWORD}" echo requirepass "${REDIS_PASSWORD}"
echo protected-mode yes
} >> /etc/redis/redis.conf } >> /etc/redis/redis.conf
fi fi
} }
...@@ -37,12 +39,8 @@ redis_mode_setup() { ...@@ -37,12 +39,8 @@ redis_mode_setup() {
echo cluster-config-file "${DATA_DIR}/nodes.conf" echo cluster-config-file "${DATA_DIR}/nodes.conf"
} >> /etc/redis/redis.conf } >> /etc/redis/redis.conf
if [[ "${REDIS_MAJOR_VERSION}" != "v7" ]]; then
if [[ -z "${POD_IP}" ]]; then
POD_IP=$(hostname -i) 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"
fi
else else
echo "Setting up redis in standalone mode" echo "Setting up redis in standalone mode"
fi fi
......
bind 0.0.0.0 bind 0.0.0.0
protected-mode yes
tcp-backlog 511 tcp-backlog 511
timeout 0 timeout 0
tcp-keepalive 300 tcp-keepalive 300
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment