Image for PostgreSQL + PostGIS + WAL-G + pgBouncer
10K+
This image builds upon the stock PostGIS Image and adds WAL-G and pgBouncer
Only PostgreSQL 12 and greater will be supported. This is due to the removal of recovery.conf with respective config parameters added to postgresql.conf and use the use of standby.signal.
POSTGRES_RESTORE (default is an empty string) if value is set (not empty string), container is instructed to to download the latest base backup with WAL-G$PGDATA/standby.signal exists. This signals that this PostgreSQL instance is a standby serverPOSTGRES_PRIMARY_CONNINFO (default is an empty string) a valid PostgreSQL connection string PostgreSQL documentation. Must be provided if POSTGRES_IS_STANDBY is set so that standby PostgreSQL instance can connect to master (or upstream) PostgreSQL instancePGBOUNCER_LOGFILE (default /var/log/postgresql/pgbouncer.log) path to pgBouncer log filePGBOUNCER_PIDFILE (default /var/run/postgresql/pgbouncer.pid) path to pgBouncer pid filePGBOUNCER_LISTEN_ADDR (default *) IP address to listen onPGBOUNCER_LISTEN_PORT (default 6432) IP Port to listen onPGBOUNCER_CLIENT_TLS_SSLMODE (default allow) allow clients to use SSL when connecting to pgBouncer?PGBOUNCER_CLIENT_TLS_KEY_FILE (default /etc/ssl/private/pgplus.key autogenerated per container creation) SSL private key to use when interacting with clientsPGBOUNCER_CLIENT_TLS_CERT_FILE (default /etc/ssl/certs/pgplus.pem autogenerated per container creation) SSL certificate to provide to clientsPGBOUNCER_SERVER_TLS_SSLMODE (default allow) allow connections to PostgreSQL server to use SSL?PGBOUNCER_AUTH_TYPE (default md5) authentication typePGBOUNCER_POOL_MODE (default session) connection pooling modePGBOUNCER_MAX_CLIENT_CONN (default 100) maximum number of client connectionsPGBOUNCER_DEFAULT_POOL_SIZE (default 20) default number of client connections per poolPGBOUNCER_MIN_POOL_SIZE (default 0) minimum number of client connections per poolPGBOUNCER_RESERVE_POOL_SIZE (default 0) number of connections in the reserve poolPGBOUNCER_RESERVE_POOL_TIMEOUT (default 5) number of seconds where a client is waiting for a connection before a connection from the reserve pool is providedPGBOUNCER_MAX_DB_CONNECTIONS (default 0) maximum number of connections allowed per databasePGBOUNCER_MAX_USER_CONNECTIONS (default 0) maximum number of connections allowed per userComplete details for pgBouncer config parameters can be found in the pgBouncer documention
These are probably the most important variables to set...
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_ENDPOINTAdditional WAL-G config parameters can be found in the WAL-G documentation
To launch a container from the image, an example workflow may be:
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY with read/write priviges available. For this example:bucket = mybucket
AWS_ACCESS_KEY_ID = myaccesskey
AWS_SECRET_ACCESS_KEY = mysecretkey
AWS_ENDPOINT = https://sfo2.digitaloceanspaces.com/
WALG_S3_PREFIX = s3://mybucket/my/custom/prefix/
PGBOUNCER_POOL_MODE = transaction
docker network create -d bridge --subnet 10.100.0.0/24 --gateway 10.100.0.1 mybridge
docker run \
--name 1.db \
--network=mybridge
-p 5432:5432 \
-p 6432:6432 \
-e POSTGRES_PRIMARY_CONNINFO="host=1.db port=5432 user=postgres password=mypassword" \
-e POSTGRES_PASSWORD=mypassword \
-e AWS_ACCESS_KEY_ID=myaccesskey \
-e AWS_SECRET_ACCESS_KEY=mysecretkey \
-e AWS_ENDPOINT=https://sfo2.digitaloceanspaces.com/ \
-e WALG_S3_PREFIX=s3://mybucket/my/custom/prefix \
-d dustymugs/pgplus:12-3.0
docker exec 1.db gosu postgres wal-g backup-push /var/lib/postgresql/data
Replace /var/lib/postgresql/data if you are not using the default path for $PGDATA
docker run \
--name 2.db \
--network=mybridge \
-p 5433:5432 \
-p 6433:6432 \
-e POSTGRES_RESTORE=1 \
-e POSTGRES_IS_STANDBY=1 \
-e POSTGRES_PRIMARY_CONNINFO="host=1.db port=5432 user=postgres password=mypassword" \
-e POSTGRES_PASSWORD=mypassword \
-e AWS_ACCESS_KEY_ID=myaccesskey \
-e AWS_SECRET_ACCESS_KEY=mysecretkey \
-e AWS_ENDPOINT=https://sfo2.digitaloceanspaces.com/ \
-e WALG_S3_PREFIX=s3://mybucket/my/custom/prefix \
-d dustymugs/pgplus:12-3.0
The only changes here are:
--name 2.db)-p 5433:5432 and -p 6433:6432)-e POSTGRES_RESTORE=1 to a non-empty value-e POSTGRES_IS_STANDBY=1 to a non-empty valuedocker exec 1.db gosu psql -U postgres -c "SELECT * FROM pg_stat_replication"
We expect one row in the query resultset
Content type
Image
Digest
Size
199.2 MB
Last updated
over 6 years ago
docker pull dustymugs/pgplus