Last active
December 27, 2024 09:53
-
-
Save krzysztofantczak/2ca713a5f36c13712dc6444b84bef964 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
version: '2' | |
services: | |
pg-1: | |
container_name: pg-1 | |
image: bitnami/postgresql-repmgr:14 | |
restart: always | |
ports: | |
- 5432 | |
volumes: | |
- pg_1_data:/bitnami/postgresql | |
- ./passwd:/etc/passwd:ro | |
environment: | |
- POSTGRESQL_POSTGRES_PASSWORD=adminpassword | |
- POSTGRESQL_USERNAME=customuser | |
- POSTGRESQL_PASSWORD=custompassword | |
- POSTGRESQL_DATABASE=grafana | |
- REPMGR_PASSWORD=repmgrpassword | |
- REPMGR_PRIMARY_HOST=pg-1 | |
- REPMGR_PARTNER_NODES=pg-1,pg-2,pg-3,pg-4 | |
- REPMGR_NODE_NAME=pg-1 | |
- REPMGR_NODE_NETWORK_NAME=pg-1 | |
pg-2: | |
container_name: pg-2 | |
image: bitnami/postgresql-repmgr:14 | |
restart: always | |
ports: | |
- 5432 | |
volumes: | |
- pg_2_data:/bitnami/postgresql | |
- ./passwd:/etc/passwd:ro | |
environment: | |
- POSTGRESQL_POSTGRES_PASSWORD=adminpassword | |
- POSTGRESQL_USERNAME=customuser | |
- POSTGRESQL_PASSWORD=custompassword | |
- POSTGRESQL_DATABASE=grafana | |
- REPMGR_PASSWORD=repmgrpassword | |
- REPMGR_PRIMARY_HOST=pg-1 | |
- REPMGR_PARTNER_NODES=pg-1,pg-2,pg-3,pg-4 | |
- REPMGR_NODE_NAME=pg-2 | |
- REPMGR_NODE_NETWORK_NAME=pg-2 | |
pg-3: | |
container_name: pg-3 | |
image: bitnami/postgresql-repmgr:14 | |
restart: always | |
ports: | |
- 5432 | |
volumes: | |
- pg_3_data:/bitnami/postgresql | |
- ./passwd:/etc/passwd:ro | |
environment: | |
- POSTGRESQL_POSTGRES_PASSWORD=adminpassword | |
- POSTGRESQL_USERNAME=customuser | |
- POSTGRESQL_PASSWORD=custompassword | |
- POSTGRESQL_DATABASE=grafana | |
- REPMGR_PASSWORD=repmgrpassword | |
- REPMGR_PRIMARY_HOST=pg-1 | |
- REPMGR_PARTNER_NODES=pg-1,pg-2,pg-3,pg-4 | |
- REPMGR_NODE_NAME=pg-3 | |
- REPMGR_NODE_NETWORK_NAME=pg-3 | |
pg-4: | |
container_name: pg-4 | |
image: bitnami/postgresql-repmgr:14 | |
restart: always | |
ports: | |
- 5432 | |
volumes: | |
- pg_4_data:/bitnami/postgresql | |
- ./passwd:/etc/passwd:ro | |
environment: | |
- POSTGRESQL_POSTGRES_PASSWORD=adminpassword | |
- POSTGRESQL_USERNAME=customuser | |
- POSTGRESQL_PASSWORD=custompassword | |
- POSTGRESQL_DATABASE=grafana | |
- REPMGR_PASSWORD=repmgrpassword | |
- REPMGR_PRIMARY_HOST=pg-1 | |
- REPMGR_PARTNER_NODES=pg-1,pg-2,pg-3,pg-4 | |
- REPMGR_NODE_NAME=pg-4 | |
- REPMGR_NODE_NETWORK_NAME=pg-4 | |
pgpool-1: | |
container_name: pg-pool-1 | |
image: bitnami/pgpool:4 | |
restart: always | |
environment: | |
- PGPOOL_BACKEND_NODES=0:pg-1:5432,1:pg-2:5432,2:pg-3:5432,3:pg-4:5432 | |
- PGPOOL_BACKEND_APPLICATION_NAMES=0:pg-1:5432,1:pg-2:5432,2:pg-3:5432,3:pg-4:5432 | |
- PGPOOL_SR_CHECK_USER=customuser | |
- PGPOOL_SR_CHECK_PASSWORD=custompassword | |
- PGPOOL_ENABLE_LDAP=no | |
- PGPOOL_POSTGRES_USERNAME=postgres | |
- PGPOOL_POSTGRES_PASSWORD=adminpassword | |
- PGPOOL_ADMIN_USERNAME=admin | |
- PGPOOL_ADMIN_PASSWORD=adminpassword | |
- PGPOOL_AUTO_FAILBACK=yes | |
- PGPOOL_WATCHDOG=on | |
- PGPOOL_WATCHDOG_HOST=pg-pool-1 | |
healthcheck: | |
test: ["CMD", "/opt/bitnami/scripts/pgpool/healthcheck.sh"] | |
interval: 10s | |
timeout: 5s | |
retries: 5 | |
pgpool-2: | |
container_name: pg-pool-2 | |
image: bitnami/pgpool:4 | |
restart: always | |
environment: | |
- PGPOOL_BACKEND_NODES=0:pg-1:5432,1:pg-2:5432,2:pg-3:5432,3:pg-4:5432 | |
- PGPOOL_BACKEND_APPLICATION_NAMES=0:pg-1:5432,1:pg-2:5432,2:pg-3:5432,3:pg-4:5432 | |
- PGPOOL_SR_CHECK_USER=customuser | |
- PGPOOL_SR_CHECK_PASSWORD=custompassword | |
- PGPOOL_ENABLE_LDAP=no | |
- PGPOOL_POSTGRES_USERNAME=postgres | |
- PGPOOL_POSTGRES_PASSWORD=adminpassword | |
- PGPOOL_ADMIN_USERNAME=admin | |
- PGPOOL_ADMIN_PASSWORD=adminpassword | |
- PGPOOL_AUTO_FAILBACK=yes | |
- PGPOOL_WATCHDOG=on | |
- PGPOOL_WATCHDOG_HOST=pg-pool-2 | |
healthcheck: | |
test: ["CMD", "/opt/bitnami/scripts/pgpool/healthcheck.sh"] | |
interval: 10s | |
timeout: 5s | |
retries: 5 | |
pgpool-3: | |
container_name: pg-pool-3 | |
image: bitnami/pgpool:4 | |
restart: always | |
environment: | |
- PGPOOL_BACKEND_NODES=0:pg-1:5432,1:pg-2:5432,2:pg-3:5432,3:pg-4:5432 | |
- PGPOOL_BACKEND_APPLICATION_NAMES=0:pg-1:5432,1:pg-2:5432,2:pg-3:5432,3:pg-4:5432 | |
- PGPOOL_SR_CHECK_USER=customuser | |
- PGPOOL_SR_CHECK_PASSWORD=custompassword | |
- PGPOOL_ENABLE_LDAP=no | |
- PGPOOL_POSTGRES_USERNAME=postgres | |
- PGPOOL_POSTGRES_PASSWORD=adminpassword | |
- PGPOOL_ADMIN_USERNAME=admin | |
- PGPOOL_ADMIN_PASSWORD=adminpassword | |
- PGPOOL_AUTO_FAILBACK=yes | |
- PGPOOL_WATCHDOG=on | |
- PGPOOL_WATCHDOG_HOST=pg-pool-3 | |
healthcheck: | |
test: ["CMD", "/opt/bitnami/scripts/pgpool/healthcheck.sh"] | |
interval: 10s | |
timeout: 5s | |
retries: 5 | |
haproxy: | |
container_name: haproxy | |
image: haproxy:latest | |
restart: always | |
ports: | |
- "5432:5432" | |
environment: | |
- BACKEND_NODES=pg-pool-1:5432,pg-pool-2:5432,pg-pool-3:5432 | |
volumes: | |
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro | |
grafana: | |
container_name: grafana | |
image: grafana/grafana:latest | |
user: "0:0" | |
environment: | |
GF_DATABASE_TYPE: postgres | |
GF_DATABASE_HOST: haproxy:5432 | |
GF_DATABASE_NAME: grafana | |
GF_DATABASE_USER: postgres | |
GF_DATABASE_PASSWORD: adminpassword | |
GF_DATABASE_SSL_MODE: disable | |
restart: unless-stopped | |
ports: | |
- 3111:3000 | |
volumes: | |
pg_1_data: | |
driver: local | |
pg_2_data: | |
driver: local | |
pg_3_data: | |
driver: local | |
pg_4_data: | |
driver: local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment