Skip to content

Commit 2c01dee

Browse files
committed
Adds support for PostgreSQL 16,17,18 in Docker automation
1 parent 909c1de commit 2c01dee

File tree

6 files changed

+219
-2
lines changed

6 files changed

+219
-2
lines changed

packaging_automation/publish_docker.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ class DockerImageType(Enum):
3030
nightly = 3
3131
postgres_14 = 4
3232
postgres_15 = 5
33+
postgres_16 = 6
34+
postgres_17 = 7
35+
postgres_18 = 8
3336

3437

3538
class ManualTriggerType(Enum):
@@ -65,6 +68,21 @@ class ScheduleType(Enum):
6568
"docker-tag": "pg15",
6669
"schedule-type": ScheduleType.regular,
6770
},
71+
DockerImageType.postgres_16: {
72+
"file-name": "postgres-16/Dockerfile",
73+
"docker-tag": "pg16",
74+
"schedule-type": ScheduleType.regular,
75+
},
76+
DockerImageType.postgres_17: {
77+
"file-name": "postgres-17/Dockerfile",
78+
"docker-tag": "pg17",
79+
"schedule-type": ScheduleType.regular,
80+
},
81+
DockerImageType.postgres_18: {
82+
"file-name": "postgres-18/Dockerfile",
83+
"docker-tag": "pg18",
84+
"schedule-type": ScheduleType.regular,
85+
},
6886
DockerImageType.nightly: {
6987
"file-name": "nightly/Dockerfile",
7088
"docker-tag": "nightly",
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This file is auto generated from it's template,
2+
# see citusdata/tools/packaging_automation/templates/docker/postgres-16/postgres-16.tmpl.dockerfile.
3+
FROM postgres:{{postgres_version}}
4+
ARG VERSION={{project_version}}
5+
LABEL maintainer="Citus Data https://citusdata.com" \
6+
org.label-schema.name="Citus" \
7+
org.label-schema.description="Scalable PostgreSQL for multi-tenant and real-time workloads" \
8+
org.label-schema.url="https://www.citusdata.com" \
9+
org.label-schema.vcs-url="https://github.com/citusdata/citus" \
10+
org.label-schema.vendor="Citus Data, Inc." \
11+
org.label-schema.version=${VERSION} \
12+
org.label-schema.schema-version="1.0"
13+
14+
ENV CITUS_VERSION ${VERSION}.citus-1
15+
16+
# install Citus
17+
RUN apt-get update \
18+
&& apt-get install -y --no-install-recommends \
19+
ca-certificates \
20+
curl \
21+
&& curl -s https://install.citusdata.com/community/deb.sh | bash \
22+
&& apt-get install -y postgresql-$PG_MAJOR-citus-{{project_minor_version}}=$CITUS_VERSION \
23+
postgresql-$PG_MAJOR-hll=2.18.citus-1 \
24+
postgresql-$PG_MAJOR-topn=2.6.0.citus-1 \
25+
&& apt-get purge -y --auto-remove curl \
26+
&& rm -rf /var/lib/apt/lists/*
27+
28+
# add citus to default PostgreSQL config
29+
RUN echo "shared_preload_libraries='citus'" >> /usr/share/postgresql/postgresql.conf.sample
30+
31+
# add scripts to run after initdb
32+
COPY 001-create-citus-extension.sql /docker-entrypoint-initdb.d/
33+
34+
# add health check script
35+
COPY pg_healthcheck wait-for-manager.sh /
36+
RUN chmod +x /wait-for-manager.sh
37+
38+
# entry point unsets PGPASSWORD, but we need it to connect to workers
39+
# https://github.com/docker-library/postgres/blob/33bccfcaddd0679f55ee1028c012d26cd196537d/12/docker-entrypoint.sh#L303
40+
RUN sed "/unset PGPASSWORD/d" -i /usr/local/bin/docker-entrypoint.sh
41+
42+
HEALTHCHECK --interval=4s --start-period=6s CMD ./pg_healthcheck
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This file is auto generated from it's template,
2+
# see citusdata/tools/packaging_automation/templates/docker/postgres-17/postgres-17.tmpl.dockerfile.
3+
FROM postgres:{{postgres_version}}
4+
ARG VERSION={{project_version}}
5+
LABEL maintainer="Citus Data https://citusdata.com" \
6+
org.label-schema.name="Citus" \
7+
org.label-schema.description="Scalable PostgreSQL for multi-tenant and real-time workloads" \
8+
org.label-schema.url="https://www.citusdata.com" \
9+
org.label-schema.vcs-url="https://github.com/citusdata/citus" \
10+
org.label-schema.vendor="Citus Data, Inc." \
11+
org.label-schema.version=${VERSION} \
12+
org.label-schema.schema-version="1.0"
13+
14+
ENV CITUS_VERSION ${VERSION}.citus-1
15+
16+
# install Citus
17+
RUN apt-get update \
18+
&& apt-get install -y --no-install-recommends \
19+
ca-certificates \
20+
curl \
21+
&& curl -s https://install.citusdata.com/community/deb.sh | bash \
22+
&& apt-get install -y postgresql-$PG_MAJOR-citus-{{project_minor_version}}=$CITUS_VERSION \
23+
postgresql-$PG_MAJOR-hll=2.18.citus-1 \
24+
postgresql-$PG_MAJOR-topn=2.6.0.citus-1 \
25+
&& apt-get purge -y --auto-remove curl \
26+
&& rm -rf /var/lib/apt/lists/*
27+
28+
# add citus to default PostgreSQL config
29+
RUN echo "shared_preload_libraries='citus'" >> /usr/share/postgresql/postgresql.conf.sample
30+
31+
# add scripts to run after initdb
32+
COPY 001-create-citus-extension.sql /docker-entrypoint-initdb.d/
33+
34+
# add health check script
35+
COPY pg_healthcheck wait-for-manager.sh /
36+
RUN chmod +x /wait-for-manager.sh
37+
38+
# entry point unsets PGPASSWORD, but we need it to connect to workers
39+
# https://github.com/docker-library/postgres/blob/33bccfcaddd0679f55ee1028c012d26cd196537d/12/docker-entrypoint.sh#L303
40+
RUN sed "/unset PGPASSWORD/d" -i /usr/local/bin/docker-entrypoint.sh
41+
42+
HEALTHCHECK --interval=4s --start-period=6s CMD ./pg_healthcheck
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This file is auto generated from it's template,
2+
# see citusdata/tools/packaging_automation/templates/docker/postgres-18/postgres-18.tmpl.dockerfile.
3+
FROM postgres:{{postgres_version}}
4+
ARG VERSION={{project_version}}
5+
LABEL maintainer="Citus Data https://citusdata.com" \
6+
org.label-schema.name="Citus" \
7+
org.label-schema.description="Scalable PostgreSQL for multi-tenant and real-time workloads" \
8+
org.label-schema.url="https://www.citusdata.com" \
9+
org.label-schema.vcs-url="https://github.com/citusdata/citus" \
10+
org.label-schema.vendor="Citus Data, Inc." \
11+
org.label-schema.version=${VERSION} \
12+
org.label-schema.schema-version="1.0"
13+
14+
ENV CITUS_VERSION ${VERSION}.citus-1
15+
16+
# install Citus
17+
RUN apt-get update \
18+
&& apt-get install -y --no-install-recommends \
19+
ca-certificates \
20+
curl \
21+
&& curl -s https://install.citusdata.com/community/deb.sh | bash \
22+
&& apt-get install -y postgresql-$PG_MAJOR-citus-{{project_minor_version}}=$CITUS_VERSION \
23+
postgresql-$PG_MAJOR-hll=2.18.citus-1 \
24+
postgresql-$PG_MAJOR-topn=2.6.0.citus-1 \
25+
&& apt-get purge -y --auto-remove curl \
26+
&& rm -rf /var/lib/apt/lists/*
27+
28+
# add citus to default PostgreSQL config
29+
RUN echo "shared_preload_libraries='citus'" >> /usr/share/postgresql/postgresql.conf.sample
30+
31+
# add scripts to run after initdb
32+
COPY 001-create-citus-extension.sql /docker-entrypoint-initdb.d/
33+
34+
# add health check script
35+
COPY pg_healthcheck wait-for-manager.sh /
36+
RUN chmod +x /wait-for-manager.sh
37+
38+
# entry point unsets PGPASSWORD, but we need it to connect to workers
39+
# https://github.com/docker-library/postgres/blob/33bccfcaddd0679f55ee1028c012d26cd196537d/12/docker-entrypoint.sh#L303
40+
RUN sed "/unset PGPASSWORD/d" -i /usr/local/bin/docker-entrypoint.sh
41+
42+
HEALTHCHECK --interval=4s --start-period=6s CMD ./pg_healthcheck

packaging_automation/update_docker.py

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class SupportedDockerImages(Enum):
3131
alpine = 3
3232
postgres14 = 4
3333
postgres15 = 5
34+
postgres16 = 6
35+
postgres17 = 7
36+
postgres18 = 8
3437

3538

3639
docker_templates = {
@@ -39,6 +42,9 @@ class SupportedDockerImages(Enum):
3942
SupportedDockerImages.alpine: "alpine/alpine.tmpl.dockerfile",
4043
SupportedDockerImages.postgres14: "postgres-14/postgres-14.tmpl.dockerfile",
4144
SupportedDockerImages.postgres15: "postgres-15/postgres-15.tmpl.dockerfile",
45+
SupportedDockerImages.postgres16: "postgres-16/postgres-16.tmpl.dockerfile",
46+
SupportedDockerImages.postgres17: "postgres-17/postgres-17.tmpl.dockerfile",
47+
SupportedDockerImages.postgres18: "postgres-18/postgres-18.tmpl.dockerfile",
4248
}
4349

4450
docker_outputs = {
@@ -47,6 +53,9 @@ class SupportedDockerImages(Enum):
4753
SupportedDockerImages.alpine: "alpine/Dockerfile",
4854
SupportedDockerImages.postgres14: "postgres-14/Dockerfile",
4955
SupportedDockerImages.postgres15: "postgres-15/Dockerfile",
56+
SupportedDockerImages.postgres16: "postgres-16/Dockerfile",
57+
SupportedDockerImages.postgres17: "postgres-17/Dockerfile",
58+
SupportedDockerImages.postgres18: "postgres-18/Dockerfile",
5059
}
5160

5261
BASE_PATH = pathlib2.Path(__file__).parent.absolute()
@@ -99,6 +108,57 @@ def update_docker_file_alpine(
99108
write_to_file(content, dest_file_name)
100109

101110

111+
def update_docker_file_for_postgres18(
112+
project_version: str, template_path: str, exec_path: str, postgres_version: str
113+
):
114+
minor_version = get_minor_project_version_for_docker(project_version)
115+
debian_project_version = project_version.replace("_", "-")
116+
content = process_template_file_with_minor(
117+
debian_project_version,
118+
template_path,
119+
docker_templates[SupportedDockerImages.postgres18],
120+
minor_version,
121+
postgres_version,
122+
)
123+
dest_file_name = f"{exec_path}/{docker_outputs[SupportedDockerImages.postgres18]}"
124+
create_directory_if_not_exists(dest_file_name)
125+
write_to_file(content, dest_file_name)
126+
127+
128+
def update_docker_file_for_postgres17(
129+
project_version: str, template_path: str, exec_path: str, postgres_version: str
130+
):
131+
minor_version = get_minor_project_version_for_docker(project_version)
132+
debian_project_version = project_version.replace("_", "-")
133+
content = process_template_file_with_minor(
134+
debian_project_version,
135+
template_path,
136+
docker_templates[SupportedDockerImages.postgres17],
137+
minor_version,
138+
postgres_version,
139+
)
140+
dest_file_name = f"{exec_path}/{docker_outputs[SupportedDockerImages.postgres17]}"
141+
create_directory_if_not_exists(dest_file_name)
142+
write_to_file(content, dest_file_name)
143+
144+
145+
def update_docker_file_for_postgres16(
146+
project_version: str, template_path: str, exec_path: str, postgres_version: str
147+
):
148+
minor_version = get_minor_project_version_for_docker(project_version)
149+
debian_project_version = project_version.replace("_", "-")
150+
content = process_template_file_with_minor(
151+
debian_project_version,
152+
template_path,
153+
docker_templates[SupportedDockerImages.postgres16],
154+
minor_version,
155+
postgres_version,
156+
)
157+
dest_file_name = f"{exec_path}/{docker_outputs[SupportedDockerImages.postgres16]}"
158+
create_directory_if_not_exists(dest_file_name)
159+
write_to_file(content, dest_file_name)
160+
161+
102162
def update_docker_file_for_postgres15(
103163
project_version: str, template_path: str, exec_path: str, postgres_version: str
104164
):
@@ -174,12 +234,14 @@ def update_all_docker_files(project_version: str, exec_path: str):
174234
pkgvars_file = f"{exec_path}/pkgvars"
175235

176236
(
237+
postgres_18_version,
238+
postgres_17_version,
177239
postgres_16_version,
178240
postgres_15_version,
179241
postgres_14_version,
180242
) = read_postgres_versions(pkgvars_file)
181243

182-
latest_postgres_version = postgres_16_version
244+
latest_postgres_version = postgres_18_version
183245

184246
update_docker_file_for_latest_postgres(
185247
project_version, template_path, exec_path, latest_postgres_version
@@ -194,12 +256,23 @@ def update_all_docker_files(project_version: str, exec_path: str):
194256
update_docker_file_for_postgres15(
195257
project_version, template_path, exec_path, postgres_15_version
196258
)
259+
update_docker_file_for_postgres16(
260+
project_version, template_path, exec_path, postgres_16_version
261+
)
262+
update_docker_file_for_postgres17(
263+
project_version, template_path, exec_path, postgres_17_version
264+
)
265+
update_docker_file_for_postgres18(
266+
project_version, template_path, exec_path, postgres_18_version
267+
)
197268
update_changelog(project_version, exec_path)
198269

199270

200271
def read_postgres_versions(pkgvars_file: str) -> Tuple[str, str, str]:
201272
config = dotenv_values(pkgvars_file)
202273
return (
274+
config["postgres_18_version"],
275+
config["postgres_17_version"],
203276
config["postgres_16_version"],
204277
config["postgres_15_version"],
205278
config["postgres_14_version"],

packaging_automation/upload_to_package_cloud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"debian/buster": 150,
2121
"debian/bullseye": 207,
2222
"debian/bookworm": 215,
23-
#"debian/trixie": ???,
23+
"debian/trixie": 250,
2424
"ubuntu/bionic": 190,
2525
"ubuntu/focal": 210,
2626
"ubuntu/jammy": 237,

0 commit comments

Comments
 (0)