Skip to content

Instantly share code, notes, and snippets.

@webchi
Created December 19, 2018 07:24
Show Gist options
  • Save webchi/1af09633b5031068d0a423ac918d33b5 to your computer and use it in GitHub Desktop.
Save webchi/1af09633b5031068d0a423ac918d33b5 to your computer and use it in GitHub Desktop.
version: '3.5'
networks:
plannerix:
name: plannerix
external: true
services:
primary:
hostname: 'primary'
image: crunchydata/crunchy-postgres:centos7-9.6.11-2.2.0
environment:
- PGHOST=/tmp
- MAX_CONNECTIONS=10
- MAX_WAL_SENDERS=5
- PG_MODE=primary
- PG_PRIMARY_USER=primaryuser
- PG_PRIMARY_PASSWORD=fRqz3vxPpGWSaFSdSGmC
- PG_DATABASE=testdb
- PG_USER=sye1zhudcauyoei
- PG_PASSWORD=cUSC9f0FYSkT2iKWGdEjYXONcQVyYLrhrgpQIkFNCwQ1uFv7go4DU6vEo9iAYd
- PG_ROOT_PASSWORD=Pje5SXan7qHa9LFL3nmYCUBgwR6EHtF6K4qKnvfd
- PG_PRIMARY_PORT=5432
volumes:
- pg-primary-vol:/pgdata
ports:
- "5432"
networks:
- plannerix
deploy:
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 4
window: 300s
placement:
constraints:
- node.labels.type == db
- node.labels.db == primary
- node.labels.type != api
- node.role == worker
replica:
image: crunchydata/crunchy-postgres:centos7-9.6.11-2.2.0
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=fRqz3vxPpGWSaFSdSGmC
- PG_DATABASE=testdb
- PG_USER=testuser
- PG_PASSWORD=password
- PG_ROOT_PASSWORD=Pje5SXan7qHa9LFL3nmYCUBgwR6EHtF6K4qKnvfd
volumes:
- pg-replica-vol:/pgdata
ports:
- "5432"
networks:
- plannerix
deploy:
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 4
window: 300s
placement:
constraints:
- node.labels.type == db
- node.labels.type != primary
- node.role == worker
depends_on:
- pg-primary
volumes:
pg-primary-vol:
pg-replica-vol:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment