refactor code

This commit is contained in:
Матвей
2026-10-14 15:12:40 +03:00
parent 27cbf91b73
commit 6e7b8007ac
21 changed files with 86 additions and 515 deletions
+6 -19
View File
@@ -6,14 +6,12 @@ x-api: &api
APP_PORT: 8080
APP_ENV: lab3
DATABASE_URL_FILE: /run/secrets/database_url
CACHE_URL_FILE: /run/secrets/cache_url
CACHE_TTL_SECONDS: ${CACHE_TTL_SECONDS:-60}
CACHE_STAMPEDE_PROTECTION: ${CACHE_STAMPEDE_PROTECTION:-true}
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
IDEMPOTENCY_TTL_SECONDS: ${IDEMPOTENCY_TTL_SECONDS:-86400}
CURSOR_SECRET_FILE: /run/secrets/cursor_secret
secrets:
- database_url
- cache_url
- cursor_secret
depends_on:
migrate:
condition: service_completed_successfully
@@ -45,26 +43,16 @@ services:
retries: 12
start_period: 5s
redis:
image: redis:7.4.2-alpine
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec"]
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 12
start_period: 5s
migrate:
build:
context: .
command: ["/app/.venv/bin/python", "-m", "src.migrate"]
environment:
DATABASE_URL_FILE: /run/secrets/database_url
CURSOR_SECRET_FILE: /run/secrets/cursor_secret
secrets:
- database_url
- cursor_secret
depends_on:
postgres:
condition: service_healthy
@@ -99,9 +87,8 @@ secrets:
file: ./secrets/postgres_password
database_url:
file: ./secrets/database_url
cache_url:
file: ./secrets/cache_url
cursor_secret:
file: ./secrets/cursor_secret
volumes:
postgres_data:
redis_data: