--- kind: Service name: postgres count: 1 runtime: one_of: process command: /usr/lib/postgresql/16/bin/postgres -D /var/lib/postgresql/data ports: - name: pg port: 5432 restart: mode: service attempts: 5 delay: 10s update: strategy: blue-green min_healthy_time: 60s healthy_deadline: 10m service: name: postgres port: 5432 health: check_type: http interval: 15s timeout: 5s unhealthy_threshold: 3 volumes: - name: data type: host source: replicate:peer-b,peer-c target: /var/lib/postgresql/data read_only: false constraints: - node.role == "db" - node.cpus >= 4 - node.memory >= 8192 env: POSTGRES_DB: appdb POSTGRES_USER: orca PGDATA: /var/lib/postgresql/data --- # PostgreSQL Database service with a single replica, blue-green update strategy, and volume replication via Syncthing (replicate:peer-b,peer-c). The data volume is replicated to two peers for fault tolerance. Health check on port 5432. Constraints require DB-role nodes with >= 4 vCPUs and >= 8 GiB memory.