lab3: complete lab with scaling track 1 and failover evidence

This commit is contained in:
2026-11-09 13:19:21 +03:00
parent 0ab3a341aa
commit 631a852746
13 changed files with 690 additions and 24 deletions
+54
View File
@@ -0,0 +1,54 @@
services:
db:
image: postgres:16-alpine
environment:
POSTGRES_DB: messenger
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secret
volumes:
- pgdata:/var/lib/postgresql/data
- ./migrations:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d messenger"]
interval: 5s
retries: 5
redis:
image: valkey/valkey:7-alpine
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 5s
api:
build: .
environment:
- DB_HOST=db
- DB_USER=postgres
- DB_PASSWORD=secret
- DB_NAME=messenger
- REDIS_HOST=redis
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
deploy:
resources:
limits:
cpus: '0.50'
memory: 256M
lb:
image: nginx:1.25-alpine
ports:
- "8080:8080"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api
volumes:
pgdata:
redisdata: