This postgres creates the PGDATA folder path with the permission of 750.
354
This readme file tells about the changes, and the functions about the different version of the docker images of the postgres which we have in the available repo.
*In this version of the docker image, we have introduced a new feature which is replication manager for the postgres deployed. *In simple terms, it means that you can create master-slaves of postgres which is termed as Replication in terms of Postgres.
docker run -d -p 6432:6432 \
-e POSTGRES_PASSWORD=${YOUR_PASSWORD} \
-e POSTGRES_USER=${YOUR USERNAME} \
-e POSTGRES_DB=${YOUR_DB_NAME} \
-e POSTGRESQL_MAX_CONNECTIONS=${YOUR_CONNECTION_COUNT} \
-v ${PATH_TO_YOUR_PGBOUNCER.INI}:/etc/pgbouncer/pgbouncer.ini \
-v ${PATH_TO_YOUR_USERLIST.TXT}:/etc/pgbouncer/userlist.txt \
--name postgres \
devopsnamasys/postgres:0.0.4
You can follow/use the following docker-compose file for initiating a postgres cluster with master and slave nodes.
version: '3.7'
services:
postgresql-master:
image: devopsnamasys/postgres:0.0.4
ports:
- '5400:6432'
volumes:
- './backups:/postgres/data/'
- './pgbouncer_confFiles/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini'
- './pgbouncer_confFiles/userlist.txt:/etc/pgbouncer/userlist.txt'
environment:
POSTGRESQL_REPLICATION_MODE: master
POSTGRESQL_REPLICATION_USER: repl_user
POSTGRESQL_REPLICATION_PASSWORD: repl_password
POSTGRESQL_USERNAME: postgres
POSTGRESQL_PASSWORD: root
POSTGRESQL_DATABASE: nuwebapp
ALLOW_EMPTY_PASSWORD: "yes"
BACKUPTIME: "12:15:00"
PGDATA: /postgres/data
POSTGRESQL_MAX_CONNECTIONS: 500
postgresql-slave1:
image: devopsnamasys/postgres:0.0.4
ports:
- '5401:6432'
depends_on:
- postgresql-master
environment:
POSTGRESQL_REPLICATION_MODE: slave
POSTGRESQL_REPLICATION_USER: repl_user
POSTGRESQL_REPLICATION_PASSWORD: repl_password
POSTGRESQL_MASTER_HOST: postgresql-master
POSTGRESQL_PASSWORD: root
POSTGRESQL_MASTER_PORT_NUMBER: "5432"
ALLOW_EMPTY_PASSWORD: "yes"
POSTGRESQL_MAX_CONNECTIONS: 500
container_name: postgres_slave_1
postgresql-slave2:
image: devopsnamasys/postgres:0.0.4
ports:
- '5402:6432'
depends_on:
- postgresql-master
environment:
POSTGRESQL_REPLICATION_MODE: slave
POSTGRESQL_REPLICATION_USER: repl_user
POSTGRESQL_REPLICATION_PASSWORD: repl_password
POSTGRESQL_MASTER_HOST: postgresql-master
POSTGRESQL_PASSWORD: root
POSTGRESQL_MASTER_PORT_NUMBER: "5432"
ALLOW_EMPTY_PASSWORD: "yes"
POSTGRESQL_MAX_CONNECTIONS: 500
container_name: postgres_slave_2
volumes:
backups:
In this version of the docker image we have created an inbuilt pgbouncer installed for the connection pooling . The service runs on 6432 port inside the docker container. And port forwarding can be used to access the functions of the pgbouncer on the exposed port outside the container. PgBouncer has default pgbouncer.ini and userlist.txt, which can be mounted with customized .ini file and userlist.txt.
docker run -d -e POSTGRES_PASSWORD=1234 \
-e BACKUPTIME="18:00:00" \
-e PGDATA=/postgres/data \
-v .$PWD/pgdata/data:/postgres/data \
-v $PWD/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini \
-v $PWD/userlist.txt:/etc/pgbouncer/userlist.txt \
devopsnamasys/postgres:0.0.3
In this version of the docker image we have created an inbuild function of the backup of the Postgres Databases. We introduced an environmental varibale called BACKUPFOLDER and BACKUPTIME.
docker run -d -e POSTGRES_PASSWORD=1234 -e BACKUPTIME="18:00:00" -v backup:/backups devopsnamasys/postgres:0.0.2
docker run -d -e POSTGRES_PASSWORD=1234 -v pgdata:${PGDATA} devopsnamasys/postgres:0.0.1
Content type
Image
Digest
Size
181.6 MB
Last updated
over 5 years ago
docker pull devopsnamasys/postgres:0.0.4