195 lines
4.5 KiB
Plaintext
195 lines
4.5 KiB
Plaintext
# compose-config — 2026-11-06T11:00:55Z
|
|
name: messenger-lab3
|
|
services:
|
|
api-1:
|
|
build:
|
|
context: C:\All\projects\highload\mtusi2026lab3
|
|
dockerfile: Dockerfile
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
required: true
|
|
postgres:
|
|
condition: service_healthy
|
|
required: true
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: 0.5
|
|
memory: "268435456"
|
|
environment:
|
|
APP_HOST: 0.0.0.0
|
|
APP_PORT: "8080"
|
|
DATABASE_URL: postgresql+psycopg://messenger:secretpassword@postgres:5432/messenger
|
|
IDEMPOTENCY_TTL_SECONDS: "86400"
|
|
INSTANCE_ID: api-1
|
|
SESSION_TTL_SECONDS: "3600"
|
|
healthcheck:
|
|
test:
|
|
- CMD
|
|
- curl
|
|
- -fsS
|
|
- http://127.0.0.1:8080/health/ready
|
|
timeout: 2s
|
|
interval: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
image: messenger-lab3-api:local
|
|
networks:
|
|
backend: null
|
|
restart: unless-stopped
|
|
stop_grace_period: 15s
|
|
api-2:
|
|
build:
|
|
context: C:\All\projects\highload\mtusi2026lab3
|
|
dockerfile: Dockerfile
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
required: true
|
|
postgres:
|
|
condition: service_healthy
|
|
required: true
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: 0.5
|
|
memory: "268435456"
|
|
environment:
|
|
APP_HOST: 0.0.0.0
|
|
APP_PORT: "8080"
|
|
DATABASE_URL: postgresql+psycopg://messenger:secretpassword@postgres:5432/messenger
|
|
IDEMPOTENCY_TTL_SECONDS: "86400"
|
|
INSTANCE_ID: api-2
|
|
SESSION_TTL_SECONDS: "3600"
|
|
healthcheck:
|
|
test:
|
|
- CMD
|
|
- curl
|
|
- -fsS
|
|
- http://127.0.0.1:8080/health/ready
|
|
timeout: 2s
|
|
interval: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
image: messenger-lab3-api:local
|
|
networks:
|
|
backend: null
|
|
restart: unless-stopped
|
|
stop_grace_period: 15s
|
|
lb:
|
|
depends_on:
|
|
api-1:
|
|
condition: service_healthy
|
|
required: true
|
|
api-2:
|
|
condition: service_healthy
|
|
required: true
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: 0.5
|
|
memory: "134217728"
|
|
image: nginx:1.27.3-alpine
|
|
networks:
|
|
backend: null
|
|
ports:
|
|
- mode: ingress
|
|
target: 8080
|
|
published: "8080"
|
|
protocol: tcp
|
|
restart: unless-stopped
|
|
volumes:
|
|
- type: bind
|
|
source: C:\All\projects\highload\mtusi2026lab3\infra\nginx\nginx.conf
|
|
target: /etc/nginx/nginx.conf
|
|
read_only: true
|
|
bind:
|
|
create_host_path: true
|
|
migrate:
|
|
build:
|
|
context: C:\All\projects\highload\mtusi2026lab3
|
|
dockerfile: Dockerfile
|
|
command:
|
|
- alembic
|
|
- upgrade
|
|
- head
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
required: true
|
|
environment:
|
|
DATABASE_URL: postgresql+psycopg://messenger:secretpassword@postgres:5432/messenger
|
|
image: messenger-lab3-api:local
|
|
networks:
|
|
backend: null
|
|
restart: "no"
|
|
postgres:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: 1
|
|
memory: "536870912"
|
|
environment:
|
|
POSTGRES_DB: messenger
|
|
POSTGRES_PASSWORD: secretpassword
|
|
POSTGRES_USER: messenger
|
|
healthcheck:
|
|
test:
|
|
- CMD-SHELL
|
|
- pg_isready -U messenger -d messenger
|
|
timeout: 3s
|
|
interval: 5s
|
|
retries: 10
|
|
image: postgres:16.4-alpine
|
|
networks:
|
|
backend: null
|
|
restart: unless-stopped
|
|
volumes:
|
|
- type: volume
|
|
source: pgdata
|
|
target: /var/lib/postgresql/data
|
|
volume: {}
|
|
networks:
|
|
backend:
|
|
name: messenger-lab3_backend
|
|
driver: bridge
|
|
volumes:
|
|
pgdata:
|
|
name: messenger-lab3_pgdata
|
|
x-api-common:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
postgres:
|
|
condition: service_healthy
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "0.50"
|
|
memory: 256M
|
|
environment:
|
|
APP_HOST: 0.0.0.0
|
|
APP_PORT: "8080"
|
|
DATABASE_URL: postgresql+psycopg://messenger:secretpassword@postgres:5432/messenger
|
|
IDEMPOTENCY_TTL_SECONDS: "86400"
|
|
SESSION_TTL_SECONDS: "3600"
|
|
healthcheck:
|
|
interval: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
test:
|
|
- CMD
|
|
- curl
|
|
- -fsS
|
|
- http://127.0.0.1:8080/health/ready
|
|
timeout: 2s
|
|
image: messenger-lab3-api:local
|
|
networks:
|
|
- backend
|
|
restart: unless-stopped
|
|
stop_grace_period: 15s
|