Skip to content
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
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ 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 | [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
[`cloudnative-pg/postgres-containers`](https://github.com/cloudnative-pg/postgres-containers) project,
specifically Debian `stable` and `oldstable`.
Expand Down
10 changes: 10 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -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=(?<datasource>[a-z-.]+?)\\s+depName=(?<depName>[^\\s]+?)(?:\\s+versioning=(?<versioning>[^\\s]+?))?(?:\\s+extractVersion=(?<extractVersion>[^\\s]+?))?\\s*\"[A-Za-z0-9_-]+\"\\s*=\\s*\"(?<currentValue>[^\"]+)\""
]
},
{
"description": "updates the container image versions in the README.md files",
"customType": "regex",
Expand Down
36 changes: 36 additions & 0 deletions vchord/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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; \
ext_tag="${EXT_VERSION%%-*}"; \
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 /sysroot/usr/share/doc/postgresql-${PG_MAJOR}-vchord/copyright /licenses/postgresql-${PG_MAJOR}-vchord/

# Libraries
COPY --from=builder /sysroot/usr/lib/postgresql/${PG_MAJOR}/lib/vchord* /lib/

# Share
COPY --from=builder /sysroot/usr/share/postgresql/${PG_MAJOR}/extension/vchord* /share/extension/

USER 65532:65532
68 changes: 68 additions & 0 deletions vchord/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# 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.
24 changes: 24 additions & 0 deletions vchord/metadata.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
metadata = {
name = "vchord"
sql_name = "vchord"
image_name = "vchord"
licenses = ["AGPL-3.0-only OR 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(?<version>.*)$
"18" = "1.1.1"
}
trixie = {
// renovate: datasource=github-releases depName=tensorchord/VectorChord versioning=semver extractVersion=^v(?<version>.*)$
"18" = "1.1.1"
}
}
}