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_PORT=5432:5432
POSTGRES_DB_URL=jdbc:postgresql://postgres:5432/pg-meldestelle-db POSTGRES_DB_URL=jdbc:postgresql://postgres:5432/pg-meldestelle-db
# --- REDIS --- # --- VALKEY (formerly Redis) ---
REDIS_IMAGE=redis:7.4-alpine VALKEY_IMAGE=valkey/valkey:9.0
REDIS_PASSWORD=redis-password REDIS_PASSWORD=redis-password
REDIS_PORT=6379:6379 REDIS_PORT=6379:6379
REDIS_SERVER_HOSTNAME=redis REDIS_SERVER_HOSTNAME=redis

View File

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

View File

@ -33,20 +33,23 @@ services:
aliases: aliases:
- "postgres" - "postgres"
# --- CACHE: Redis --- # --- CACHE: Valkey (formerly Redis) ---
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" container_name: "${PROJECT_NAME:-meldestelle}-redis"
restart: no restart: no
ports: ports:
- "${REDIS_PORT:-6379:6379}" - "${REDIS_PORT:-6379:6379}"
volumes: volumes:
- "redis-data:/data" - "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" ] 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: 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" interval: "5s"
timeout: "5s" timeout: "5s"
retries: "3" retries: "3"
@ -54,6 +57,7 @@ services:
meldestelle-network: meldestelle-network:
aliases: aliases:
- "redis" - "redis"
- "valkey"
# --- SERVICE DISCOVERY: Consul --- # --- SERVICE DISCOVERY: Consul ---
consul: consul: