From 639fa1df08cec14c3e742639372fabee3769caca Mon Sep 17 00:00:00 2001 From: f Date: Tue, 10 Sep 2019 20:23:34 -0300 Subject: [PATCH] redis --- Dockerfile | 15 +++++++++++++++ monit.conf | 4 ++++ 2 files changed, 19 insertions(+) create mode 100644 monit.conf diff --git a/Dockerfile b/Dockerfile index d93a8d9..850e9b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,3 +2,18 @@ ARG ALPINE_VERSION=3.13.6 ARG BASE_IMAGE=sutty/monit FROM ${BASE_IMAGE}:${ALPINE_VERSION} MAINTAINER "f " + +RUN apk add --no-cache redis su-exec + +COPY ./monit.conf /etc/monit.d/redis.conf + +RUN sed -re "/^bind /d" -i /etc/redis.conf +RUN sed -re "/^protected-mode /d" -i /etc/redis.conf +RUN sed -re "/^logfile /d" -i /etc/redis.conf +RUN sed -re "s/^# (syslog-enabled).*/\1 yes/" -i /etc/redis.conf +RUN sed -re "s/^(appendonly).*/\1 yes/" -i /etc/redis.conf +RUN echo "pidfile /run/redis/redis.pid" >> /etc/redis.conf +RUN echo "daemonize yes" >> /etc/redis.conf + +EXPOSE 6379 +VOLUME "/var/lib/redis" diff --git a/monit.conf b/monit.conf new file mode 100644 index 0000000..8779722 --- /dev/null +++ b/monit.conf @@ -0,0 +1,4 @@ +check process redis with pidfile /run/redis/redis.pid + start program = "/sbin/su-exec redis /usr/bin/redis-server /etc/redis.conf" + stop program = "/usr/bin/redis-cli shutdown" + if failed port 6379 protocol redis 3 times within 5 cycles then restart