chore(infra): migrate Redis to Valkey 9.0 and update related configs

This commit is contained in:
Stefan Mogeritsch 2026-02-01 17:55:49 +01:00
parent 6c8accb9b6
commit d9583252e8
3 changed files with 13 additions and 9 deletions

4
.env
View File

@ -26,8 +26,8 @@ POSTGRES_DB=pg-meldestelle-db
POSTGRES_PORT=5432:5432
POSTGRES_DB_URL=jdbc:postgresql://postgres:5432/pg-meldestelle-db
# --- REDIS ---
REDIS_IMAGE=redis:7.4-alpine
# --- VALKEY (formerly Redis) ---
VALKEY_IMAGE=valkey/valkey:9.0
REDIS_PASSWORD=redis-password
REDIS_PORT=6379:6379
REDIS_SERVER_HOSTNAME=redis

View File

@ -27,8 +27,8 @@ POSTGRES_USER=meldestelle
POSTGRES_PASSWORD=meldestelle
POSTGRES_DB=meldestelle
# --- REDIS ---
# Optional password for Redis; leave empty to disable authentication in dev
# --- VALKEY (formerly Redis) ---
# Optional password for Valkey/Redis; leave empty to disable authentication in dev
REDIS_PASSWORD=
# --- KEYCLOAK ---

View File

@ -33,20 +33,23 @@ services:
aliases:
- "postgres"
# --- CACHE: Redis ---
# --- CACHE: Valkey (formerly Redis) ---
redis:
image: "${REDIS_IMAGE:-redis:7.4-alpine}"
# Valkey 9.0 (User Request)
image: "${VALKEY_IMAGE:-valkey/valkey:9.0}"
container_name: "${PROJECT_NAME:-meldestelle}-redis"
restart: no
ports:
- "${REDIS_PORT:-6379:6379}"
volumes:
- "redis-data:/data"
- "./config/docker/redis/redis.conf:/usr/local/etc/redis/redis.conf:Z"
# Wir nutzen weiterhin die redis.conf, da Valkey kompatibel ist
- "./config/docker/redis/redis.conf:/etc/valkey/valkey.conf:Z"
profiles: [ "infra", "all" ]
command: [ "sh", "-lc", "exec redis-server /usr/local/etc/redis/redis.conf --protected-mode no ${REDIS_PASSWORD:+--requirepass $REDIS_PASSWORD}" ]
# 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}" ]
healthcheck:
test: [ "CMD-SHELL", "[ -z \"$REDIS_PASSWORD\" ] && redis-cli ping | grep PONG || redis-cli -a \"$REDIS_PASSWORD\" ping | grep PONG" ]
test: [ "CMD-SHELL", "[ -z \"$REDIS_PASSWORD\" ] && valkey-cli ping | grep PONG || valkey-cli -a \"$REDIS_PASSWORD\" ping | grep PONG" ]
interval: "5s"
timeout: "5s"
retries: "3"
@ -54,6 +57,7 @@ services:
meldestelle-network:
aliases:
- "redis"
- "valkey"
# --- SERVICE DISCOVERY: Consul ---
consul: