Релизованный минимум на 3, подготовка к написанию REPORT.md
This commit is contained in:
+53
-25
@@ -1,35 +1,63 @@
|
||||
services:
|
||||
api:
|
||||
build: .
|
||||
ports:
|
||||
- "8080:8080"
|
||||
postgres:
|
||||
image: postgres:16.4-alpine
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://messenger:messenger_pass@postgres:5432/messenger
|
||||
- SESSION_TTL_SECONDS=3600
|
||||
POSTGRES_USER: messenger
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-messenger_pass}
|
||||
POSTGRES_DB: messenger
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U messenger"]
|
||||
interval: 3s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
networks: [backend]
|
||||
|
||||
api-1:
|
||||
build: .
|
||||
environment:
|
||||
DATABASE_URL: postgresql://messenger:${POSTGRES_PASSWORD:-messenger_pass}@postgres:5432/messenger
|
||||
INSTANCE_ID: api-1
|
||||
SESSION_TTL_SECONDS: "3600"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health/ready"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 15s
|
||||
deploy:
|
||||
resources:
|
||||
limits: { cpus: "0.5", memory: 256M }
|
||||
networks: [backend]
|
||||
# порты наружу НЕ публикуем
|
||||
|
||||
postgres:
|
||||
image: postgres:16.1
|
||||
api-2:
|
||||
build: .
|
||||
environment:
|
||||
- POSTGRES_DB=messenger
|
||||
- POSTGRES_USER=messenger
|
||||
- POSTGRES_PASSWORD=messenger_pass
|
||||
DATABASE_URL: postgresql://messenger:${POSTGRES_PASSWORD:-messenger_pass}@postgres:5432/messenger
|
||||
INSTANCE_ID: api-2
|
||||
SESSION_TTL_SECONDS: "3600"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
stop_grace_period: 15s
|
||||
deploy:
|
||||
resources:
|
||||
limits: { cpus: "0.5", memory: 256M }
|
||||
networks: [backend]
|
||||
|
||||
lb:
|
||||
image: nginx:1.27-alpine
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U messenger"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
- ./nginx/lb.conf:/etc/nginx/nginx.conf:ro
|
||||
depends_on:
|
||||
- api-1
|
||||
- api-2
|
||||
networks: [backend]
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
pgdata:
|
||||
|
||||
networks:
|
||||
backend:
|
||||
Reference in New Issue
Block a user