Page MenuHomePhorge

No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/docker/redis/init.sh b/docker/redis/init.sh
index f257b798..5d231079 100755
--- a/docker/redis/init.sh
+++ b/docker/redis/init.sh
@@ -1,22 +1,24 @@
#!/bin/bash
set -eu
# Process the Redis configuration files
echo 'Processing Redis configuration files ...'
if [[ -v REDIS_PASSWORD ]]; then
echo "requirepass \"$REDIS_PASSWORD\"" >> /etc/redis/redis.conf
else
echo 'WARNING: setting REDIS_PASSWORD is recommended'
fi
if [[ -v MEMORY_LIMIT ]]; then
- echo "maxmemory $(env | grep MEMORY | sed 's/MEMORY_LIMIT=//')" >> /etc/redis/redis.conf
+ # Add a 10% margin between the configured limit, and the kubernetes maximum memory limit
+ MAX_MEMORY="$(env | grep MEMORY | sed 's/MEMORY_LIMIT=//' | awk '{$0=int($1 * 0.9);print $0}')"
+ echo "maxmemory $MAX_MEMORY" >> /etc/redis/redis.conf
echo "maxmemory-policy allkeys-lru" >> /etc/redis/redis.conf
else
echo 'WARNING: setting MEMORY_LIMIT is recommended'
fi
# Restart the Redis server with public IP bindings
echo 'Running final exec -- Only Redis logs after this point'
exec /usr/bin/redis-server /etc/redis/redis.conf --daemonize no "$@" 2>&1

File Metadata

Mime Type
text/x-diff
Expires
Mon, Apr 6, 12:34 AM (6 d, 15 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18831722
Default Alt Text
(1 KB)

Event Timeline