feat: перенос core-логики 2 лабы

This commit is contained in:
Enterxx2
2026-10-19 19:16:19 +03:00
parent 0ab3a341aa
commit aa971fbd27
110 changed files with 5177 additions and 6 deletions
+92
View File
@@ -0,0 +1,92 @@
name: messenger-lab3
x-api: &api
build: .
image: mtusi-messenger:lab3
restart: unless-stopped
env_file:
- .env
environment: &api-network
DB_HOST: postgres
DB_PORT: "5432"
VALKEY_HOST: valkey
VALKEY_PORT: "6379"
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_started
networks:
- backend
- default
stop_grace_period: 10s
services:
postgres:
image: postgres:18.2-alpine3.22
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASS}
POSTGRES_DB: ${DB_NAME}
volumes:
- postgres_data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U \"$$POSTGRES_USER\" -d \"$$POSTGRES_DB\""]
interval: 2s
timeout: 3s
retries: 15
start_period: 10s
ports:
- "127.0.0.1:${DB_PORT}:5432"
networks:
- backend
- default
stop_grace_period: 30s
valkey:
image: valkey/valkey:8.1.4-alpine3.22
restart: unless-stopped
environment:
VALKEY_PASS: ${VALKEY_PASS}
command:
- valkey-server
- --requirepass
- ${VALKEY_PASS}
- --save
- ""
- --appendonly
- "no"
- --maxmemory
- 64mb
- --maxmemory-policy
- allkeys-lru
healthcheck:
test: ["CMD-SHELL", "valkey-cli --no-auth-warning -a \"$$VALKEY_PASS\" ping | grep -q PONG"]
interval: 2s
timeout: 3s
retries: 15
networks:
- backend
api:
<<: *api
ports:
- "127.0.0.1:${APP_PORT}:${APP_PORT}"
api-short-ttl:
<<: *api
profiles:
- expiry
environment:
<<: *api-network
SESSION_TTL_SECONDS: "2"
ports:
- "127.0.0.1:8081:${APP_PORT}"
networks:
backend:
internal: true
volumes:
postgres_data: