83 lines
2.4 KiB
YAML
83 lines
2.4 KiB
YAML
# Локальный стенд лабораторной 2. Секреты только из .env, volumes не удаляются restart-скриптом.
|
|
name: messenger-lab2
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16.10-bookworm
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
command:
|
|
- postgres
|
|
- -c
|
|
- synchronous_commit=on
|
|
- -c
|
|
- max_connections=50
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
ports:
|
|
- "127.0.0.1:5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
start_period: 5s
|
|
restart: unless-stopped
|
|
|
|
redis:
|
|
image: redis:7.4.6-alpine
|
|
environment:
|
|
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
|
# exec нужен, чтобы SIGTERM пришёл самому Redis и он дописал AOF перед выходом.
|
|
command:
|
|
- sh
|
|
- -c
|
|
- exec redis-server --appendonly yes --appendfsync everysec --aof-use-rdb-preamble yes --dir /data --requirepass "$$REDIS_PASSWORD" --bind 0.0.0.0 --protected-mode yes
|
|
volumes:
|
|
- redisdata:/data
|
|
ports:
|
|
- "127.0.0.1:6379:6379"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "redis-cli --no-auth-warning -a \"$$REDIS_PASSWORD\" ping | grep -q PONG"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
start_period: 3s
|
|
restart: unless-stopped
|
|
|
|
api:
|
|
build: .
|
|
image: messenger-api:lab2
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
environment:
|
|
APP_HOST: 0.0.0.0
|
|
APP_PORT: "8080"
|
|
APP_ENV: lab
|
|
SHUTDOWN_TIMEOUT_SECONDS: ${SHUTDOWN_TIMEOUT_SECONDS:-8}
|
|
DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable
|
|
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/0
|
|
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
|
DB_MAX_CONNS: ${DB_MAX_CONNS:-10}
|
|
ARGON2_TIME: ${ARGON2_TIME:-2}
|
|
ARGON2_MEMORY_KIB: ${ARGON2_MEMORY_KIB:-19456}
|
|
ARGON2_THREADS: ${ARGON2_THREADS:-1}
|
|
ports:
|
|
- "127.0.0.1:8080:8080"
|
|
healthcheck:
|
|
test: ["CMD", "/messenger", "healthcheck"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
start_period: 10s
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
pgdata:
|
|
redisdata:
|