level 4: redis cache etc

This commit is contained in:
2026-10-26 17:50:20 +03:00
parent 9d3de3b2d9
commit 175a8d8bfd
14 changed files with 686 additions and 78 deletions
+16 -1
View File
@@ -1,4 +1,5 @@
# Local lab2 grade-3 stand. Secrets come from .env, which is not committed.
# Local stand. Secrets come from .env, which is not committed.
# PostgreSQL is the source of truth. Redis caches session lookups and has no volume.
services:
postgres:
image: postgres:16.10-alpine
@@ -17,6 +18,17 @@ services:
- "127.0.0.1:5432:5432"
restart: unless-stopped
redis:
image: redis:7.4.11-alpine
ports:
- "127.0.0.1:6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 2s
timeout: 3s
retries: 30
restart: unless-stopped
api:
build:
context: .
@@ -29,11 +41,14 @@ services:
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
SHUTDOWN_TIMEOUT_SECONDS: ${SHUTDOWN_TIMEOUT_SECONDS:-5}
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
REDIS_URL: redis://redis:6379/0
ports:
- "127.0.0.1:8080:8080"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test:
- CMD