Skip to content

Commit 58becf0

Browse files
feat: add PostgreSQL 17beta1 images (cloudnative-pg#107)
Adding documentation on the project's structure and on how to add a new Postgres Beta version. Signed-off-by: Gabriele Bartolini <[email protected]> Signed-off-by: Niccolò Fei <[email protected]> Co-authored-by: Niccolò Fei <[email protected]>
1 parent b596df6 commit 58becf0

9 files changed

+1272
-2
lines changed

Debian/17/bookworm/.versions.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"BARMAN_VERSION": "3.10.0",
3+
"IMAGE_RELEASE_VERSION": "1",
4+
"POSTGRES_IMAGE_LAST_UPDATED": "2024-06-04T23:12:01.432773Z",
5+
"POSTGRES_IMAGE_VERSION": "17beta1-bookworm"
6+
}

Debian/17/bookworm/Dockerfile

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# vim:set ft=dockerfile:
2+
#
3+
# Copyright The CloudNativePG Contributors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# 
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
FROM postgres:17beta1-bookworm
18+
19+
# Do not split the description, otherwise we will see a blank space in the labels
20+
LABEL name="PostgreSQL Container Images" \
21+
vendor="The CloudNativePG Contributors" \
22+
version="${PG_VERSION}" \
23+
release="1" \
24+
summary="PostgreSQL Container images." \
25+
description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 17beta1-bookworm."
26+
27+
LABEL org.opencontainers.image.description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 17beta1-bookworm."
28+
29+
COPY requirements.txt /
30+
31+
# Install additional extensions
32+
RUN set -xe; \
33+
apt-get update; \
34+
apt-get install -y --no-install-recommends \
35+
"postgresql-${PG_MAJOR}-pgvector" \
36+
; \
37+
rm -fr /tmp/* ; \
38+
rm -rf /var/lib/apt/lists/*;
39+
40+
# Install barman-cloud
41+
RUN set -xe; \
42+
apt-get update; \
43+
apt-get install -y --no-install-recommends \
44+
python3-pip \
45+
python3-psycopg2 \
46+
python3-setuptools \
47+
; \
48+
pip3 install --break-system-packages --upgrade pip; \
49+
# TODO: Remove --no-deps once https://github.com/pypa/pip/issues/9644 is solved
50+
pip3 install --break-system-packages --no-deps -r requirements.txt; \
51+
rm -rf /var/lib/apt/lists/*;
52+
53+
# Change the uid of postgres to 26
54+
RUN usermod -u 26 postgres
55+
USER 26

Debian/17/bookworm/requirements.txt

+544
Large diffs are not rendered by default.

Debian/17/bullseye/.versions.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"BARMAN_VERSION": "3.10.0",
3+
"IMAGE_RELEASE_VERSION": "1",
4+
"POSTGRES_IMAGE_LAST_UPDATED": "2024-06-04T23:12:11.024627Z",
5+
"POSTGRES_IMAGE_VERSION": "17beta1-bullseye"
6+
}

Debian/17/bullseye/Dockerfile

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# vim:set ft=dockerfile:
2+
#
3+
# Copyright The CloudNativePG Contributors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# 
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
FROM postgres:17beta1-bullseye
18+
19+
# Do not split the description, otherwise we will see a blank space in the labels
20+
LABEL name="PostgreSQL Container Images" \
21+
vendor="The CloudNativePG Contributors" \
22+
version="${PG_VERSION}" \
23+
release="1" \
24+
summary="PostgreSQL Container images." \
25+
description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 17beta1-bullseye."
26+
27+
LABEL org.opencontainers.image.description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 17beta1-bullseye."
28+
29+
COPY requirements.txt /
30+
31+
# Install additional extensions
32+
RUN set -xe; \
33+
apt-get update; \
34+
apt-get install -y --no-install-recommends \
35+
"postgresql-${PG_MAJOR}-pgvector" \
36+
; \
37+
rm -fr /tmp/* ; \
38+
rm -rf /var/lib/apt/lists/*;
39+
40+
# Install barman-cloud
41+
RUN set -xe; \
42+
apt-get update; \
43+
apt-get install -y --no-install-recommends \
44+
python3-pip \
45+
python3-psycopg2 \
46+
python3-setuptools \
47+
; \
48+
pip3 install --upgrade pip; \
49+
# TODO: Remove --no-deps once https://github.com/pypa/pip/issues/9644 is solved
50+
pip3 install --no-deps -r requirements.txt; \
51+
rm -rf /var/lib/apt/lists/*;
52+
53+
# Change the uid of postgres to 26
54+
RUN usermod -u 26 postgres
55+
USER 26

Debian/17/bullseye/requirements.txt

+544
Large diffs are not rendered by default.

Debian/Dockerfile-beta.template

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ LABEL name="PostgreSQL Container Images" \
2424
summary="PostgreSQL Container images." \
2525
description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres %%POSTGRES_IMAGE_VERSION%%."
2626

27+
LABEL org.opencontainers.image.description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres %%POSTGRES_IMAGE_VERSION%%."
28+
2729
COPY requirements.txt /
2830

2931
# Install additional extensions
3032
RUN set -xe; \
3133
apt-get update; \
3234
apt-get install -y --no-install-recommends \
3335
"postgresql-${PG_MAJOR}-pgvector" \
34-
"postgresql-${PG_MAJOR}-pgaudit" \
3536
; \
3637
rm -fr /tmp/* ; \
3738
rm -rf /var/lib/apt/lists/*;

Debian/README.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Debian-based Container Images
2+
3+
This folder contains the `Dockerfile` manifests needed to build Debian-based
4+
PostgreSQL operand container images for use with CloudNativePG.
5+
6+
The images are based on the official [PostgreSQL images on
7+
DockerHub](https://hub.docker.com/_/postgres).
8+
9+
The folder includes:
10+
11+
- Directories for each supported PostgreSQL version.
12+
- [Image catalog
13+
files](https://cloudnative-pg.io/documentation/current/image_catalog/) for
14+
each Debian version.
15+
- Templates for the main `Dockerfile` and the beta version `Dockerfile`
16+
(typically identical, except for some extensions that are not ready for the
17+
new major release of PostgreSQL).
18+
- The `requirements.in` file required to build Barman Cloud images. (Note: This
19+
file will be removed once a Barman Cloud plugin supporting CNPG-I is
20+
distributed.)
21+
- The main update script.
22+
23+
## Adding a New Beta Version
24+
25+
To add a new beta version, follow these steps:
26+
27+
1. Create a new issue in the ["postgres-containers" project](https://github.com/cloudnative-pg/postgres-containers)
28+
with the title "Add PostgreSQL XX beta1 images".
29+
2. Clone the `postgres-containers` repository.
30+
3. Create a new branch named after the issue ID (e.g., `dev/YYY`).
31+
4. Create the `Debian/XX/` directory.
32+
5. Identify the latest Debian version name (e.g., `bookworm`).
33+
6. Run `Debian/update.sh XX -d bookworm` which will create a
34+
`.versions.json` file into the `Debian/XX/bookworm/` directory.
35+
7. Add the new directory to your commit and push the changes.
36+
8. Run the `Automatic updates` action on the branch and wait for it to complete
37+
(this will add a commit to the branch).
38+
9. Submit a pull request.
39+
40+
41+
## Troubleshooting
42+
43+
### Common issues
44+
45+
* Error while running `update.sh`
46+
47+
```
48+
sed: can't read requirements.txt: No such file or directory
49+
cat: requirements.txt: No such file or directory
50+
rm: cannot remove 'requirements.txt': No such file or directory
51+
```
52+
53+
If a similar error appears, the reason is that you are missing the
54+
`pip-compile` utility that's needed to build the python requirements
55+
for Barman Cloud. (Note: This requirement will be removed once a
56+
Barman Cloud plugin supporting CNPG-I is distributed.)

lib/repo_funcs.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
# limitations under the License.
1616
#
1717

18+
# Update this everytime a new major release of PostgreSQL is available
19+
POSTGRESQL_LATEST_MAJOR_RELEASE=16
20+
1821
# Get the last postgres base image tag and update time
1922
fetch_postgres_image_version() {
2023
local suite="$1"; shift
@@ -133,7 +136,7 @@ generate_postgres() {
133136
fi
134137

135138
dockerTemplate="Dockerfile.template"
136-
if [[ ${version} -gt "16" ]]; then
139+
if [[ ${version} -gt "${POSTGRESQL_LATEST_MAJOR_RELEASE}" ]]; then
137140
dockerTemplate="Dockerfile-beta.template"
138141
fi
139142

0 commit comments

Comments
 (0)