forked from mtusi2026/mtusi2026lab3
67 lines
1.6 KiB
YAML
67 lines
1.6 KiB
YAML
version: "3.8"
|
|
services:
|
|
api:
|
|
image: lab3-api:local
|
|
environment:
|
|
DATABASE_HOST: lab3data_postgres
|
|
DATABASE_NAME: messenger
|
|
DATABASE_USER: messenger
|
|
DATABASE_PASSWORD_FILE: /run/secrets/lab3_db_password
|
|
REDIS_URL: redis://lab3data_redis:6379/0
|
|
SESSION_TTL_SECONDS: "3600"
|
|
DB_POOL_SIZE: "8"
|
|
secrets: [lab3_db_password]
|
|
networks: [data]
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2).close()"]
|
|
interval: 2s
|
|
timeout: 3s
|
|
retries: 2
|
|
deploy:
|
|
replicas: 2
|
|
placement:
|
|
constraints: [node.labels.lab3_compute == true]
|
|
update_config:
|
|
parallelism: 1
|
|
delay: 3s
|
|
order: start-first
|
|
failure_action: rollback
|
|
rollback_config:
|
|
parallelism: 1
|
|
order: start-first
|
|
restart_policy:
|
|
condition: on-failure
|
|
resources:
|
|
limits:
|
|
cpus: "0.75"
|
|
memory: 256M
|
|
lb:
|
|
image: nginx:1.27.5-alpine
|
|
configs:
|
|
- source: lab3_nginx_conf
|
|
target: /etc/nginx/nginx.conf
|
|
networks: [data]
|
|
ports:
|
|
- target: 8080
|
|
published: 8080
|
|
protocol: tcp
|
|
mode: host
|
|
deploy:
|
|
replicas: 1
|
|
placement:
|
|
constraints: [node.labels.lab3_storage == true]
|
|
resources:
|
|
limits:
|
|
cpus: "0.5"
|
|
memory: 128M
|
|
networks:
|
|
data:
|
|
external: true
|
|
name: lab3data_data
|
|
secrets:
|
|
lab3_db_password:
|
|
external: true
|
|
configs:
|
|
lab3_nginx_conf:
|
|
external: true
|