diff --git a/CODEOWNERS b/CODEOWNERS index 30bec190..645dd2bb 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -4,6 +4,12 @@ * @ardentperf +# pg_search +/pg-search/ @philippemnoel + +# pgvector (stub for required_extensions dependency resolution) +/pgvector/ @philippemnoel + # pg_cron /pg-cron/ @ardentperf diff --git a/README.md b/README.md index 4d0b2a9b..d73d24f9 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ project due to licensing constraints, but are otherwise fully compatible with | **[mysql-fdw](mysql-fdw)** | MySQL/MariaDB foreign data wrapper | [github.com/EnterpriseDB/mysql_fdw](https://github.com/EnterpriseDB/mysql_fdw) | @ardentperf | libmariadb3 (LGPL-2.1) | | **[pg-cron](pg-cron)** | Cron-based job scheduler for PostgreSQL | [github.com/citusdata/pg_cron](https://github.com/citusdata/pg_cron) | @ardentperf | Vixie-Cron (src/entry.c, src/misc.c) | | **[pg-rrule](pg-rrule)** | iCalendar RRULE recurrence rule type | [github.com/petropavel13/pg_rrule](https://github.com/petropavel13/pg_rrule) | @ardentperf | libical3 (LGPL-2.1/MPL-2.0) | +| **[pg-search](pg-search)** | Full-text search, vector retrieval, filtering, and aggregations | [github.com/paradedb/paradedb](https://github.com/paradedb/paradedb) | @philippemnoel | pg_search (AGPL-3.0) | | **[pg-uuidv7](pg-uuidv7)** | UUID version 7 (time-sortable) generator | [github.com/fboulnois/pg_uuidv7](https://github.com/fboulnois/pg_uuidv7) | @ardentperf | MPL-2.0 | | **[pgagent](pgagent)** | PostgreSQL job scheduler (pgAdmin component) | [pgadmin.org](https://www.pgadmin.org/docs/pgadmin4/latest/pgagent.html) | @ardentperf | Boost libraries (BSL-1.0) | | **[pgmemcache](pgmemcache)** | Memcached client interface for PostgreSQL | [github.com/ohmu/pgmemcache](https://github.com/ohmu/pgmemcache) | @ardentperf | libmemcached11 (LGPL) | diff --git a/pg-search/Dockerfile b/pg-search/Dockerfile new file mode 100644 index 00000000..ec071f74 --- /dev/null +++ b/pg-search/Dockerfile @@ -0,0 +1,58 @@ +# SPDX-FileCopyrightText: Copyright © contributors to the Not-CloudNativePG project. +# SPDX-License-Identifier: Apache-2.0 + +ARG BASE=ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie +FROM $BASE AS builder + +ARG PG_MAJOR +ARG EXT_VERSION + +USER 0 + +SHELL ["/bin/bash", "-o", "pipefail", "-c", "-e"] + +# Install the release package used by ParadeDB's own extension container. +RUN apt-get update && \ + apt-get install -y --no-install-recommends ca-certificates curl && \ + arch="$(dpkg --print-architecture)" && \ + distro="$(. /etc/os-release && echo "$VERSION_CODENAME")" && \ + case "${distro}/${arch}" in \ + bookworm/amd64) checksum="88bed17a4b7e084ae20ea481ee2e20fa9d210323fc3fc104021bad5cbcb9855f" ;; \ + bookworm/arm64) checksum="8e52aaca5ea79e90617b93e9add11b3d8a8428e2afe9c4617fe5510cf9a043fa" ;; \ + trixie/amd64) checksum="752cd6000bda74f9751bbc41855fd394fda1db58a505db7a52e2b8f134090e0b" ;; \ + trixie/arm64) checksum="3fe3019a0d56e918a9f567c8286a37892187bb5c6e5eae1c53e41beccb651cf0" ;; \ + *) echo "unsupported platform: ${distro}/${arch}" >&2; exit 1 ;; \ + esac && \ + curl -fsSL -o /tmp/pg_search.deb \ + "https://github.com/paradedb/paradedb/releases/download/v${EXT_VERSION}/postgresql-${PG_MAJOR}-pg-search_${EXT_VERSION}-1PARADEDB-${distro}_${arch}.deb" && \ + echo "${checksum} /tmp/pg_search.deb" | sha256sum -c - && \ + dpkg-query -f '${Package}\n' -W | sort > /tmp/packages.before && \ + apt-get install -y --no-install-recommends /tmp/pg_search.deb && \ + dpkg-query -f '${Package}\n' -W | sort > /tmp/packages.after && \ + comm -13 /tmp/packages.before /tmp/packages.after > /tmp/packages.new && \ + rm /tmp/pg_search.deb && \ + rm -rf /var/lib/apt/lists/* + +# Stage only linked libraries introduced by the pg_search package installation. +RUN mkdir -p /system /licenses && \ + ldd "/usr/lib/postgresql/${PG_MAJOR}/lib/pg_search.so" | awk '/=> \//{ print $1, $3 }' | \ + while read -r soname path; do \ + pkg="$(dpkg -S "$(readlink -f "$path")" | awk -F: 'NR == 1 { p = $1 } END { print p }')" || continue; \ + if ! grep -qxF "$pkg" /tmp/packages.new; then continue; fi; \ + cp -L "$path" "/system/${soname}"; \ + if [ -f "/usr/share/doc/${pkg}/copyright" ]; then \ + mkdir -p "/licenses/${pkg}"; \ + cp -L "/usr/share/doc/${pkg}/copyright" "/licenses/${pkg}/"; \ + fi; \ + done + +FROM scratch +ARG PG_MAJOR + +COPY --from=builder /usr/share/doc/postgresql-${PG_MAJOR}-pg-search/copyright /licenses/postgresql-${PG_MAJOR}-pg-search/ +COPY --from=builder /licenses/ /licenses/ +COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/pg_search* /lib/ +COPY --from=builder /system/ /system/ +COPY --from=builder /usr/share/postgresql/${PG_MAJOR}/extension/pg_search* /share/extension/ + +USER 65532:65532 diff --git a/pg-search/README.md b/pg-search/README.md new file mode 100644 index 00000000..140ea7bb --- /dev/null +++ b/pg-search/README.md @@ -0,0 +1,85 @@ +# pg_search + + +[pg_search](https://github.com/paradedb/paradedb) adds full-text search, +vector retrieval, filtering, and aggregations to PostgreSQL. + +## Usage + +### 1. Add the extension images to your Cluster + +`pg_search` requires `pgvector`, so mount both extension images. It also links +system libraries supplied in the image's `system` directory. + +```yaml +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: cluster-pg-search +spec: + imageName: ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie + instances: 1 + storage: + size: 1Gi + postgresql: + shared_preload_libraries: + - "pg_search" + extensions: + - name: pg_search + image: + reference: ghcr.io/not-cloudnative-pg/pg-search:0.25.6-18-trixie + ld_library_path: + - system + - name: pgvector + image: + reference: ghcr.io/cloudnative-pg/pgvector:0.8.6-18-trixie +``` + +### 2. Enable the extension in a database + +```yaml +apiVersion: postgresql.cnpg.io/v1 +kind: Database +metadata: + name: cluster-pg-search-app +spec: + name: app + owner: app + cluster: + name: cluster-pg-search + extensions: + - name: vector + version: '0.8.6' + - name: pg_search + version: '0.25.6' +``` + +Alternatively, enable both extensions directly with SQL: + +```sql +CREATE EXTENSION vector; +CREATE EXTENSION pg_search; +``` + +### 3. Verify installation + +Connect with `psql` and run `\dx`. Both `vector` and `pg_search` should be +listed among the installed extensions. + +## Contributors + +This extension is maintained by: + +- Philippe Noël (@philippemnoel) + +The maintainers are responsible for monitoring upstream releases and security +issues, ensuring compatibility with supported PostgreSQL versions, and +reviewing contributions to this extension image. + +## Licenses and Copyright + +The extension and dependency license notices are bundled under `/licenses/` in +the image. diff --git a/pg-search/metadata.hcl b/pg-search/metadata.hcl new file mode 100644 index 00000000..1dec96f6 --- /dev/null +++ b/pg-search/metadata.hcl @@ -0,0 +1,33 @@ +# SPDX-FileCopyrightText: Copyright © contributors to the Not-CloudNativePG project. +# SPDX-License-Identifier: Apache-2.0 +metadata = { + name = "pg-search" + sql_name = "pg_search" + image_name = "pg-search" + licenses = ["AGPL-3.0-only"] + shared_preload_libraries = ["pg_search"] + postgresql_parameters = {} + extension_control_path = [] + dynamic_library_path = [] + ld_library_path = ["system"] + bin_path = [] + env = {} + auto_update_os_libs = false + required_extensions = ["pgvector"] + create_extension = true + + versions = { + bookworm = { + "18" = { + package = "0.25.6" + sql = "0.25.6" + } + } + trixie = { + "18" = { + package = "0.25.6" + sql = "0.25.6" + } + } + } +} diff --git a/pgvector/Dockerfile b/pgvector/Dockerfile new file mode 100644 index 00000000..bb8fa5a2 --- /dev/null +++ b/pgvector/Dockerfile @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: Copyright © contributors to the Not-CloudNativePG project. +# SPDX-License-Identifier: Apache-2.0 + +# This is a metadata-only stub. pgvector is maintained upstream at +# https://github.com/cloudnative-pg/postgres-extensions-containers +# and its images are published at ghcr.io/cloudnative-pg/pgvector. +# This stub allows pg_search's required extension to resolve in E2E tests. +FROM scratch +USER 65532:65532 diff --git a/pgvector/metadata.hcl b/pgvector/metadata.hcl new file mode 100644 index 00000000..97494f40 --- /dev/null +++ b/pgvector/metadata.hcl @@ -0,0 +1,37 @@ +# SPDX-FileCopyrightText: Copyright © contributors to the Not-CloudNativePG project. +# SPDX-License-Identifier: Apache-2.0 +metadata = { + name = "pgvector" + sql_name = "vector" + image_name = "pgvector" + licenses = ["PostgreSQL"] + shared_preload_libraries = [] + postgresql_parameters = {} + extension_control_path = [] + dynamic_library_path = [] + ld_library_path = [] + bin_path = [] + env = {} + auto_update_os_libs = false + required_extensions = [] + create_extension = true + + versions = { + bookworm = { + "18" = { + // renovate: suite=bookworm-pgdg depName=postgresql-18-pgvector + package = "0.8.6-1.pgdg12+1" + // renovate: suite=bookworm-pgdg depName=postgresql-18-pgvector extractVersion=^(?\d+\.\d+\.\d+) + sql = "0.8.6" + } + } + trixie = { + "18" = { + // renovate: suite=trixie-pgdg depName=postgresql-18-pgvector + package = "0.8.6-1.pgdg13+1" + // renovate: suite=trixie-pgdg depName=postgresql-18-pgvector extractVersion=^(?\d+\.\d+\.\d+) + sql = "0.8.6" + } + } + } +}