Add PGPool and Repr Manager for Postgres in Docker-compose
This commit is contained in:
+53
-5
@@ -2,7 +2,7 @@ version: "3.7"
|
||||
|
||||
services:
|
||||
caddy:
|
||||
image: caddy:2.9-alpine
|
||||
image: docker.io/caddy/caddy:2.9-alpine
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
@@ -30,10 +30,58 @@ services:
|
||||
links:
|
||||
- "postgres"
|
||||
|
||||
postgres:
|
||||
container_name: "postgres"
|
||||
image: postgres
|
||||
restart: unless-stopped
|
||||
pg-0:
|
||||
image: docker.io/bitnami/postgresql-repmgr:14
|
||||
ports:
|
||||
- 5432
|
||||
volumes:
|
||||
- pg_0_data:/bitnami/postgresql
|
||||
environment:
|
||||
- POSTGRESQL_POSTGRES_PASSWORD=${POSTGRESQL_ADMIN_PASSWD:-password}
|
||||
- POSTGRESQL_USERNAME=${POSTGRESQL_USERNAME:-user}
|
||||
- POSTGRESQL_PASSWORD=${POSTGRESQL_PASSWORD:-passwd}
|
||||
- POSTGRESQL_DATABASE=${POSTGRESQL_DATABASE:-customdatabase}
|
||||
- REPMGR_PASSWORD=${REPMGR_PASSWORD:-repmgrpassword}
|
||||
- REPMGR_PRIMARY_HOST=pg-0
|
||||
- REPMGR_PARTNER_NODES=pg-0,pg-1
|
||||
- REPMGR_NODE_NAME=pg-0
|
||||
- REPMGR_NODE_NETWORK_NAME=pg-0
|
||||
|
||||
pg-1:
|
||||
image: docker.io/bitnami/postgresql-repmgr:14
|
||||
ports:
|
||||
- 5432
|
||||
volumes:
|
||||
- pg_1_data:/bitnami/postgresql
|
||||
environment:
|
||||
- POSTGRESQL_POSTGRES_PASSWORD=${POSTGRESQL_ADMIN_PASSWD:-password}
|
||||
- POSTGRESQL_USERNAME=${POSTGRESQL_USERNAME:-user}
|
||||
- POSTGRESQL_PASSWORD=${POSTGRESQL_PASSWORD:-passwd}
|
||||
- POSTGRESQL_DATABASE=${POSTGRESQL_DATABASE:-customdatabase}
|
||||
- REPMGR_PASSWORD=${REPMGR_PASSWORD:-repmgrpassword}
|
||||
- REPMGR_PRIMARY_HOST=pg-0
|
||||
- REPMGR_PARTNER_NODES=pg-0,pg-1
|
||||
- REPMGR_NODE_NAME=pg-1
|
||||
- REPMGR_NODE_NETWORK_NAME=pg-1
|
||||
|
||||
pgpool:
|
||||
image: docker.io/bitnami/pgpool:4
|
||||
ports:
|
||||
- 5432:5432
|
||||
environment:
|
||||
- PGPOOL_BACKEND_NODES=0:pg-0:5432,1:pg-1:5432
|
||||
- PGPOOL_SR_CHECK_USER=${POSTGRESQL_USERNAME:-user}
|
||||
- PGPOOL_SR_CHECK_PASSWORD=${POSTGRESQL_PASSWORD:-passwd}
|
||||
- PGPOOL_ENABLE_LDAP=no
|
||||
- PGPOOL_POSTGRES_USERNAME=${PGPOOL_POSTGRES_USERNAME}
|
||||
- PGPOOL_POSTGRES_PASSWORD=${PGPOOL_POSTGRES_PASSWORD:-password}
|
||||
- PGPOOL_ADMIN_USERNAME=${PGPOOL_ADMIN_USERNAME:-admin}
|
||||
- PGPOOL_ADMIN_PASSWORD=${REPMGR_PASSWORD:-adminpassword}
|
||||
healthcheck:
|
||||
test: ["CMD", "/opt/bitnami/scripts/pgpool/healthcheck.sh"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
caddy_data:
|
||||
|
||||
Reference in New Issue
Block a user