Created
September 21, 2017 15:35
-
-
Save arturgspb/b90bacb61c9f3bbaa470f013e9ba5bb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```xml | |
version: '3' | |
# docker network create --driver overlay cluster | |
networks: | |
cluster: | |
external: true | |
services: | |
pgmaster: | |
image: paunin/postdock-pgsql | |
environment: | |
PARTNER_NODES: "pgmaster,pgslave1,pgslave3" | |
NODE_ID: 1 # Integer number of node | |
NODE_NAME: node1 # Node name | |
CLUSTER_NODE_NETWORK_NAME: pgmaster # (default: hostname of the node) | |
NODE_PRIORITY: 100 # (default: 100) | |
SSH_ENABLE: 1 | |
#database we want to use for application | |
POSTGRES_PASSWORD: monkey_pass | |
POSTGRES_USER: monkey_user | |
POSTGRES_DB: monkey_db | |
CLEAN_OVER_REWIND: 0 | |
CONFIGS: "listen_addresses:'*',max_replication_slots:5" | |
# in format variable1:value1[,variable2:value2[,...]] | |
# used for pgpool.conf file | |
#defaults: | |
CLUSTER_NAME: pg_cluster # default is pg_cluster | |
REPLICATION_DB: replication_db # default is replication_db | |
REPLICATION_USER: replication_user # default is replication_user | |
REPLICATION_PASSWORD: replication_pass # default is replication_pass | |
volumes: | |
- pgmaster:/var/lib/postgresql/data | |
networks: | |
cluster: | |
aliases: | |
- pgmaster | |
pgslave1: | |
image: paunin/postdock-pgsql | |
environment: | |
PARTNER_NODES: "pgmaster,pgslave1,pgslave3" | |
REPLICATION_PRIMARY_HOST: pgmaster | |
NODE_ID: 2 | |
NODE_NAME: node2 | |
CLUSTER_NODE_NETWORK_NAME: pgslave1 # (default: hostname of the node) | |
CLEAN_OVER_REWIND: 1 | |
CONFIGS: "max_replication_slots:10" #some overrides | |
volumes: | |
- pgslave1:/var/lib/postgresql/data | |
networks: | |
cluster: | |
aliases: | |
- pgslave1 | |
backup: | |
image: paunin/postdock-barman | |
environment: | |
REPLICATION_USER: replication_user # default is replication_user | |
REPLICATION_PASSWORD: replication_pass # default is replication_pass | |
REPLICATION_HOST: pgmaster | |
POSTGRES_PASSWORD: monkey_pass | |
POSTGRES_USER: monkey_user | |
POSTGRES_DB: monkey_db | |
SSH_ENABLE: 1 | |
BACKUP_SCHEDULE: "*/30 */5 * * *" | |
volumes: | |
- backup:/var/backups | |
networks: | |
cluster: | |
aliases: | |
- backup | |
pgpool: | |
image: paunin/postdock-pgpool | |
environment: | |
PCP_USER: pcp_user | |
PCP_PASSWORD: pcp_pass | |
WAIT_BACKEND_TIMEOUT: 60 | |
CHECK_USER: monkey_user | |
CHECK_PASSWORD: monkey_pass | |
CHECK_PGCONNECT_TIMEOUT: 1 #timout for checking if primary node is healthy | |
SSH_ENABLE: 1 | |
DB_USERS: monkey_user:monkey_pass # in format user:password[,user:password[...]] | |
BACKENDS: "0:pgmaster:5432:1:/var/lib/postgresql/data:ALLOW_TO_FAILOVER,1:pgslave1::::" #,4:pgslaveDOES_NOT_EXIST:::: | |
# in format num:host:port:weight:data_directory:flag[,...] | |
# defaults: | |
# port: 5432 | |
# weight: 1 | |
# data_directory: /var/lib/postgresql/data | |
# flag: ALLOW_TO_FAILOVER | |
REQUIRE_MIN_BACKENDS: 1 # minimal number of backends to start pgpool (some might be unreachable) | |
CONFIGS: "num_init_children:250,max_pool:4" | |
# in format variable1:value1[,variable2:value2[,...]] | |
# used for pgpool.conf file | |
ports: | |
- 5430:5432 | |
- 9898:9898 # PCP | |
networks: | |
cluster: | |
aliases: | |
- pgpool | |
volumes: | |
pgmaster: | |
pgslave1: | |
backup: | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment