kopia lustrzana https://github.com/kartoza/docker-postgis
93 wiersze
3.2 KiB
YAML
93 wiersze
3.2 KiB
YAML
|
|
version: '2.1'
|
|
|
|
volumes:
|
|
pg-master-data-dir:
|
|
pg-slave-data-dir:
|
|
|
|
|
|
services:
|
|
pg-master:
|
|
image: 'kartoza/postgis:13.0'
|
|
restart: 'always'
|
|
# You can optionally mount to volume, to play with the persistence and
|
|
# observe how the slave will behave after restarts.
|
|
volumes:
|
|
- pg-master-data-dir:/var/lib/postgresql
|
|
- ./tests:/tests
|
|
environment:
|
|
# ALLOW_IP_RANGE option is used to specify additionals allowed domains
|
|
# in pg_hba.
|
|
# This range should allow slaves to connect to master
|
|
ALLOW_IP_RANGE: '0.0.0.0/0'
|
|
|
|
# We can specify optional credentials
|
|
REPLICATION_USER: 'replicator'
|
|
REPLICATION_PASS: 'replicator'
|
|
REPLICATION: 'true'
|
|
# 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:
|
|
test: "exit 0"
|
|
|
|
pg-slave:
|
|
image: 'kartoza/postgis:13.0'
|
|
restart: 'always'
|
|
# You can optionally mount to volume, but we're not able to scale it
|
|
# in that case.
|
|
# The slave will always destroy its database and copy from master at
|
|
# runtime
|
|
volumes:
|
|
- pg-slave-data-dir:/var/lib/postgresql
|
|
- ./tests:/tests
|
|
|
|
environment:
|
|
# ALLOW_IP_RANGE option is used to specify additionals allowed domains
|
|
# in pg_hba.
|
|
# Not really needed in slaves for the replication, but optionally can
|
|
# be put when slaves 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 slave
|
|
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.
|
|
REPLICATE_FROM: 'pg-master'
|
|
REPLICATION: 'true'
|
|
|
|
# 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 slave from destroying
|
|
# database on restart
|
|
DESTROY_DATABASE_ON_RESTART: 'True'
|
|
|
|
# PROMOTE_MASTER Default empty.
|
|
# If specified with any value, then it will convert current slave into
|
|
# a writable state. Useful if master is down and the current slave 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" |