refactor: migrate Redis cache implementation to Valkey with enhanced configurability
Replaced Redis with Valkey as the caching backend across infrastructure and application modules. Updated configurations, templates, and health checks to reflect Valkey-specific parameters. Improved compatibility with enhanced configurability, including max memory and memory eviction policy settings.
This commit is contained in:
+20
-12
@@ -44,29 +44,37 @@ services:
|
||||
- "postgres"
|
||||
|
||||
# --- CACHE: Valkey (formerly Redis) ---
|
||||
redis:
|
||||
valkey:
|
||||
# Valkey 9.0 (User Request)
|
||||
image: "${VALKEY_IMAGE:-valkey/valkey:9.0}"
|
||||
container_name: "${PROJECT_NAME:-meldestelle}-redis"
|
||||
restart: no
|
||||
image: "${VALKEY_IMAGE:-valkey/valkey:9-alpine}"
|
||||
container_name: "${PROJECT_NAME:-meldestelle}-valkey"
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${REDIS_PORT:-6379:6379}"
|
||||
- "${VALKEY_PORT:-6379:6379}"
|
||||
volumes:
|
||||
- "redis-data:/data"
|
||||
# Wir nutzen weiterhin die redis.conf, da Valkey kompatibel ist
|
||||
- "./config/docker/redis/redis.conf:/etc/valkey/valkey.conf:Z"
|
||||
- "valkey-data:/data"
|
||||
# Wir nutzen weiterhin die valkey.conf, da Valkey kompatibel ist
|
||||
- "./config/docker/valkey/valkey.conf:/etc/valkey/valkey.conf:Z"
|
||||
profiles: [ "infra", "all" ]
|
||||
# Anpassung der Binaries auf valkey-server und valkey-cli
|
||||
command: [ "sh", "-lc", "exec valkey-server /etc/valkey/valkey.conf --protected-mode no ${REDIS_PASSWORD:+--requirepass $REDIS_PASSWORD}" ]
|
||||
# command: [ "sh", "-lc", "exec valkey-server /etc/valkey/valkey.conf --protected-mode no ${VALKEY_PASSWORD:+--requirepass $VALKEY_PASSWORD}" ]
|
||||
command:
|
||||
- "sh"
|
||||
- "-lc"
|
||||
- |
|
||||
exec valkey-server /etc/valkey/valkey.conf \
|
||||
--protected-mode no \
|
||||
--maxmemory ${VALKEY_MAXMEMORY:-256mb} \
|
||||
--maxmemory-policy ${VALKEY_POLICY:-allkeys-lru} \
|
||||
${VALKEY_PASSWORD:+--requirepass $VALKEY_PASSWORD}
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "[ -z \"$REDIS_PASSWORD\" ] && valkey-cli ping | grep PONG || valkey-cli -a \"$REDIS_PASSWORD\" ping | grep PONG" ]
|
||||
test: [ "CMD-SHELL", "[ -z \"$VALKEY_PASSWORD\" ] && valkey-cli ping | grep PONG || valkey-cli -a \"$VALKEY_PASSWORD\" ping | grep PONG" ]
|
||||
interval: "5s"
|
||||
timeout: "5s"
|
||||
retries: "3"
|
||||
networks:
|
||||
meldestelle-network:
|
||||
aliases:
|
||||
- "redis"
|
||||
- "valkey"
|
||||
|
||||
# --- SERVICE DISCOVERY: Consul ---
|
||||
@@ -161,7 +169,7 @@ services:
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
redis-data:
|
||||
valkey-data:
|
||||
mailpit-data:
|
||||
|
||||
networks:
|
||||
|
||||
Reference in New Issue
Block a user