[+] Completed lab 2

This commit is contained in:
Антон Архипов
2026-11-16 16:01:24 +03:00
parent 65003b6119
commit f77e500ccf
46 changed files with 4532 additions and 45 deletions
+49
View File
@@ -0,0 +1,49 @@
x-app: &app
image: mtusi-messenger:lab2
pull_policy: never
environment:
APP_HOST: 0.0.0.0
APP_PORT: 8080
APP_ENV: ${APP_ENV:-lab}
LOG_LEVEL: ${LOG_LEVEL:-info}
DB_HOST: postgres
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
POSTGRES_USER: ${POSTGRES_USER:-messenger}
POSTGRES_DB: ${POSTGRES_DB:-messenger}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Run scripts/init-env.sh first}
services:
postgres:
image: postgres:15.18-bookworm
environment:
POSTGRES_USER: ${POSTGRES_USER:-messenger}
POSTGRES_DB: ${POSTGRES_DB:-messenger}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Run scripts/init-env.sh first}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U \"$$POSTGRES_USER\" -d \"$$POSTGRES_DB\""]
interval: 2s
timeout: 2s
retries: 20
migrate:
<<: *app
build: .
command: ["node", "dist/migrate.js"]
healthcheck:
disable: true
depends_on:
postgres:
condition: service_healthy
api:
<<: *app
ports:
- "127.0.0.1:${APP_BIND_PORT:-8080}:8080"
depends_on:
migrate:
condition: service_completed_successfully
volumes:
postgres_data: