2023-11-24 13:14:11 +01:00
# cnpgvecto.rs
2025-07-09 17:42:26 +07:00
Container images for [cloudnative-pg ](https://cloudnative-pg.io ) with [VectorChord ](https://github.com/tensorchord/VectorChord ) and [pgvecto.rs ](https://github.com/tensorchord/pgvecto.rs ) extension installed.
2023-11-26 16:51:23 +00:00
> [!IMPORTANT]
> If you are using this image on an existing database, the postgres configuration needs to be
2023-12-07 11:10:58 +01:00
> altered to enable the extension. You can do this by setting shared_preload_libraries in your Cluster spec:
> ```yaml
2023-12-07 11:11:58 +01:00
> apiVersion: postgresql.cnpg.io/v1
> kind: Cluster
> spec:
> (...)
> postgresql:
> shared_preload_libraries:
> - "vectors.so"
2025-07-09 16:54:39 +07:00
> - "vchord.so"
2023-12-07 11:11:58 +01:00
> ```
2024-04-07 20:18:27 +08:00
> [!IMPORTANT]
2025-07-09 16:54:39 +07:00
> The `pgvecto.rs` and `VectorChord` extension is not enabled by default. You need to enable it and set the search path when initializing the database. You can configure it in your Cluster spec:
2024-04-07 20:18:27 +08:00
> ```yaml
> apiVersion: postgresql.cnpg.io/v1
> kind: Cluster
> spec:
> (...)
> bootstrap:
2024-04-07 15:34:26 +02:00
> initdb:
2024-04-07 20:18:27 +08:00
> postInitSQL:
2024-04-07 15:34:26 +02:00
> - ALTER SYSTEM SET search_path TO "$user", public, vectors;
2024-06-07 07:07:46 +00:00
> - CREATE EXTENSION IF NOT EXISTS "vectors";
2025-07-09 16:54:39 +07:00
> - CREATE EXTENSION IF NOT EXISTS vchord CASCADE;
2024-06-07 07:07:46 +00:00
## Building
2025-07-09 16:54:39 +07:00
To build the Dockerfile locally, you need to pass the `CNPG_TAG` , `PGVECTORS_TAG` and `VECTORCHORD_TAG` args. For example:
`docker build . --build-arg="CNPG_TAG=17.5-bookworm" --build-arg="PGVECTORS_TAG=v0.4.0" --build-arg="VECTORCHORD_TAG=0.4.3"`