Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 13.0 #380

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packaging_automation/publish_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class DockerImageType(Enum):
nightly = 3
postgres_14 = 4
postgres_15 = 5
postgres_16 = 6


class ManualTriggerType(Enum):
Expand Down Expand Up @@ -65,6 +66,11 @@ class ScheduleType(Enum):
"docker-tag": "pg15",
"schedule-type": ScheduleType.regular,
},
DockerImageType.postgres_16: {
"file-name": "postgres-16/Dockerfile",
"docker-tag": "pg16",
"schedule-type": ScheduleType.regular,
},
DockerImageType.nightly: {
"file-name": "nightly/Dockerfile",
"docker-tag": "nightly",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file is auto generated from it's template,
# see citusdata/tools/packaging_automation/templates/docker/postgres-16/postgres-16.tmpl.dockerfile.
FROM postgres:{{postgres_version}}
ARG VERSION={{project_version}}
LABEL maintainer="Citus Data https://citusdata.com" \
org.label-schema.name="Citus" \
org.label-schema.description="Scalable PostgreSQL for multi-tenant and real-time workloads" \
org.label-schema.url="https://www.citusdata.com" \
org.label-schema.vcs-url="https://github.com/citusdata/citus" \
org.label-schema.vendor="Citus Data, Inc." \
org.label-schema.version=${VERSION} \
org.label-schema.schema-version="1.0"

ENV CITUS_VERSION ${VERSION}.citus-1

# install Citus
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
&& curl -s https://install.citusdata.com/community/deb.sh | bash \
&& apt-get install -y postgresql-$PG_MAJOR-citus-{{project_minor_version}}=$CITUS_VERSION \
postgresql-$PG_MAJOR-hll=2.18.citus-1 \
postgresql-$PG_MAJOR-topn=2.6.0.citus-1 \
&& apt-get purge -y --auto-remove curl \
&& rm -rf /var/lib/apt/lists/*

# add citus to default PostgreSQL config
RUN echo "shared_preload_libraries='citus'" >> /usr/share/postgresql/postgresql.conf.sample

# add scripts to run after initdb
COPY 001-create-citus-extension.sql /docker-entrypoint-initdb.d/

# add health check script
COPY pg_healthcheck wait-for-manager.sh /
RUN chmod +x /wait-for-manager.sh

# entry point unsets PGPASSWORD, but we need it to connect to workers
# https://github.com/docker-library/postgres/blob/33bccfcaddd0679f55ee1028c012d26cd196537d/12/docker-entrypoint.sh#L303
RUN sed "/unset PGPASSWORD/d" -i /usr/local/bin/docker-entrypoint.sh

HEALTHCHECK --interval=4s --start-period=6s CMD ./pg_healthcheck
27 changes: 26 additions & 1 deletion packaging_automation/update_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class SupportedDockerImages(Enum):
alpine = 3
postgres14 = 4
postgres15 = 5
postgres16 = 6


docker_templates = {
Expand All @@ -39,6 +40,7 @@ class SupportedDockerImages(Enum):
SupportedDockerImages.alpine: "alpine/alpine.tmpl.dockerfile",
SupportedDockerImages.postgres14: "postgres-14/postgres-14.tmpl.dockerfile",
SupportedDockerImages.postgres15: "postgres-15/postgres-15.tmpl.dockerfile",
SupportedDockerImages.postgres16: "postgres-16/postgres-16.tmpl.dockerfile",
}

docker_outputs = {
Expand All @@ -47,6 +49,7 @@ class SupportedDockerImages(Enum):
SupportedDockerImages.alpine: "alpine/Dockerfile",
SupportedDockerImages.postgres14: "postgres-14/Dockerfile",
SupportedDockerImages.postgres15: "postgres-15/Dockerfile",
SupportedDockerImages.postgres16: "postgres-16/Dockerfile",
}

BASE_PATH = pathlib2.Path(__file__).parent.absolute()
Expand Down Expand Up @@ -99,6 +102,23 @@ def update_docker_file_alpine(
write_to_file(content, dest_file_name)


def update_docker_file_for_postgres16(
project_version: str, template_path: str, exec_path: str, postgres_version: str
):
minor_version = get_minor_project_version_for_docker(project_version)
debian_project_version = project_version.replace("_", "-")
content = process_template_file_with_minor(
debian_project_version,
template_path,
docker_templates[SupportedDockerImages.postgres16],
minor_version,
postgres_version,
)
dest_file_name = f"{exec_path}/{docker_outputs[SupportedDockerImages.postgres16]}"
create_directory_if_not_exists(dest_file_name)
write_to_file(content, dest_file_name)


def update_docker_file_for_postgres15(
project_version: str, template_path: str, exec_path: str, postgres_version: str
):
Expand Down Expand Up @@ -174,12 +194,13 @@ def update_all_docker_files(project_version: str, exec_path: str):
pkgvars_file = f"{exec_path}/pkgvars"

(
postgres_17_version,
postgres_16_version,
postgres_15_version,
postgres_14_version,
) = read_postgres_versions(pkgvars_file)

latest_postgres_version = postgres_16_version
latest_postgres_version = postgres_17_version

update_docker_file_for_latest_postgres(
project_version, template_path, exec_path, latest_postgres_version
Expand All @@ -193,13 +214,17 @@ def update_all_docker_files(project_version: str, exec_path: str):
)
update_docker_file_for_postgres15(
project_version, template_path, exec_path, postgres_15_version
)
update_docker_file_for_postgres16(
project_version, template_path, exec_path, postgres_16_version
)
update_changelog(project_version, exec_path)


def read_postgres_versions(pkgvars_file: str) -> Tuple[str, str, str]:
config = dotenv_values(pkgvars_file)
return (
config["postgres_17_version"],
config["postgres_16_version"],
config["postgres_15_version"],
config["postgres_14_version"],
Expand Down
Loading