Skip to content
Draft
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
9 changes: 9 additions & 0 deletions .daemonless/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
19 changes: 12 additions & 7 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/ && \
Expand All @@ -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" \
Expand All @@ -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/ && \
Expand Down
17 changes: 11 additions & 6 deletions Containerfile.j2
Original file line number Diff line number Diff line change
@@ -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/ && \
Expand Down Expand Up @@ -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/ && \
Expand Down
64 changes: 34 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

| | |
|---|---|
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 8 additions & 5 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand All @@ -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
Expand Down
Loading