Commit 7262250b authored by iamabhishek-dubey's avatar iamabhishek-dubey

Added entrypoint.sh to support cluster and standalone

parent 4eb86fc2
...@@ -10,10 +10,6 @@ ARG REDIS_DOWNLOAD_URL="http://download.redis.io/" ...@@ -10,10 +10,6 @@ ARG REDIS_DOWNLOAD_URL="http://download.redis.io/"
ARG REDIS_VERSION="stable" ARG REDIS_VERSION="stable"
COPY redis.conf /etc/redis/redis.conf
COPY entrypoint.sh /usr/bin/entrypoint.sh
RUN addgroup -S -g 1000 redis && adduser -S -G redis -u 999 redis && \ RUN addgroup -S -g 1000 redis && adduser -S -G redis -u 999 redis && \
apk add --no-cache su-exec tzdata make curl build-base linux-headers apk add --no-cache su-exec tzdata make curl build-base linux-headers
...@@ -27,6 +23,8 @@ RUN curl -fL -Lo /tmp/redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis- ...@@ -27,6 +23,8 @@ RUN curl -fL -Lo /tmp/redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-
cp -f *.conf /etc/redis && \ cp -f *.conf /etc/redis && \
rm -rf /tmp/redis-${REDIS_VERSION}* rm -rf /tmp/redis-${REDIS_VERSION}*
COPY entrypoint.sh /usr/bin/entrypoint.sh
VOLUME ["/data"] VOLUME ["/data"]
WORKDIR /data WORKDIR /data
......
...@@ -2,6 +2,19 @@ ...@@ -2,6 +2,19 @@
set -eu set -eu
generate_common_config() {
{
echo "bind 0.0.0.0"
echo protected-mode yes
echo tcp-backlog 511
echo timeout 0
echo tcp-keepalive 300
echo daemonize no
echo supervised no
echo pidfile /var/run/redis.pid
} > /etc/redis/redis.conf
}
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"
...@@ -31,6 +44,7 @@ start_redis() { ...@@ -31,6 +44,7 @@ start_redis() {
} }
main_function() { main_function() {
generate_common_config
set_redis_password set_redis_password
redis_mode_setup redis_mode_setup
start_redis start_redis
......
bind 0.0.0.0
protected-mode yes
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis.pid
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