# From https://github.com/immich-app/immich/discussions/9060#discussioncomment-9688353 apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: immich-pg namespace: {{ .Values.mainNamespace }} spec: instances: {{ .Values.immichDb.dbClusterInstances }} imageName: ghcr.io/tensorchord/cloudnative-pgvecto.rs:16.3-v0.2.1 # superuserSecret: # name: immich-pg-superuser # enableSuperuserAccess: true startDelay: 30 stopDelay: 100 # primaryUpdateStrategy: unsupervised # primaryUpdateMethod: switchover postgresql: shared_preload_libraries: - "vectors.so" enableAlterSystem: true storage: storageClass: {{ .Values.immichDb.dbClusterStorageClass }} size: {{ .Values.immichDb.dbClusterStorageSize }} # monitoring: # enablePodMonitor: false bootstrap: initdb: database: immich owner: immich # secret: # name: immich-pg-user dataChecksums: true postInitApplicationSQL: - ALTER SYSTEM SET search_path TO "$user", public, vectors; - SET search_path TO "$user", public, vectors; - CREATE EXTENSION IF NOT EXISTS "vectors"; - CREATE EXTENSION IF NOT EXISTS "cube"; - CREATE EXTENSION IF NOT EXISTS "earthdistance"; - ALTER SCHEMA vectors OWNER TO "immich"; - GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA vectors TO "immich"; - GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "immich"; # - CREATE EXTENSION IF NOT EXISTS "vector"; # - ALTER ROLE "immich" WITH "superuser";