Post

Deploying the Private Photo Library with Immich – stack, DB, services, and CI updates

Deploying the Private Photo Library with Immich – stack, DB, services, and CI updates

A recent main branch introduced Immich v3.4.2 to store photos and videos on a QNAP‑backed claim while keeping PostgreSQL on a separate local volume. It adds a full database migration, new ServiceAccounts, Istio deny policies, and adjusts Terraform‑style apply logic so the private photo library can be rolled out cleanly.

New Immich stack configuration

The IaC file IaC/homelab/us-west-2/apps/immich/stack.hcl now defines shared locals and input variables that pull AWS SSM parameters, Secrets Manager, Istio ArgoCD, and Tailnet DNS ArgoCD. This centralises the resources needed by the Immich cluster and makes future changes easier to audit.

PostgreSQL role creation and nightly backup job

A new SQL script 99-immich.sql creates the immich LOGIN password, extends VChord and EarthDistance, switches the database owner, and creates the public schema. A CronJob immich-postgres-backup runs every day at 20:10 UTC, backoffs after failures, and limits job history. The backup job’s activeDeadlineSeconds is set to 3600 seconds, and it runs as non‑root with dedicated ownership.

Service accounts, security policies, and CI test adjustments

Four ServiceAccounts (immich, immich-postgres, immich-valkey, immich-backup) are declared with Argocd sync‑wave annotations and token automation disabled. AuthorizationPolicies allow traffic only from Traefik’s websecure entry point. The policy/kubernetes.rego now restricts secret keys to allowed prefixes, and policy/kubernetes_test.rego adds explicit deny rules for wrong namespaces and keys. Terragrunt apply logic was extended to treat immich as a special target, setting sourceRepos and resource whitelists. CI scripts were updated to use a dynamic count of approved names and to handle immich in bulk apply branches.

This post is licensed under CC BY 4.0 by the author.