diff --git a/.dockerignore b/.dockerignore index b75be0a..8756946 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,5 @@ /.git/ -/.circleci/ +/.github/ LICENSE VERSION README.md diff --git a/Dockerfile b/Dockerfile index e14b295..dfa2f33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ -FROM ubuntu:bionic-20200403 AS add-apt-repositories +FROM ubuntu:jammy-20230605 AS add-apt-repositories RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y wget gnupg \ && wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ - && echo 'deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main' >> /etc/apt/sources.list + && echo 'deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main' >> /etc/apt/sources.list -FROM ubuntu:bionic-20200403 +FROM ubuntu:jammy-20230605 LABEL maintainer="sameer@damagehead.com" diff --git a/README.md b/README.md index fed34ba..09275e0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Circle CI](https://circleci.com/gh/sameersbn/docker-postgresql.svg?style=shield)](https://circleci.com/gh/sameersbn/docker-postgresql) [![Docker Repository on Quay.io](https://quay.io/repository/sameersbn/postgresql/status "Docker Repository on Quay.io")](https://quay.io/repository/sameersbn/postgresql) [![](https://badge.imagelayers.io/sameersbn/postgresql.svg)](https://imagelayers.io/?images=sameersbn/postgresql:latest 'Get your own badge on imagelayers.io') -# sameersbn/postgresql:12-20200524 +# sameersbn/postgresql:14-20230628 - [Introduction](#introduction) - [Contributing](#contributing) @@ -61,7 +61,7 @@ Automated builds of the image are available on [Dockerhub](https://hub.docker.co > **Note**: Builds are also available on [Quay.io](https://quay.io/repository/sameersbn/postgresql) ```bash -docker pull sameersbn/postgresql:12-20200524 +docker pull sameersbn/postgresql:14-20230628 ``` Alternatively you can build the image yourself. @@ -78,7 +78,7 @@ Start PostgreSQL using: docker run --name postgresql -itd --restart always \ --publish 5432:5432 \ --volume postgresql:/var/lib/postgresql \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` Login to the PostgreSQL server using: @@ -109,7 +109,7 @@ By default connections to the PostgreSQL server need to authenticated using a pa ```bash docker run --name postgresql -itd --restart always \ --env 'PG_TRUST_LOCALNET=true' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` > **Note** @@ -123,7 +123,7 @@ By default the `postgres` user is not assigned a password and as a result you ca ```bash docker run --name postgresql -itd --restart always \ --env 'PG_PASSWORD=passw0rd' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` @@ -139,7 +139,7 @@ A new PostgreSQL database user can be created by specifying the `DB_USER` and `D ```bash docker run --name postgresql -itd --restart always \ --env 'DB_USER=dbuser' --env 'DB_PASS=dbuserpass' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` > **Notes** @@ -156,7 +156,7 @@ A new PostgreSQL database can be created by specifying the `DB_NAME` variable wh ```bash docker run --name postgresql -itd --restart always \ --env 'DB_NAME=dbname' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` By default databases are created by copying the standard system database named `template1`. You can specify a different template for your database using the `DB_TEMPLATE` parameter. Refer to [Template Databases](http://www.postgresql.org/docs/9.4/static/manage-ag-templatedbs.html) for further information. @@ -168,7 +168,7 @@ Additionally, more than one database can be created by specifying a comma separa ```bash docker run --name postgresql -itd --restart always \ --env 'DB_NAME=dbname1,dbname2' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` ## Granting user access to a database @@ -179,7 +179,7 @@ If the `DB_USER` and `DB_PASS` variables are specified along with the `DB_NAME` docker run --name postgresql -itd --restart always \ --env 'DB_USER=dbuser' --env 'DB_PASS=dbuserpass' \ --env 'DB_NAME=dbname1,dbname2' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` In the above example `dbuser` with be granted access to both the `dbname1` and `dbname2` databases. @@ -191,7 +191,7 @@ The image also packages the [postgres contrib module](http://www.postgresql.org/ ```bash docker run --name postgresql -itd \ --env 'DB_NAME=db1,db2' --env 'DB_EXTENSION=unaccent,pg_trgm' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` The above command enables the `unaccent` and `pg_trgm` modules on the databases listed in `DB_NAME`, namely `db1` and `db2`. @@ -207,7 +207,7 @@ Similar to the creation of a database user, a new PostgreSQL replication user ca ```bash docker run --name postgresql -itd --restart always \ --env 'REPLICATION_USER=repluser' --env 'REPLICATION_PASS=repluserpass' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` > **Notes** @@ -229,7 +229,7 @@ Begin by creating the master node of our cluster: docker run --name postgresql-master -itd --restart always \ --env 'DB_USER=dbuser' --env 'DB_PASS=dbuserpass' --env 'DB_NAME=dbname' \ --env 'REPLICATION_USER=repluser' --env 'REPLICATION_PASS=repluserpass' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` Notice that no additional arguments are specified while starting the master node of the cluster. @@ -244,7 +244,7 @@ docker run --name postgresql-slave01 -itd --restart always \ --env 'REPLICATION_MODE=slave' --env 'REPLICATION_SSLMODE=prefer' \ --env 'REPLICATION_HOST=master' --env 'REPLICATION_PORT=5432' \ --env 'REPLICATION_USER=repluser' --env 'REPLICATION_PASS=repluserpass' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` *In the above command, we used docker links so that we can address the master node using the `master` alias in `REPLICATION_HOST`.* @@ -276,7 +276,7 @@ docker run --name postgresql-snapshot -itd --restart always \ --env 'REPLICATION_MODE=snapshot' --env 'REPLICATION_SSLMODE=prefer' \ --env 'REPLICATION_HOST=master' --env 'REPLICATION_PORT=5432' \ --env 'REPLICATION_USER=repluser' --env 'REPLICATION_PASS=repluserpass' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` The difference between a slave and a snapshot is that a slave is read-only and updated whenever the master data is updated (streaming replication), while a snapshot is read-write and is not updated after the initial snapshot of the data from the master. @@ -298,7 +298,7 @@ docker run --name postgresql-backup -it --rm \ --env 'REPLICATION_HOST=master' --env 'REPLICATION_PORT=5432' \ --env 'REPLICATION_USER=repluser' --env 'REPLICATION_PASS=repluserpass' \ --volume /srv/docker/backups/postgresql.$(date +%Y%m%d%H%M%S):/var/lib/postgresql \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` Once the backup is generated, the container will exit and the backup of the master data will be available at `/srv/docker/backups/postgresql.XXXXXXXXXXXX/`. Restoring the backup involves starting a container with the data in `/srv/docker/backups/postgresql.XXXXXXXXXXXX`. @@ -309,7 +309,7 @@ You can customize the launch command of PostgreSQL server by specifying argument ```bash docker run --name postgresql -itd --restart always \ - sameersbn/postgresql:12-20200524 -c log_connections=on + sameersbn/postgresql:14-20230628 -c log_connections=on ``` Please refer to the documentation of [postgres](http://www.postgresql.org/docs/9.4/static/app-postgres.html) for the complete list of available options. @@ -320,7 +320,7 @@ By default the PostgreSQL server logs are sent to the standard output. Using the ```bash docker run --name postgresql -itd --restart always \ - sameersbn/postgresql:12-20200524 -c logging_collector=on + sameersbn/postgresql:14-20230628 -c logging_collector=on ``` To access the PostgreSQL logs you can use `docker exec`. For example: @@ -342,7 +342,7 @@ For example, if you want to assign the `postgres` user of the container the UID ```bash docker run --name postgresql -itd --restart always \ --env 'USERMAP_UID=999' --env 'USERMAP_GID=999' \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` # Maintenance @@ -354,7 +354,7 @@ To upgrade to newer releases: 1. Download the updated Docker image: ```bash - docker pull sameersbn/postgresql:12-20200524 + docker pull sameersbn/postgresql:14-20230628 ``` 2. Stop the currently running image: @@ -374,7 +374,7 @@ To upgrade to newer releases: ```bash docker run --name postgresql -itd \ [OPTIONS] \ - sameersbn/postgresql:12-20200524 + sameersbn/postgresql:14-20230628 ``` ## Shell Access diff --git a/VERSION b/VERSION index e865f48..32e20a2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -12-20200524 +14-20230628 diff --git a/docker-compose.yml b/docker-compose.yml index 3608217..1c15598 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ PostgreSQL: restart: always - image: sameersbn/postgresql:12-20200524 + image: sameersbn/postgresql:14-20230628 ports: - "5432:5432" environment: