From ac46cfaff08934dcc3382151e06f0803d6619225 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 11 May 2020 12:09:13 -0300 Subject: [PATCH] eviction policy and maxmemory we're low on resources so 50MB is the most we can give it --- Dockerfile | 4 +++- monit.conf | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad9d075..ffa064d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ ARG BASE_IMAGE=sutty/monit FROM ${BASE_IMAGE}:${ALPINE_VERSION} MAINTAINER "f " -RUN apk add --no-cache redis su-exec +RUN apk add --no-cache redis COPY ./monit.conf /etc/monit.d/redis.conf @@ -15,6 +15,8 @@ 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 RUN echo "protected-mode no" >> /etc/redis.conf +RUN echo "maxmemory-policy allkeys-lfu" >> /etc/redis.conf +RUN echo "maxmemory 50mb" >> /etc/redis.conf EXPOSE 6379 VOLUME "/var/lib/redis" diff --git a/monit.conf b/monit.conf index 8779722..a2a8fd1 100644 --- a/monit.conf +++ b/monit.conf @@ -1,4 +1,4 @@ check process redis with pidfile /run/redis/redis.pid - start program = "/sbin/su-exec redis /usr/bin/redis-server /etc/redis.conf" + start program = "/usr/bin/redis-server /etc/redis.conf" as uid "redis" and gid "redis" stop program = "/usr/bin/redis-cli shutdown" if failed port 6379 protocol redis 3 times within 5 cycles then restart