From 99fd6c58a436a2aca01e15a4eb04e39891fbeee5 Mon Sep 17 00:00:00 2001 From: xieydd Date: Sat, 28 Feb 2026 18:04:17 +0800 Subject: [PATCH 1/5] feat: support VectorChord(vchord) extension Signed-off-by: xieydd --- CODEOWNERS | 1 + README.md | 2 +- renovate.json | 10 +++++++ vchord/Dockerfile | 46 ++++++++++++++++++++++++++++ vchord/README.md | 73 +++++++++++++++++++++++++++++++++++++++++++++ vchord/metadata.hcl | 24 +++++++++++++++ 6 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 vchord/Dockerfile create mode 100644 vchord/README.md create mode 100644 vchord/metadata.hcl diff --git a/CODEOWNERS b/CODEOWNERS index f4dd1e7d..c82178ac 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -3,3 +3,4 @@ # https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/about-code-owners * @cloudnative-pg/maintainers @NiccoloFei +/vchord/ @xieydd diff --git a/README.md b/README.md index 14ea56e0..27e8f11d 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ they are maintained by their respective authors, and PostgreSQL Debian Group | :--- | :--- | :--- | | **[pgAudit](pgaudit)** | PostgreSQL audit extension | [https://github.com/pgaudit/pgaudit](https://github.com/pgaudit/pgaudit) | | **[pgvector](pgvector)** | Vector similarity search for PostgreSQL | [https://github.com/pgvector/pgvector](https://github.com/pgvector/pgvector) | +| **[VectorChord](vchord)** | Scalable and disk-efficient vector search for PostgreSQL | [https://github.com/tensorchord/VectorChord](https://github.com/tensorchord/VectorChord) | | **[PostGIS](postgis)** | Geospatial database extension for PostgreSQL | [https://postgis.net/](https://postgis.net/) | @@ -170,4 +171,3 @@ list of compatible extension images for PostgreSQL 18+ versions. project](https://github.com/cloudnative-pg/artifacts/tree/main/image-catalogs). - **Naming Convention:** These are based on the `minimal` catalog and use the `catalog-extensions` prefix (e.g., `catalog-extensions-trixie.yaml`). - diff --git a/renovate.json b/renovate.json index 57dcf1b5..e7b122cd 100644 --- a/renovate.json +++ b/renovate.json @@ -22,6 +22,16 @@ "registryUrlTemplate": "https://download.postgresql.org/pub/repos/apt?suite={{#if suite}}{{suite}}{{else}}stable{{/if}}&components=main&binaryArch=amd64", "datasourceTemplate": "deb" }, + { + "description": "updates github release versions in vchord metadata.hcl", + "customType": "regex", + "managerFilePatterns": [ + "vchord/metadata.hcl" + ], + "matchStrings": [ + "\\/\\/\\s*renovate:\\s*datasource=(?[a-z-.]+?)\\s+depName=(?[^\\s]+?)(?:\\s+versioning=(?[^\\s]+?))?(?:\\s+extractVersion=(?[^\\s]+?))?\\s*\"[A-Za-z0-9_-]+\"\\s*=\\s*\"(?[^\"]+)\"" + ] + }, { "description": "updates the container image versions in the README.md files", "customType": "regex", diff --git a/vchord/Dockerfile b/vchord/Dockerfile new file mode 100644 index 00000000..4a969bb3 --- /dev/null +++ b/vchord/Dockerfile @@ -0,0 +1,46 @@ +ARG BASE=ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie +FROM $BASE AS builder + +ARG PG_MAJOR +ARG EXT_VERSION + +USER 0 + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + curl \ + gnupg \ + lsb-release \ + software-properties-common \ + "postgresql-server-dev-${PG_MAJOR}"; \ + curl -fsSL https://apt.llvm.org/llvm.sh | bash -s -- 18; \ + apt-get update; \ + apt-get install -y --no-install-recommends clang-18 libclang-18-dev; \ + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable; \ + . "$HOME/.cargo/env"; \ + rustup update stable; \ + ext_tag="${EXT_VERSION%%-*}"; \ + curl -fsSL "https://github.com/tensorchord/VectorChord/archive/refs/tags/${ext_tag}.tar.gz" \ + | tar -xz -C /tmp; \ + cd "/tmp/VectorChord-${ext_tag}"; \ + export CC=clang-18 CXX=clang++-18; \ + make build; \ + make install DESTDIR=/tmp/vchord-root; \ + install -Dm644 LICENSE "/tmp/vchord-root/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright" + +FROM scratch +ARG PG_MAJOR + +# Licenses +COPY --from=builder /tmp/vchord-root/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright /licenses/postgresql-${PG_MAJOR}-vchord/ + +# Libraries +COPY --from=builder /tmp/vchord-root/usr/lib/postgresql/${PG_MAJOR}/lib/vchord* /lib/ + +# Share +COPY --from=builder /tmp/vchord-root/usr/share/postgresql/${PG_MAJOR}/extension/vchord* /share/extension/ + +USER 65532:65532 diff --git a/vchord/README.md b/vchord/README.md new file mode 100644 index 00000000..852f58ec --- /dev/null +++ b/vchord/README.md @@ -0,0 +1,73 @@ +# VectorChord + +[VectorChord](https://github.com/tensorchord/VectorChord) is an open-source +extension for high-performance and disk-efficient vector similarity search in +PostgreSQL. + +This image provides a convenient way to deploy and manage `vchord` with +[CloudNativePG](https://cloudnative-pg.io/). + +## Usage + +### 1. Add PgVector and VectorChord extension images to your Cluster + +`vchord` depends on `pgvector`, so both extensions must be configured in your +`Cluster` resource: + +```yaml +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: cluster-vchord +spec: + imageName: ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie + instances: 1 + + storage: + size: 1Gi + + postgresql: + shared_preload_libraries: + - vchord + extensions: + - name: pgvector + image: + # renovate: suite=trixie-pgdg depName=postgresql-18-pgvector + reference: ghcr.io/cloudnative-pg/pgvector:0.8.1-18-trixie + - name: vchord + image: + reference: ghcr.io/cloudnative-pg/vchord:1.1.1-18-trixie +``` + +### 2. Enable the extensions in a database + +Create or update a `Database` resource and ensure `vector` is available before +`vchord`: + +```yaml +apiVersion: postgresql.cnpg.io/v1 +kind: Database +metadata: + name: cluster-vchord-app +spec: + name: app + owner: app + cluster: + name: cluster-vchord + extensions: + - name: vector + # renovate: suite=trixie-pgdg depName=postgresql-18-pgvector + version: '0.8.1' + - name: vchord + version: '1.1.1' +``` + +### 3. Verify installation + +Once the database is ready, connect to it with `psql` and run: + +```sql +\dx +``` + +You should see both `vector` and `vchord` listed among installed extensions. diff --git a/vchord/metadata.hcl b/vchord/metadata.hcl new file mode 100644 index 00000000..0438ca43 --- /dev/null +++ b/vchord/metadata.hcl @@ -0,0 +1,24 @@ +metadata = { + name = "vchord" + sql_name = "vchord" + image_name = "vchord" + licenses = ["AGPL-3.0-only", "Elastic-2.0"] + shared_preload_libraries = ["vchord"] + extension_control_path = [] + dynamic_library_path = [] + ld_library_path = [] + auto_update_os_libs = false + required_extensions = ["pgvector"] + create_extension = true + + versions = { + bookworm = { + // renovate: datasource=github-releases depName=tensorchord/VectorChord versioning=semver extractVersion=^v(?.*)$ + "18" = "1.1.1" + } + trixie = { + // renovate: datasource=github-releases depName=tensorchord/VectorChord versioning=semver extractVersion=^v(?.*)$ + "18" = "1.1.1" + } + } +} From 2805d8bd8a63a57831492da70874b68f3fce002c Mon Sep 17 00:00:00 2001 From: xieydd Date: Thu, 19 Mar 2026 10:57:07 +0800 Subject: [PATCH 2/5] fix: pass e2e test Signed-off-by: xieydd --- vchord/Dockerfile | 13 ++++++++++--- vchord/README.md | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/vchord/Dockerfile b/vchord/Dockerfile index 4a969bb3..6ff151cf 100644 --- a/vchord/Dockerfile +++ b/vchord/Dockerfile @@ -7,6 +7,7 @@ ARG EXT_VERSION USER 0 RUN set -eux; \ + export DEBIAN_FRONTEND=noninteractive; \ apt-get update; \ apt-get install -y --no-install-recommends \ build-essential \ @@ -14,10 +15,16 @@ RUN set -eux; \ curl \ gnupg \ lsb-release \ - software-properties-common \ "postgresql-server-dev-${PG_MAJOR}"; \ - curl -fsSL https://apt.llvm.org/llvm.sh | bash -s -- 18; \ - apt-get update; \ + codename="$(. /etc/os-release && echo "${VERSION_CODENAME}")"; \ + if [ "${codename}" = "bookworm" ]; then \ + install -d -m 0755 /etc/apt/keyrings; \ + curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key \ + | gpg --dearmor -o /etc/apt/keyrings/llvm.gpg; \ + echo "deb [signed-by=/etc/apt/keyrings/llvm.gpg] http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-18 main" \ + > /etc/apt/sources.list.d/llvm.list; \ + apt-get update; \ + fi; \ apt-get install -y --no-install-recommends clang-18 libclang-18-dev; \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable; \ . "$HOME/.cargo/env"; \ diff --git a/vchord/README.md b/vchord/README.md index 852f58ec..9fe8b427 100644 --- a/vchord/README.md +++ b/vchord/README.md @@ -9,7 +9,7 @@ This image provides a convenient way to deploy and manage `vchord` with ## Usage -### 1. Add PgVector and VectorChord extension images to your Cluster +### 1. Add pgvector and VectorChord extension images to your Cluster `vchord` depends on `pgvector`, so both extensions must be configured in your `Cluster` resource: From bdb3b4e0cd205f0791b6be1fb7b4b71847f31cd5 Mon Sep 17 00:00:00 2001 From: xieydd Date: Thu, 19 Mar 2026 11:06:29 +0800 Subject: [PATCH 3/5] fix: reflow Signed-off-by: xieydd --- vchord/README.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/vchord/README.md b/vchord/README.md index 9fe8b427..d65386e0 100644 --- a/vchord/README.md +++ b/vchord/README.md @@ -1,18 +1,14 @@ # VectorChord -[VectorChord](https://github.com/tensorchord/VectorChord) is an open-source -extension for high-performance and disk-efficient vector similarity search in -PostgreSQL. +[VectorChord](https://github.com/tensorchord/VectorChord) is an open-source extension for high-performance and disk-efficient vector similarity search in PostgreSQL. -This image provides a convenient way to deploy and manage `vchord` with -[CloudNativePG](https://cloudnative-pg.io/). +This image provides a convenient way to deploy and manage `vchord` with [CloudNativePG](https://cloudnative-pg.io/). ## Usage ### 1. Add pgvector and VectorChord extension images to your Cluster -`vchord` depends on `pgvector`, so both extensions must be configured in your -`Cluster` resource: +`vchord` depends on `pgvector`, so both extensions must be configured in your `Cluster` resource: ```yaml apiVersion: postgresql.cnpg.io/v1 @@ -41,8 +37,7 @@ spec: ### 2. Enable the extensions in a database -Create or update a `Database` resource and ensure `vector` is available before -`vchord`: +Create or update a `Database` resource and ensure `vector` is available before `vchord`: ```yaml apiVersion: postgresql.cnpg.io/v1 From 4fdb23a2ad6b97e9fcad80f234f40f8ee54cbfa6 Mon Sep 17 00:00:00 2001 From: xieydd Date: Thu, 19 Mar 2026 14:57:58 +0800 Subject: [PATCH 4/5] feat: add vchord container image Package vchord from the published VectorChord release artifacts instead of building it from source during the image build. vchord provides scalable and disk-efficient vector search for PostgreSQL. This change keeps the image build closer to the repository packaging model, updates the declared license expression, and fixes the related README entry. Closes #122 Signed-off-by: xieydd --- README.md | 6 +----- vchord/Dockerfile | 33 +++++++++------------------------ vchord/metadata.hcl | 2 +- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index ff46d20c..111f0ee1 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ they are maintained by their respective authors, and PostgreSQL Debian Group | **[pgAudit](pgaudit)** | PostgreSQL audit extension | [github.com/pgaudit/pgaudit](https://github.com/pgaudit/pgaudit) | | **[pg_crash](pg-crash)** | **Disruptive** fault injection and chaos engineering extension | [github.com/cybertec-postgresql/pg_crash](https://github.com/cybertec-postgresql/pg_crash) | | **[pgvector](pgvector)** | Vector similarity search for PostgreSQL | [github.com/pgvector/pgvector](https://github.com/pgvector/pgvector) | -| **[VectorChord](vchord)** | Scalable and disk-efficient vector search for PostgreSQL | [https://github.com/tensorchord/VectorChord](https://github.com/tensorchord/VectorChord) | +| **[VectorChord](vchord)** | Scalable and disk-efficient vector search for PostgreSQL | [https://github.com/tensorchord/VectorChord](https://vectorchord.ai) | | **[PostGIS](postgis)** | Geospatial database extension for PostgreSQL | [postgis.net/](https://postgis.net/) | Extensions are provided only for the OS versions already built by the @@ -179,9 +179,5 @@ list of compatible extension images for PostgreSQL 18+ versions. - **Location:** Published in the [`artifacts` project](https://github.com/cloudnative-pg/artifacts/tree/main/image-catalogs-extensions). - **Naming Convention:** These are based on the `minimal` catalog and use the -<<<<<<< HEAD - `catalog-extensions` prefix (e.g., `catalog-extensions-trixie.yaml`). -======= `catalog-minimal` prefix (e.g., `catalog-minimal-trixie.yaml`). ->>>>>>> origin/main diff --git a/vchord/Dockerfile b/vchord/Dockerfile index 6ff151cf..75831d1e 100644 --- a/vchord/Dockerfile +++ b/vchord/Dockerfile @@ -3,6 +3,7 @@ FROM $BASE AS builder ARG PG_MAJOR ARG EXT_VERSION +ARG TARGETARCH USER 0 @@ -10,33 +11,17 @@ RUN set -eux; \ export DEBIAN_FRONTEND=noninteractive; \ apt-get update; \ apt-get install -y --no-install-recommends \ - build-essential \ ca-certificates \ curl \ - gnupg \ - lsb-release \ - "postgresql-server-dev-${PG_MAJOR}"; \ - codename="$(. /etc/os-release && echo "${VERSION_CODENAME}")"; \ - if [ "${codename}" = "bookworm" ]; then \ - install -d -m 0755 /etc/apt/keyrings; \ - curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key \ - | gpg --dearmor -o /etc/apt/keyrings/llvm.gpg; \ - echo "deb [signed-by=/etc/apt/keyrings/llvm.gpg] http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-18 main" \ - > /etc/apt/sources.list.d/llvm.list; \ - apt-get update; \ - fi; \ - apt-get install -y --no-install-recommends clang-18 libclang-18-dev; \ - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable; \ - . "$HOME/.cargo/env"; \ - rustup update stable; \ + dpkg; \ ext_tag="${EXT_VERSION%%-*}"; \ - curl -fsSL "https://github.com/tensorchord/VectorChord/archive/refs/tags/${ext_tag}.tar.gz" \ - | tar -xz -C /tmp; \ - cd "/tmp/VectorChord-${ext_tag}"; \ - export CC=clang-18 CXX=clang++-18; \ - make build; \ - make install DESTDIR=/tmp/vchord-root; \ - install -Dm644 LICENSE "/tmp/vchord-root/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright" + package_name="postgresql-${PG_MAJOR}-vchord_${ext_tag}-1_${TARGETARCH}.deb"; \ + curl -fsSL -o /tmp/vchord.deb \ + "https://github.com/tensorchord/VectorChord/releases/download/${ext_tag}/${package_name}"; \ + dpkg-deb -x /tmp/vchord.deb /tmp/vchord-root; \ + install -Dm644 /dev/null "/tmp/vchord-root/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright"; \ + curl -fsSL "https://raw.githubusercontent.com/tensorchord/VectorChord/${ext_tag}/LICENSE" \ + -o "/tmp/vchord-root/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright" FROM scratch ARG PG_MAJOR diff --git a/vchord/metadata.hcl b/vchord/metadata.hcl index 0438ca43..318a97f9 100644 --- a/vchord/metadata.hcl +++ b/vchord/metadata.hcl @@ -2,7 +2,7 @@ metadata = { name = "vchord" sql_name = "vchord" image_name = "vchord" - licenses = ["AGPL-3.0-only", "Elastic-2.0"] + licenses = ["AGPL-3.0-only OR Elastic-2.0"] shared_preload_libraries = ["vchord"] extension_control_path = [] dynamic_library_path = [] From 106f2dbc7d4fab155a5bfc94bd6f7294156681b5 Mon Sep 17 00:00:00 2001 From: xieydd Date: Thu, 19 Mar 2026 16:59:03 +0800 Subject: [PATCH 5/5] fix: remove redundant operations Signed-off-by: xieydd --- README.md | 2 +- vchord/Dockerfile | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 111f0ee1..35edb4b2 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ they are maintained by their respective authors, and PostgreSQL Debian Group | **[pgAudit](pgaudit)** | PostgreSQL audit extension | [github.com/pgaudit/pgaudit](https://github.com/pgaudit/pgaudit) | | **[pg_crash](pg-crash)** | **Disruptive** fault injection and chaos engineering extension | [github.com/cybertec-postgresql/pg_crash](https://github.com/cybertec-postgresql/pg_crash) | | **[pgvector](pgvector)** | Vector similarity search for PostgreSQL | [github.com/pgvector/pgvector](https://github.com/pgvector/pgvector) | -| **[VectorChord](vchord)** | Scalable and disk-efficient vector search for PostgreSQL | [https://github.com/tensorchord/VectorChord](https://vectorchord.ai) | +| **[VectorChord](vchord)** | Scalable and disk-efficient vector search for PostgreSQL | [vectorchord.ai](https://vectorchord.ai) | | **[PostGIS](postgis)** | Geospatial database extension for PostgreSQL | [postgis.net/](https://postgis.net/) | Extensions are provided only for the OS versions already built by the diff --git a/vchord/Dockerfile b/vchord/Dockerfile index 75831d1e..c623bf2b 100644 --- a/vchord/Dockerfile +++ b/vchord/Dockerfile @@ -3,36 +3,34 @@ FROM $BASE AS builder ARG PG_MAJOR ARG EXT_VERSION -ARG TARGETARCH USER 0 RUN set -eux; \ - export DEBIAN_FRONTEND=noninteractive; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - dpkg; \ ext_tag="${EXT_VERSION%%-*}"; \ - package_name="postgresql-${PG_MAJOR}-vchord_${ext_tag}-1_${TARGETARCH}.deb"; \ - curl -fsSL -o /tmp/vchord.deb \ - "https://github.com/tensorchord/VectorChord/releases/download/${ext_tag}/${package_name}"; \ - dpkg-deb -x /tmp/vchord.deb /tmp/vchord-root; \ - install -Dm644 /dev/null "/tmp/vchord-root/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright"; \ - curl -fsSL "https://raw.githubusercontent.com/tensorchord/VectorChord/${ext_tag}/LICENSE" \ - -o "/tmp/vchord-root/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright" + arch="$(dpkg --print-architecture)"; \ + package_name="postgresql-${PG_MAJOR}-vchord_${ext_tag}-1_${arch}.deb"; \ + apt-get update && \ + apt-get install -y --no-install-recommends wget ca-certificates && \ + wget "https://github.com/tensorchord/VectorChord/releases/download/${ext_tag}/${package_name}" -P /tmp && \ + dpkg-deb -x "/tmp/${package_name}" /sysroot && \ + install -Dm644 /dev/null "/sysroot/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright" && \ + wget "https://raw.githubusercontent.com/tensorchord/VectorChord/${ext_tag}/LICENSE" \ + -O "/sysroot/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright" && \ + apt-get remove -y wget ca-certificates && \ + apt-get purge -y --auto-remove && \ + rm -rf /tmp/* /var/lib/apt/lists/* FROM scratch ARG PG_MAJOR # Licenses -COPY --from=builder /tmp/vchord-root/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright /licenses/postgresql-${PG_MAJOR}-vchord/ +COPY --from=builder /sysroot/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright /licenses/postgresql-${PG_MAJOR}-vchord/ # Libraries -COPY --from=builder /tmp/vchord-root/usr/lib/postgresql/${PG_MAJOR}/lib/vchord* /lib/ +COPY --from=builder /sysroot/usr/lib/postgresql/${PG_MAJOR}/lib/vchord* /lib/ # Share -COPY --from=builder /tmp/vchord-root/usr/share/postgresql/${PG_MAJOR}/extension/vchord* /share/extension/ +COPY --from=builder /sysroot/usr/share/postgresql/${PG_MAJOR}/extension/vchord* /share/extension/ USER 65532:65532