kopia lustrzana https://github.com/kartoza/docker-postgis
107 wiersze
3.5 KiB
YAML
107 wiersze
3.5 KiB
YAML
|
|
version: '3.9'
|
|
|
|
volumes:
|
|
pg-master-data-dir:
|
|
pg-node-data-dir:
|
|
|
|
services:
|
|
pg-master:
|
|
image: 'kartoza/postgis:${TAG:-manual-build}'
|
|
restart: 'always'
|
|
# You can optionally mount to volume, to play with the persistence and
|
|
# observe how the node will behave after restarts.
|
|
volumes:
|
|
- pg-master-data-dir:/var/lib/postgresql
|
|
- ./tests:/tests
|
|
- ../utils:/lib/utils
|
|
environment:
|
|
# ALLOW_IP_RANGE option is used to specify additionals allowed domains
|
|
# in pg_hba.
|
|
# This range should allow nodes to connect to master
|
|
ALLOW_IP_RANGE: '0.0.0.0/0'
|
|
|
|
# We can specify optional credentials
|
|
POSTGRES_PASS: 'docker'
|
|
REPLICATION_USER: 'replicator'
|
|
REPLICATION_PASS: 'replicator'
|
|
REPLICATION: 'true'
|
|
RUN_AS_ROOT: false
|
|
# Setup master replication variables
|
|
#PG_MAX_WAL_SENDERS: 8
|
|
#PG_WAL_KEEP_SEGMENTS: 100
|
|
# You can expose the port to observe it in your local machine
|
|
ports:
|
|
- "7777:5432"
|
|
healthcheck:
|
|
interval: 60s
|
|
timeout: 30s
|
|
retries: 3
|
|
test: "pg_isready"
|
|
|
|
pg-node:
|
|
image: 'kartoza/postgis:${TAG:-manual-build}'
|
|
restart: 'always'
|
|
# You can optionally mount to volume, but we're not able to scale it
|
|
# in that case.
|
|
# The node will always destroy its database and copy from master at
|
|
# runtime
|
|
volumes:
|
|
- pg-node-data-dir:/var/lib/postgresql
|
|
- ./tests:/tests
|
|
- ../utils:/lib/utils
|
|
|
|
environment:
|
|
# ALLOW_IP_RANGE option is used to specify additionals allowed domains
|
|
# in pg_hba.
|
|
# Not really needed in nodes for the replication, but optionally can
|
|
# be put when nodes are needed to be a failover server when master
|
|
# is down. The IP Range are generally needed if other services wants to
|
|
# connect to this node
|
|
ALLOW_IP_RANGE: '0.0.0.0/0'
|
|
|
|
# REPLICATE_FROM options accepts domain-name or IP address
|
|
# with this in mind, you can also put docker service name, because it
|
|
# will be resolved as host name.
|
|
POSTGRES_PASS: 'docker'
|
|
REPLICATE_FROM: 'pg-master'
|
|
REPLICATION: 'true'
|
|
RUN_AS_ROOT: false
|
|
|
|
# REPLICATE_PORT will default to 5432 if not specified.
|
|
# REPLICATE_PORT: '5432'
|
|
# In the case where you need to replicate from outside service,
|
|
# you can put the server address and port here, as long as the target
|
|
# where configured as master, and replicable.
|
|
# REPLICATE_FROM: '192.168.1.8'
|
|
# REPLICATE_PORT: '7777'
|
|
|
|
# DESTROY_DATABASE_ON_RESTART will default to True if not specified.
|
|
# If specified other than True, it will prevent node from destroying
|
|
# database on restart
|
|
DESTROY_DATABASE_ON_RESTART: 'True'
|
|
|
|
# PROMOTE_MASTER Default empty.
|
|
# If specified with any value, then it will convert current node into
|
|
# a writable state. Useful if master is down and the current node needs
|
|
# to be promoted until manual recovery.
|
|
# PROMOTE_MASTER: 'True'
|
|
|
|
# For now we don't support different credentials for replication
|
|
# so we use the same credentials as master's superuser, or anything that
|
|
# have replication role.
|
|
REPLICATION_USER: 'replicator'
|
|
REPLICATION_PASS: 'replicator'
|
|
depends_on:
|
|
pg-master:
|
|
condition: service_healthy
|
|
# You can expose the port to observe it in your local machine
|
|
# For this sample, it was disabled by default to allow scaling test
|
|
ports:
|
|
- "7776:5432"
|
|
healthcheck:
|
|
interval: 60s
|
|
timeout: 30s
|
|
retries: 3
|
|
test: "pg_isready"
|