All writing

Home LabBy 4 min read

Replacing Google Photos with a self-hosted Immich server

How I run Immich for family photo backup on a Raspberry Pi Kubernetes cluster, with face recognition and smart search on my own hardware, and what went wrong along the way.

Updated

On this page · 6 sections
  1. What is Immich?
  2. How I run it
  3. What went wrong
  4. Local AI, private by design
  5. What self-hosting costs
  6. Was it worth it?

Family photos are the one dataset in my house nobody would forgive me for losing. For years they lived in a big-tech cloud. Today they live on my own hardware, in a self-hosted Immich server that does almost everything the commercial services do: automatic phone backup, face recognition, smart search and sharing within the family.

What is Immich?

Immich is an open-source, self-hosted photo and video platform. Its mobile apps back up automatically, the web interface is fast, and the machine-learning features run locally. It feels close enough to the commercial apps that the rest of my family uses it without thinking about it, which is the real test.

How I run it

Immich publishes a Docker Compose file. I translated it into Kubernetes manifests and run it on my Raspberry Pi cluster, deployed by Argo CD from a Git repo. One file holds the version, and Kustomize copies it into every image tag, so an upgrade is a one-line change.

ComponentWhat it doesMemory limit
immich-server (v3.3)API, web app and background jobs2 GiB
immich-machine-learningFace detection and recognition, and the embeddings behind smart search, on CPU4 GiB
PostgreSQL 14 with VectorChordMetadata and vector search1 GiB
Valkey 9Job queue for thumbnails, transcoding and ML work256 MiB

In normal use the server sits around 1.2 GiB of memory, the ML service around 1 GiB and Postgres under 600 MiB. The Pi has no GPU, so everything runs on the CPU.

The data lives on my ZFS NAS as static NFS volumes with a Retain policy, so deleting something in Kubernetes cannot delete photos:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: immich-upload-pv
spec:
  capacity:
    storage: 200Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain   # data survives PVC deletion
  mountOptions:
    - hard
    - nfsvers=4.1
  csi:
    driver: nfs.csi.k8s.io
    volumeHandle: "<nas-ip>#/immich-server##"
    volumeAttributes:
      server: "<nas-ip>"
      share: "/immich-server"

The library has 200 GiB, the database 20 GiB and the ML model cache 20 GiB, each on its own export.

Immich is reachable only from my home network and over VPN. The ingress has no upload size limit and long timeouts, because phones upload videos, and the certificate comes from Let’s Encrypt through cert-manager.

What went wrong

A port number that was not a number. On the first deploy the server crashed straight away. Kubernetes injects environment variables for every Service in the namespace, so a Service called redis gives each pod REDIS_PORT=tcp://10.x.x.x:6379. Immich read that as its Redis port, got NaN and stopped. Setting REDIS_PORT: "6379" explicitly fixed it.

Images pinned to the wrong architecture. I had pinned Postgres and Valkey by @sha256 digest, and the digests pointed at amd64 images, which the Pis cannot run. Pinning by tag fixed it.

TLS took four attempts. I first copied certificates from an NFS share into a Secret with a CronJob, which Argo CD created but never ran. A sync hook Job came next, and then a back and forth over which kubectl image to use. I replaced all of it with cert-manager and DNS-01. Ingress logs from that week showed only home and VPN clients, so I also closed it to everything else.

Requests sized by guesswork. After a few months I measured actual use. The server was at 96% of its 512 MiB request and Postgres was using 319 MiB against a 256 MiB request, so I raised both and cut the CPU requests, which were far higher than the steady load.

Local AI, private by design

The part I enjoy most is that face recognition and semantic search run entirely on my own hardware. Search for beach or birthday cake and the right photos come back, without tags, and none of it leaves the house. It is a small example of a question I think about in product work: which intelligence needs a frontier model in the cloud, and which can run cheaply and privately at the edge?

What self-hosting costs

Owning your data means owning the operations:

  • Backups are your job, for the photo files and the database. Lose the database and you lose albums, faces and metadata even if the files survive.
  • Upgrades need care. Immich moves fast. I went from v2.7 to v3.3 in four months, and I read the release notes before each bump.
  • Remote access needs thought. A family photo server deserves the same care as any production service. Mine is not on the public internet at all.
  • The first ML pass is heavy. Indexing an existing library takes a long time on CPU. After that it is incremental.

Was it worth it?

Yes, for the privacy, for not paying a growing monthly subscription, and for what it teaches. My family notices immediately when something breaks, which makes me a more careful on-call engineer than any pager has.

Being the on-call engineer for the systems I run at home is one of the best ways I’ve found to understand the ones I build at work.