docker_old/swarm/postgresql/docker-compose.yml
2024-08-13 11:55:49 +02:00

77 lines
1.7 KiB
YAML

version: '3.3'
services:
primary:
hostname: 'primary'
image: crunchydata/crunchy-postgres:ubi8-15.2-0
secrets:
- postgres_primary
- postgres_password
- postgres_rootpw
environment:
- PGHOST=/tmp
- MAX_CONNECTIONS=10
- MAX_WAL_SENDERS=5
- PG_MODE=primary
- PG_PRIMARY_USER=primaryuser
- PG_PRIMARY_PASSWORD=postgres_primary
- PG_DATABASE=postgres_db
- PG_USER=admin
- PG_PASSWORD=postgres_password
- PG_ROOT_PASSWORD=postgres_rootpw
- PG_PRIMARY_PORT=5432
volumes:
- pg-primary-vol:/pgdata
ports:
- '5432'
networks:
- postgres
deploy:
placement:
constraints:
- node.labels.type == primary
- node.role == worker
replica:
image: crunchydata/crunchy-postgres:ubi8-15.2-0
secrets:
- postgres_primary
- postgres_password
- postgres_rootpw
environment:
- PGHOST=/tmp
- MAX_CONNECTIONS=10
- MAX_WAL_SENDERS=5
- PG_MODE=replica
- PG_PRIMARY_HOST=primary
- PG_PRIMARY_PORT=5432
- PG_PRIMARY_USER=primaryuser
- PG_PRIMARY_PASSWORD=postgres_primary
- PG_DATABASE=postgres_db
- PG_USER=admin
- PG_PASSWORD=postgres_password
- PG_ROOT_PASSWORD=postgres_rootpw
volumes:
- pg-replica-vol:/pgdata
ports:
- '5432'
networks:
- postgres
deploy:
placement:
constraints:
- node.labels.type != primary
- node.role == worker
networks:
postgres:
volumes:
pg-primary-vol:
pg-replica-vol:
secrets:
postgres_primary:
external: true
postgres_password:
external: true
postgres_rootpw:
external: true