diff --git a/.daemonless/config.yaml b/.daemonless/config.yaml index 2ee9378..78a65d5 100644 --- a/.daemonless/config.yaml +++ b/.daemonless/config.yaml @@ -22,6 +22,15 @@ build: PG_VERSION: "18" VECTORCHORD_VERSION: "pkg" aliases: ["18"] + # PG 14 is stuck on VectorChord 0.5.3: the pgsty/vchord fork supports + # PostgreSQL 15-19 only. + - tag: "19-pkg" + pkg_name: postgresql19-server + args: + PG_VERSION: "19" + VECTORCHORD_VERSION: "1.5.0" + VECTORCHORD_REPO: "pgsty/vchord" + aliases: ["19"] # Component of the daemonless/immich stack -- not a standalone catalog app. fjord: diff --git a/Containerfile b/Containerfile index ff8e4b0..57ab153 100644 --- a/Containerfile +++ b/Containerfile @@ -6,24 +6,29 @@ ARG PG_VERSION=14 ARG VECTORCHORD_VERSION=0.5.3 +ARG VECTORCHORD_REPO=tensorchord/VectorChord -# Builder stage - compile VectorChord when no binary package exists (PG 14) +# Builder stage - compile VectorChord when no package exists (PG 14) or when a +# variant pins an explicit version (PG 19) FROM ghcr.io/daemonless/postgres:${PG_VERSION} AS builder ARG PG_VERSION ARG VECTORCHORD_VERSION +ARG VECTORCHORD_REPO -# Build VectorChord from source only if postgresql${PG_VERSION}-vchord is not in pkg +# Build VectorChord from source when the variant pins a version ("pkg" means: +# use the FreeBSD package), or when postgresql${PG_VERSION}-vchord is not in pkg RUN pkg update && \ mkdir -p /out/lib /out/ext && \ - if ! pkg rquery '%v' "postgresql${PG_VERSION}-vchord" >/dev/null 2>&1; then \ + if [ "${VECTORCHORD_VERSION}" != "pkg" ] || \ + ! pkg rquery '%v' "postgresql${PG_VERSION}-vchord" >/dev/null 2>&1; then \ pkg install -y \ FreeBSD-bmake FreeBSD-clibs-dev FreeBSD-clang FreeBSD-clang-dev FreeBSD-toolchain \ FreeBSD-libexecinfo FreeBSD-libexecinfo-dev FreeBSD-runtime-dev FreeBSD-utilities-dev \ rust gmake git-lite pkgconf && \ fetch -qo /tmp/vectorchord.tar.gz \ - "https://github.com/tensorchord/VectorChord/archive/refs/tags/${VECTORCHORD_VERSION}.tar.gz" && \ + "https://github.com/${VECTORCHORD_REPO}/archive/refs/tags/${VECTORCHORD_VERSION}.tar.gz" && \ tar -xzf /tmp/vectorchord.tar.gz -C /tmp && \ - cd /tmp/VectorChord-${VECTORCHORD_VERSION} && \ + cd "/tmp/$(basename "${VECTORCHORD_REPO}")-${VECTORCHORD_VERSION}" && \ gmake build && \ gmake install && \ cp /usr/local/lib/postgresql/vchord.so /out/lib/ && \ @@ -43,7 +48,7 @@ ENV HEALTHCHECK_CMD="${HEALTHCHECK_ENDPOINT}" # --- Metadata (Injected by Generator) --- LABEL org.opencontainers.image.title="Immich PostgreSQL" \ - org.opencontainers.image.description="PostgreSQL with pgvector and vectorchord extensions required by Immich for vector similarity search. Defaults to PostgreSQL 14 (:latest), PostgreSQL 18 available as :18." \ + org.opencontainers.image.description="PostgreSQL with pgvector and vectorchord extensions required by Immich for vector similarity search. Defaults to PostgreSQL 14 (:latest), PostgreSQL 18 (:18) and PostgreSQL 19 (:19) available." \ org.opencontainers.image.source="https://github.com/daemonless/immich-postgres" \ org.opencontainers.image.url="https://immich.app/" \ org.opencontainers.image.licenses="PostgreSQL" \ @@ -57,7 +62,7 @@ LABEL org.opencontainers.image.title="Immich PostgreSQL" \ io.daemonless.healthcheck-cmd="${HEALTHCHECK_ENDPOINT}" \ org.freebsd.jail.allow.sysvipc="required" -# Install VectorChord extension from pkg when available (PG 18), or copy from builder (PG 14) +# Install VectorChord from pkg when available (PG 18), or copy the source build (PG 14/19) COPY --from=builder /out /tmp/vchord-out RUN if [ -f /tmp/vchord-out/lib/vchord.so ]; then \ cp /tmp/vchord-out/lib/vchord.so /usr/local/lib/postgresql/ && \ diff --git a/Containerfile.j2 b/Containerfile.j2 index 55c2a9b..2c7ccb0 100644 --- a/Containerfile.j2 +++ b/Containerfile.j2 @@ -1,23 +1,28 @@ ARG PG_VERSION=14 ARG VECTORCHORD_VERSION=0.5.3 +ARG VECTORCHORD_REPO=tensorchord/VectorChord -# Builder stage - compile VectorChord when no binary package exists (PG 14) +# Builder stage - compile VectorChord when no package exists (PG 14) or when a +# variant pins an explicit version (PG 19) FROM ghcr.io/daemonless/postgres:${PG_VERSION} AS builder ARG PG_VERSION ARG VECTORCHORD_VERSION +ARG VECTORCHORD_REPO -# Build VectorChord from source only if postgresql${PG_VERSION}-vchord is not in pkg +# Build VectorChord from source when the variant pins a version ("pkg" means: +# use the FreeBSD package), or when postgresql${PG_VERSION}-vchord is not in pkg RUN pkg update && \ mkdir -p /out/lib /out/ext && \ - if ! pkg rquery '%v' "postgresql${PG_VERSION}-vchord" >/dev/null 2>&1; then \ + if [ "${VECTORCHORD_VERSION}" != "pkg" ] || \ + ! pkg rquery '%v' "postgresql${PG_VERSION}-vchord" >/dev/null 2>&1; then \ pkg install -y \ FreeBSD-bmake FreeBSD-clibs-dev FreeBSD-clang FreeBSD-clang-dev FreeBSD-toolchain \ FreeBSD-libexecinfo FreeBSD-libexecinfo-dev FreeBSD-runtime-dev FreeBSD-utilities-dev \ rust gmake git-lite pkgconf && \ fetch -qo /tmp/vectorchord.tar.gz \ - "https://github.com/tensorchord/VectorChord/archive/refs/tags/${VECTORCHORD_VERSION}.tar.gz" && \ + "https://github.com/${VECTORCHORD_REPO}/archive/refs/tags/${VECTORCHORD_VERSION}.tar.gz" && \ tar -xzf /tmp/vectorchord.tar.gz -C /tmp && \ - cd /tmp/VectorChord-${VECTORCHORD_VERSION} && \ + cd "/tmp/$(basename "${VECTORCHORD_REPO}")-${VECTORCHORD_VERSION}" && \ gmake build && \ gmake install && \ cp /usr/local/lib/postgresql/vchord.so /out/lib/ && \ @@ -58,7 +63,7 @@ LABEL org.opencontainers.image.title="{{ title }}" \ io.daemonless.healthcheck-cmd="${HEALTHCHECK_ENDPOINT}" \ org.freebsd.jail.allow.sysvipc="required" -# Install VectorChord extension from pkg when available (PG 18), or copy from builder (PG 14) +# Install VectorChord from pkg when available (PG 18), or copy the source build (PG 14/19) COPY --from=builder /out /tmp/vchord-out RUN if [ -f /tmp/vchord-out/lib/vchord.so ]; then \ cp /tmp/vchord-out/lib/vchord.so /usr/local/lib/postgresql/ && \ diff --git a/README.md b/README.md index af90ea2..a5e0d79 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Source: dbuild templates [![OCI Pulls](https://img.shields.io/docker/pulls/daemonless/immich-postgres?style=flat-square&label=OCI+Pulls&color=blue)](https://hub.docker.com/r/daemonless/immich-postgres) [![sysvipc Required](https://img.shields.io/badge/sysvipc-required-orange?style=flat-square&logo=freebsd&logoColor=white)](https://daemonless.io/guides/ocijail-patch/) -PostgreSQL with pgvector and vectorchord extensions required by Immich for vector similarity search. Defaults to PostgreSQL 14 (:latest), PostgreSQL 18 available as :18. +PostgreSQL with pgvector and vectorchord extensions required by Immich for vector similarity search. Defaults to PostgreSQL 14 (:latest), PostgreSQL 18 (:18) and PostgreSQL 19 (:19) available. | | | |---|---| @@ -19,13 +19,35 @@ PostgreSQL with pgvector and vectorchord extensions required by Immich for vecto | **Source** | [https://github.com/immich-app/immich](https://github.com/immich-app/immich) | | **Website** | [https://immich.app/](https://immich.app/) | -## Version Tags -| Tag | Description | Best For | -| :--- | :--- | :--- | -| `14` / `14-pkg` / `latest` | **Upstream Binary**. Built from official release. | Most users — recommended. | -| `18` / `18-pkg` | **Upstream Binary**. Built from official release. | Alternative build. | +This image is part of the [Immich Stack](https://daemonless.io/images/immich). + +**PostgreSQL version:** `:18` and `:19` are recommended for new installs. +`:18` uses VectorChord and pgvector from FreeBSD packages; `:19` compiles +VectorChord 1.5.0 (pgsty/vchord) and pgvector 0.8.7 from source because the +FreeBSD package repository only builds the default PostgreSQL flavor. +`:latest` and `:14` remain on PostgreSQL 14 so existing deployments never +break on pull. Upgrading across major versions (14 -> 18 or 18 -> 19) +requires a full `pg_dumpall` and restore. + +PostgreSQL needs System V shared memory, which a jail does not get by default. +Create `immich-postgres.conf` alongside `appjail-director.yml`, the same as the +Immich stack's `immich-postgres-template.conf` (`allow.sysvipc` alone does nothing +on FreeBSD 15; the jail needs its own `sysv*: new` namespaces): + +``` +exec.start: "/bin/sh /etc/rc" +exec.stop: "/bin/sh /etc/rc.shutdown jail" +sysvmsg: new +sysvsem: new +sysvshm: new +mount.devfs +persist +ip4: inherit +ip6: inherit +``` ## Prerequisites + Before deploying, ensure your host environment is ready. See the [Quick Start Guide](https://daemonless.io/guides/quick-start) for host setup instructions. ## Deployment @@ -172,30 +194,12 @@ Save as `bastille-compose.yml`, then run `bastille up`. |------|----------|-------------| | `5432` | TCP | PostgreSQL Port | -This image is part of the [Immich Stack](https://daemonless.io/images/immich). - -**PostgreSQL version:** `:18` uses PostgreSQL 18 with VectorChord and pgvector from -FreeBSD packages (recommended for new installs). `:latest` and `:14` remain on -PostgreSQL 14 so existing deployments never break on pull; upgrading an existing -PostgreSQL 14 database to 18 requires a full `pg_dumpall` and restore. - -PostgreSQL needs System V shared memory, which a jail does not get by default. -Create `immich-postgres.conf` alongside `appjail-director.yml`, the same as the -Immich stack's `immich-postgres-template.conf` (`allow.sysvipc` alone does nothing -on FreeBSD 15; the jail needs its own `sysv*: new` namespaces): - -``` -exec.start: "/bin/sh /etc/rc" -exec.stop: "/bin/sh /etc/rc.shutdown jail" -sysvmsg: new -sysvsem: new -sysvshm: new -mount.devfs -persist -ip4: inherit -ip6: inherit -``` - +## Version Tags +| Tag | Description | Best For | +| :--- | :--- | :--- | +| `14` / `14-pkg` / `latest` | **Upstream Binary**. Built from official release. | Most users — recommended. | +| `18` / `18-pkg` | **Upstream Binary**. Built from official release. | Alternative build. | +| `19` / `19-pkg` | **Upstream Binary**. Built from official release. | Alternative build. | **Architectures:** amd64, aarch64 **User:** `postgres` (UID/GID via PUID/PGID, defaults to 1000:1000) diff --git a/compose.yaml b/compose.yaml index 0484447..d65e1ed 100644 --- a/compose.yaml +++ b/compose.yaml @@ -4,7 +4,7 @@ x-daemonless: title: "Immich PostgreSQL" icon: ":simple-postgresql:" category: "Databases" - description: "PostgreSQL with pgvector and vectorchord extensions required by Immich for vector similarity search. Defaults to PostgreSQL 14 (:latest), PostgreSQL 18 available as :18." + description: "PostgreSQL with pgvector and vectorchord extensions required by Immich for vector similarity search. Defaults to PostgreSQL 14 (:latest), PostgreSQL 18 (:18) and PostgreSQL 19 (:19) available." upstream_url: "https://github.com/immich-app/immich" web_url: "https://immich.app/" freshports_url: "https://www.freshports.org/databases/postgresql14-server/" @@ -18,10 +18,13 @@ x-daemonless: notes: | This image is part of the [Immich Stack](https://daemonless.io/images/immich). - **PostgreSQL version:** `:18` uses PostgreSQL 18 with VectorChord and pgvector from - FreeBSD packages (recommended for new installs). `:latest` and `:14` remain on - PostgreSQL 14 so existing deployments never break on pull; upgrading an existing - PostgreSQL 14 database to 18 requires a full `pg_dumpall` and restore. + **PostgreSQL version:** `:18` and `:19` are recommended for new installs. + `:18` uses VectorChord and pgvector from FreeBSD packages; `:19` compiles + VectorChord 1.5.0 (pgsty/vchord) and pgvector 0.8.7 from source because the + FreeBSD package repository only builds the default PostgreSQL flavor. + `:latest` and `:14` remain on PostgreSQL 14 so existing deployments never + break on pull. Upgrading across major versions (14 -> 18 or 18 -> 19) + requires a full `pg_dumpall` and restore. PostgreSQL needs System V shared memory, which a jail does not get by default. Create `immich-postgres.conf` alongside `appjail-director.yml`, the same as the