ЛР 2: Valkey как кэш сессий с обходом при сбое

This commit is contained in:
2026-11-03 04:06:04 +03:00
parent f4087c1672
commit 7b0a6aea9b
7 changed files with 119 additions and 9 deletions
+13
View File
@@ -17,6 +17,16 @@ services:
interval: 5s
timeout: 3s
retries: 10
valkey:
image: valkey/valkey:8.0.1-alpine
restart: unless-stopped
command: ["valkey-server", "--save", "", "--appendonly", "no", "--maxmemory", "64mb", "--maxmemory-policy", "allkeys-lru"]
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
api:
build: .
@@ -25,10 +35,13 @@ services:
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_started
environment:
APP_ENV: ${APP_ENV:-lab}
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
DATABASE_URL_FILE: /run/secrets/database_url
CACHE_URL: redis://valkey:6379/0
secrets:
- database_url
ports: