Compare commits

...
4 Commits
Author SHA1 Message Date
Ruben Hensen e7696107c0 docs: record the immich database migration
immich now runs v2.7.5 on PostgreSQL 17 with VectorChord. The PostgreSQL 14 cluster stays for a few days as a fallback.
2026-10-24 02:19:57 +02:00
Ruben Hensen a8a186b4d3 immich: upgrade to v2.7.5
v2.4.1 only accepts VectorChord >=0.3 <0.6 and refused to start on the new PostgreSQL 17 cluster with VectorChord 1.1.1; from v2.5.0 the range is >=0.3 <2. v2.7.5 is the last 2.x release; the 3.x upgrade comes separately.
2026-10-24 02:12:53 +02:00
Ruben Hensen 8596e8a428 immich: use the PostgreSQL 17 cluster and start the server again
The import into immich-postgres-17 matched the old database table for table (assets, embeddings, faces, people, albums, migrations). On start immich builds its VectorChord indexes.
2026-10-24 02:06:41 +02:00
Ruben Hensen 251f22c46f immich: add a PostgreSQL 17 cluster with VectorChord
Imported once from the PostgreSQL 14 cluster, whose embeddings were converted to real[] and whose pgvecto.rs extension was dropped first (immich's manual migration). After the import the columns become vector(512) again under VectorChord 1.1.1 with pgvector 0.8.6. A logical import because CNPG can't upgrade in place from the bullseye-based pgvecto.rs image to the bookworm-based VectorChord one.
2026-10-24 02:02:02 +02:00
3 changed files with 81 additions and 8 deletions

No files matched your search

+28 -2
View File
@@ -139,8 +139,34 @@ snapshots after every step. Fresh Velero backup before starting.
solver. The Ingresses were pruned with `PrunePropagationPolicy=orphan`
so the Certificates stayed. Gatus now expects a 302 from Longhorn
Out of scope here but due: the immich PostgreSQL 14 cluster reaches end of
life on 2026-11-12.
## 9. immich: PostgreSQL 14 with pgvecto.rs → 17 with VectorChord
PostgreSQL 14 reaches end of life on 2026-11-12, and immich 3.0 drops
pgvecto.rs. Done 2026-10-24, about an hour of immich downtime:
- [x] Safety net: Longhorn snapshot and NAS backup `immich-pg14-pre-vchord`
of the old volume, plus `pg_dump -Fc` (447 MB) in
`~/immich-pg14-pre-vchord.dump` on opti1
- [x] immich server to 0 replicas (through git)
- [x] On the old cluster, immich's manual migration in one transaction:
drop `clip_index` and `face_index`, `embedding` columns to `real[]`,
`DROP EXTENSION vectors`, `DROP SCHEMA vectors`, reset the database's
`search_path` (it included `vectors`)
- [x] New cluster `immich-postgres-17` (`immich/postgresql-cluster-17.yaml`):
`cloudnative-vectorchord:17.11-1.1.1` (pgvector 0.8.6, VectorChord
1.1.1), filled by a CNPG microservice import, then `vchord` created and
the columns back to `vector(512)`. An in-place `pg_upgrade` wasn't
possible: the pgvecto.rs image is Debian bullseye, the VectorChord ones
bookworm. Tables, indexes and row counts matched the old database
- [x] immich pointed at `immich-postgres-17-rw` and its own app secret.
v2.4.1 refused to start (it only accepts VectorChord <0.6); v2.5.0 and up
accept <2, so immich went to v2.7.5, the last 2.x. It rebuilt both
indexes as `vchordrq` in about 1.5 minutes
- [ ] After a few days without problems: delete the old cluster
(`immich/postgresql-cluster.yaml`), the snapshot/backup and the dump.
Rolling back means reverting the old volume to the snapshot, since its
embeddings are now `real[]` without pgvecto.rs
- [ ] immich 3.x, separately (pgvecto.rs no longer matters for it)
## k8s-dqlite write stalls (found 2026-10-22)
+3 -6
View File
@@ -24,18 +24,18 @@ spec:
containers:
main:
image:
tag: v2.4.1
tag: v2.7.5
env:
REDIS_HOSTNAME: '{{ printf "%s-valkey" .Release.Name }}'
IMMICH_MACHINE_LEARNING_URL: '{{ printf "http://%s-machine-learning:3003" .Release.Name }}'
# External PostgreSQL (CloudNativePG)
DB_HOSTNAME: "immich-postgres-rw"
DB_HOSTNAME: "immich-postgres-17-rw"
DB_USERNAME: "immich"
DB_DATABASE_NAME: "immich"
DB_PASSWORD:
valueFrom:
secretKeyRef:
name: immich-postgres-app
name: immich-postgres-17-app
key: password
immich:
@@ -86,9 +86,6 @@ spec:
enabled: true
controllers:
main:
# Stopped while the database moves to PostgreSQL 17 with
# VectorChord, see docs/upgrade-k8s-1.33.md
replicas: 0
containers:
main:
image:
+50
View File
@@ -0,0 +1,50 @@
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: immich-postgres-17
namespace: immich
spec:
instances: 1
# CNPG image with VectorChord and pgvector, which immich 2.x and 3.x use
# for its vector indexes (pgvecto.rs is gone in immich 3.0).
imageName: ghcr.io/tensorchord/cloudnative-vectorchord:17.11-1.1.1
postgresql:
shared_preload_libraries:
- "vchord.so"
# Filled once from the PostgreSQL 14 cluster (immich-postgres) after its
# embedding columns were turned into real[] and pgvecto.rs was dropped,
# see docs/upgrade-k8s-1.33.md.
bootstrap:
initdb:
database: immich
owner: immich
import:
type: microservice
databases:
- immich
source:
externalCluster: immich-postgres
postImportApplicationSQL:
- CREATE EXTENSION IF NOT EXISTS vchord CASCADE;
- ALTER TABLE public.smart_search ALTER COLUMN embedding SET DATA TYPE vector(512);
- ALTER TABLE public.face_search ALTER COLUMN embedding SET DATA TYPE vector(512);
# immich manages its own extensions and migrations
- ALTER USER immich WITH SUPERUSER;
externalClusters:
- name: immich-postgres
connectionParameters:
host: immich-postgres-rw
user: immich
dbname: immich
sslmode: require
password:
name: immich-postgres-app
key: password
storage:
size: 20Gi
storageClass: longhorn