Commit 39f33a28 authored by Sandeep Rawat's avatar Sandeep Rawat

Merge branch 'dev' into 'master'

Redis Image Jenkins CI

See merge request ot-docker/redis!3
parents 1b33aff8 10d86806
......@@ -10,7 +10,7 @@ ARG REDIS_DOWNLOAD_URL="http://download.redis.io/"
ARG REDIS_VERSION="stable"
RUN addgroup -S -g 1000 redis && adduser -S -G redis -u 999 redis && \
RUN addgroup -S -g 1001 redis && adduser -S -G redis -u 1001 redis && \
apk add --no-cache su-exec tzdata make curl build-base linux-headers bash
RUN curl -fL -Lo /tmp/redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-${REDIS_VERSION}.tar.gz && \
......@@ -21,14 +21,21 @@ RUN curl -fL -Lo /tmp/redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-
make install && \
mkdir -p /etc/redis && \
cp -f *.conf /etc/redis && \
rm -rf /tmp/redis-${REDIS_VERSION}*
rm -rf /tmp/redis-${REDIS_VERSION}* && \
apk del curl make
COPY redis.conf /etc/redis/redis.conf
COPY entrypoint.sh /usr/bin/entrypoint.sh
COPY run.sh /usr/bin/run.sh
VOLUME ["/data"]
WORKDIR /data
USER redis
EXPOSE 6379
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
library 'dockerCI'
node(){
dockerCI.call()
}
image_name='redis'
image_registry='opstree/redis'
image_version='v1'
Dockerfile='Dockerfile'
registry_credential_id= dev_docker
image_repo_url=''
slack_channel='docker'
\ No newline at end of file
#!/bin/bash
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 -ex
set_redis_password() {
if [ -z "${REDIS_PASSWORD}" ]; then
if [[ -z "${REDIS_PASSWORD}" ]]; then
echo "Redis is running without password which is not recommended"
else
{
......@@ -27,7 +14,7 @@ set_redis_password() {
}
redis_mode_setup() {
if [ "${SETUP_MODE}" = "cluster" ]; then
if [[ "${SETUP_MODE}" == "cluster" ]]; then
{
echo cluster-enabled yes
echo cluster-config-file nodes.conf
......@@ -39,12 +26,11 @@ redis_mode_setup() {
}
start_redis() {
echo "Starting redis service "
echo "Starting redis service....."
redis-server /etc/redis/redis.conf
}
main_function() {
generate_common_config
set_redis_password
redis_mode_setup
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
#!/bin/bash
redis_server_mode() {
if [[ "${SERVER_MODE}" == "master" ]]; then
echo "Redis server mode is master"
elif [[ "${SERVER_MODE}" == "slave" ]]; then
echo "Redis server mode is slave"
if [[ -z "${REDIS_PASSWORD}" ]]; then
redis-cli --add-node "${SLAVE_IP}" "${MASTER_IP}" --cluster-slave
else
redis-cli --add-node "${SLAVE_IP}" "${MASTER_IP}" --cluster-slave -a "${REDIS_PASSWORD}"
fi
else
echo "Redis server mode is standalone"
fi
}
redis_server_mode
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