Skip to content

Commit

Permalink
K8SPG-711 Now it is possible to build set minor ver of PG like 16.4 (#…
Browse files Browse the repository at this point in the history
…1118)

* Now it is possibel to build set minor ver of PG like 16.4

* add README.md

* move README.md

* fix text

* Fix wording

---------

Co-authored-by: Dmitriy Kostiuk <[email protected]>
  • Loading branch information
hors and fiowro authored Jan 24, 2025
1 parent 9e6bb7f commit 1cf3135
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 16 deletions.
66 changes: 66 additions & 0 deletions postgresql-containers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Building Images

## Supported Percona Distribution for PostgreSQL Software

You can find the latest supported PostgreSQL versions by the latest Operator using the following [link](https://docs.percona.com/percona-operator-for-postgresql/2.0/System-Requirements.html?h=#supported-versions).

More information about Percona Distribution for PostgreSQL Software can be found using this [link](https://www.percona.com/postgresql/software/postgresql-distribution).

## Requirements

To build the images, you need to install the following software on your system:

- **[Docker](https://www.docker.com/)**: A platform for developing, shipping, and running applications in containers.

You will also need a repository to store the newly created Docker images, and the appropriate access rights to push images into it. In our examples, we will use Percona's experimental repository `perconalab/percona-postgresql-operator`.

## Building PostgreSQL Image

To build a PostgreSQL image, use the `--build-arg` option with `PG_MAJOR` set to a needed version number:

* Use version with both major and minor numbers to specify the exact version - for example, `PG_MAJOR=16.6` will build a PosgreSQL image using Percona Distribution for PostgreSQL v16.6
* Use major number only to build the latest available minor version - for example, `PG_MAJOR=16` will bring you the latest available version of PostgreSQL 16

Example command:

```bash
docker build --platform x86_64 --no-cache --progress plain \
--build-arg PG_MAJOR=16.6 \
--build-arg PGO_TAG=v2.5.0 \
-t perconalab/percona-postgresql-operator:2.5.0-ppg16.6-postgres \
-f ./postgresql-containers/build/postgres/Dockerfile ./postgresql-containers/
```

## Building pgBouncer Image

To build a pgBouncer image, use the `--build-arg` option with `PG_MAJOR` set to a needed version number:

* Use version with both major and minor numbers to specify the exact version - for example, `PG_MAJOR=16.6` will build a pgBouncer image using Percona Distribution for PostgreSQL v16.6
* Use major number only to have the latest available minor version of pgBouncer - for example, `PG_MAJOR=16` will bring you the latest available version of pgBouncer for PostgreSQL 16

Example command:

```bash
docker build --platform x86_64 --no-cache --progress plain \
--build-arg PG_MAJOR=16.6 \
--build-arg PGO_TAG=v2.5.0 \
-t perconalab/percona-postgresql-operator:2.5.0-ppg16.6-pgbouncer1.23.1 \
-f ./postgresql-containers/build/pgbouncer/Dockerfile ./postgresql-containers/
```

## Building pgBackRest Image

To build a pgBackRest image, use the `--build-arg` option with `PG_MAJOR` set to a needed version number:

* Use version with both major and minor numbers to specify the exact version - for example, `PG_MAJOR=16.6` will build a pgBackRest image using Percona Distribution for PostgreSQL v16.6
* Use major number only to have the latest available minor version of pgBackRest - for example, `PG_MAJOR=16` will bring you the latest available version of pgBackRest for PostgreSQL 16

Example command:

```bash
docker build --platform x86_64 --no-cache --progress plain \
--build-arg PG_MAJOR=16.6 \
--build-arg PGO_TAG=v2.5.0 \
-t perconalab/percona-postgresql-operator:2.5.0-ppg16.6-pgbackrest2.54-1 \
-f ./postgresql-containers/build/pgbackrest/Dockerfile ./postgresql-containers/
```
2 changes: 1 addition & 1 deletion postgresql-containers/build/pgbackrest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ RUN set -ex; \
systemd \
libpq \
nss_wrapper \
percona-postgresql${PG_MAJOR}-libs \
percona-postgresql${PG_MAJOR%%.*}-libs \
libedit; \
microdnf -y clean all

Expand Down
2 changes: 1 addition & 1 deletion postgresql-containers/build/postgres-gis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ARG PG_MAJOR=14

RUN set -ex; \
yum-config-manager --enable ol9_codeready_builder ol9_developer_EPEL ol9_baseos_latest ol9_appstream; \
microdnf -y install percona-postgis33_${PG_MAJOR} percona-postgis33_${PG_MAJOR}-client
microdnf -y install percona-postgis33_${PG_MAJOR%%.*} percona-postgis33_${PG_MAJOR%%.*}-client

EXPOSE 5432

Expand Down
28 changes: 14 additions & 14 deletions postgresql-containers/build/postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,27 +87,27 @@ RUN set -ex; \
microdnf -y install \
libpq \
glibc-all-langpacks \
percona-postgresql${PG_MAJOR//.}; \
percona-postgresql${PG_MAJOR%%.*}; \
microdnf -y clean all

# Preserving PGVERSION out of paranoia
ENV PGROOT="/usr/pgsql-${PG_MAJOR}" PGVERSION="${PG_MAJOR}"
ENV PGROOT="/usr/pgsql-${PG_MAJOR%%.*}" PGVERSION="${PG_MAJOR%%.*}"

RUN set -ex; \
microdnf -y install \
--enablerepo="ol9_developer_EPEL" \
percona-pgaudit${PG_MAJOR//.} \
percona-pgaudit${PG_MAJOR//.}_set_user \
percona-pgaudit${PG_MAJOR%%.*} \
percona-pgaudit${PG_MAJOR%%.*}_set_user \
percona-pgbackrest \
percona-postgresql${PG_MAJOR//.}-contrib \
percona-postgresql${PG_MAJOR//.}-server \
percona-postgresql${PG_MAJOR//.}-libs \
percona-pg_stat_monitor${PG_MAJOR//.} \
percona-postgresql${PG_MAJOR//.}-llvmjit \
percona-wal2json${PG_MAJOR//.} \
percona-pg_repack${PG_MAJOR//.} \
percona-pgvector_${PG_MAJOR//.} \
percona-pgvector_${PG_MAJOR//.}-llvmjit \
percona-postgresql${PG_MAJOR%%.*}-contrib \
percona-postgresql${PG_MAJOR%%.*}-server \
percona-postgresql${PG_MAJOR%%.*}-libs \
percona-pg_stat_monitor${PG_MAJOR%%.*} \
percona-postgresql${PG_MAJOR%%.*}-llvmjit \
percona-wal2json${PG_MAJOR%%.*} \
percona-pg_repack${PG_MAJOR%%.*} \
percona-pgvector_${PG_MAJOR%%.*} \
percona-pgvector_${PG_MAJOR%%.*}-llvmjit \
psmisc \
rsync \
perl \
Expand Down Expand Up @@ -138,7 +138,7 @@ ENV PATH="${PGROOT}/bin:${PATH}"
RUN set -ex; \
mkdir -p /opt/crunchy/bin /opt/crunchy/conf /pgdata /pgwal /pgconf /backrestrepo /tablespaces; \
chown -R postgres:postgres /opt/crunchy /var/lib/pgsql \
/pgdata /pgwal /pgconf /backrestrepo /tablespaces /usr/pgsql-${PG_MAJOR//.}; \
/pgdata /pgwal /pgconf /backrestrepo /tablespaces /usr/pgsql-${PG_MAJOR%%.*}; \
chmod -R g=u /opt/crunchy /var/lib/pgsql \
/pgdata /pgwal /pgconf /backrestrepo /tablespaces

Expand Down

0 comments on commit 1cf3135

Please sign in to comment.