Разбить API на модули и перевести комментарии на русский

This commit is contained in:
celis
2026-10-29 22:26:25 +03:00
parent c4f9eb7648
commit e8ba028b89
29 changed files with 630 additions and 456 deletions
+6 -6
View File
@@ -1,5 +1,5 @@
# Client -> lb (HAProxy) -> api x N -> postgres (users, chats, messages, sessions, idempotency keys).
# Start: scripts/init-secrets.sh && docker compose --env-file .env up -d --build (see REPORT.md)
# Клиент → lb (HAProxy) → api × N → postgres (пользователи, чаты, сообщения, сессии, ключи идемпотентности).
# Запуск: scripts/init-secrets.sh && docker compose --env-file .env up -d --build (см. REPORT.md)
name: messenger-lab3
x-api: &api
@@ -35,7 +35,7 @@ services:
restart: unless-stopped
networks: [backend]
# One-shot: schema migrations run once before any replica starts (advisory lock guards manual reruns).
# Одноразовый сервис: миграции выполняются один раз до старта реплик (advisory lock защищает от ручного повтора).
migrate:
<<: *api
command: ["node", "src/main.ts", "migrate"]
@@ -58,14 +58,14 @@ services:
resources:
limits: { cpus: "${API_CPUS:-1}", memory: "${API_MEMORY:-256m}" }
stop_grace_period: 15s
restart: unless-stopped # a crashed replica comes back; `docker stop` keeps it stopped
restart: unless-stopped # упавшая реплика поднимается сама; после `docker stop` остаётся остановленной
lb:
image: haproxy:3.2.26-alpine
volumes: ["./infra/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro"]
ports:
- "127.0.0.1:${LB_PORT:-8080}:8080"
- "127.0.0.1:${LB_STATS_PORT:-8404}:8404" # HAProxy stats/metrics for the operator, not the API
- "127.0.0.1:${LB_STATS_PORT:-8404}:8404" # статистика HAProxy для оператора, это не API
depends_on:
api: { condition: service_healthy }
deploy:
@@ -76,7 +76,7 @@ services:
networks:
frontend: {}
backend: { internal: true } # api and postgres are unreachable from the host and have no egress
backend: { internal: true } # api и postgres недоступны с хоста и не имеют выхода наружу
volumes:
pgdata: {}