forked from mtusi2026/mtusi2026lab3
реализация 3 лабы
This commit is contained in:
+35
-6
@@ -1,5 +1,12 @@
|
||||
name: mtusi-lab3
|
||||
|
||||
x-application: &application
|
||||
image: mtusi-messenger:lab3
|
||||
build: .
|
||||
env_file: .env
|
||||
cpus: 1
|
||||
mem_limit: 256m
|
||||
|
||||
x-postgres: &postgres
|
||||
image: postgres:17.6-bookworm
|
||||
environment:
|
||||
@@ -33,19 +40,41 @@ services:
|
||||
retries: 30
|
||||
|
||||
api:
|
||||
image: mtusi-messenger:lab3
|
||||
build: .
|
||||
env_file: .env
|
||||
<<: *application
|
||||
deploy:
|
||||
replicas: ${API_REPLICAS:-2}
|
||||
environment:
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
||||
secrets: [database_url, cache_url]
|
||||
ports: ["127.0.0.1:${HOST_PORT:-8080}:8080"]
|
||||
cpus: 1
|
||||
mem_limit: 256m
|
||||
depends_on:
|
||||
postgres: {condition: service_healthy}
|
||||
valkey: {condition: service_healthy}
|
||||
migrate: {condition: service_completed_successfully}
|
||||
stop_grace_period: 8s
|
||||
|
||||
migrate:
|
||||
<<: *application
|
||||
command: ["python", "-m", "src.migrate"]
|
||||
secrets: [database_url]
|
||||
healthcheck:
|
||||
disable: true
|
||||
depends_on:
|
||||
postgres: {condition: service_healthy}
|
||||
|
||||
lb:
|
||||
image: haproxy:3.2.6-alpine
|
||||
ports: ["127.0.0.1:${HOST_PORT:-8080}:8080"]
|
||||
volumes: [./infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro]
|
||||
cpus: 0.5
|
||||
mem_limit: 64m
|
||||
depends_on:
|
||||
api: {condition: service_healthy}
|
||||
stop_grace_period: 10s
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8080/health/ready"]
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
retries: 3
|
||||
|
||||
postgres-restore:
|
||||
<<: *postgres
|
||||
|
||||
Reference in New Issue
Block a user