forked from mtusi2026/mtusi2026lab3
61 lines
1.3 KiB
YAML
61 lines
1.3 KiB
YAML
version: "3.9"
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16.4-bookworm
|
|
environment:
|
|
POSTGRES_DB: ${DATABASE_NAME:-messenger}
|
|
POSTGRES_USER: ${DATABASE_USER:-messenger}
|
|
POSTGRES_PASSWORD: ${DATABASE_PASSWORD:?DATABASE_PASSWORD is required}
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 30
|
|
networks: [backend]
|
|
deploy:
|
|
replicas: 1
|
|
placement:
|
|
constraints:
|
|
- node.labels.hla.state == true
|
|
restart_policy:
|
|
condition: on-failure
|
|
resources:
|
|
limits:
|
|
cpus: "1.00"
|
|
memory: 768M
|
|
|
|
redis:
|
|
image: redis:7.4-bookworm
|
|
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec"]
|
|
volumes:
|
|
- redis-data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 2s
|
|
timeout: 2s
|
|
retries: 30
|
|
networks: [backend]
|
|
deploy:
|
|
replicas: 1
|
|
placement:
|
|
constraints:
|
|
- node.labels.hla.state == true
|
|
restart_policy:
|
|
condition: on-failure
|
|
resources:
|
|
limits:
|
|
cpus: "0.25"
|
|
memory: 256M
|
|
|
|
networks:
|
|
backend:
|
|
driver: overlay
|
|
attachable: true
|
|
|
|
volumes:
|
|
postgres-data:
|
|
redis-data:
|