forked from mtusi2026/mtusi2026lab2
89 lines
1.7 KiB
YAML
89 lines
1.7 KiB
YAML
name: messenger-lab2
|
|
|
|
x-api: &api
|
|
build: .
|
|
image: mtusi-messenger:lab2
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
DB_HOST: postgres
|
|
VALKEY_HOST: valkey
|
|
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
|
|
networks:
|
|
- backend
|
|
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:
|
|
DB_HOST: postgres
|
|
VALKEY_HOST: valkey
|
|
SESSION_TTL_SECONDS: "2"
|
|
ports:
|
|
- "127.0.0.1:8081:${APP_PORT}"
|
|
|
|
networks:
|
|
backend:
|
|
internal: true
|
|
|
|
volumes:
|
|
postgres_data:
|