An Engineer's Blog

Back

Reproducible event photo sharing with Immich and TerraformBlur image

Overview

The home Immich instance (the one in the homelab write-up) is for me: private library, private people, private everything, and exactly the wrong thing to expose for a community photo collection. For the VietPEI Tet Holiday 2026 event, the guests got their own Immich at example.com/s/sharing (“Happy Tet 2026!”, 156 shared photos and videos), provisioned by a single terraform apply and seeded from a locally curated copy.

Guest flow: party, link, uploads, photos go home

One seed, three artifacts

An Immich share link is just a row in Postgres. The locally curated album, its users, share link and metadata all live in the database, and a dump carries them to a clone. export-seed.sh builds three artifacts from the local instance:

# full dump: users, albums, the share link
docker exec -e PGPASSWORD=$DB_PASSWORD -t immich_postgres \
    pg_dumpall --clean --if-exists -U $DB_USERNAME | gzip > seed.sql.gz

# library skeleton: folder structure and .immich markers, media excluded
tar --exclude='**/*.jpg' ... -czf library_skeleton.tar.gz library

# logos and profile pictures
tar -czf assets.tar.gz assets
bash

The skeleton is the subtle piece: Immich tracks imported files with hidden .immich marker files next to the media, so the folder structure with markers but no media tells the clone what should exist without carrying gigabytes. The assets bundle carries the site logo and profile pictures.

Terraform: the box

Seed artifacts, terraform apply, the OCI box, teardown

terraform apply stands up a self-contained stack on Oracle Cloud:

  • a VCN with an internet gateway and a security list opening only 22, 80, 443
  • an Ampere A1 instance (4 OCPUs, 24 GB RAM, ARM), Ubuntu, 200 GB boot volume for photos
  • a reserved public IP, so the DNS A record never chases an ephemeral address
  • cloud-init that installs Docker, writes the compose file and Caddyfile, and opens the host iptables for 80/443

The shape is deliberately boring. ARM keeps it inside the always-free tier, and 4 OCPUs handle upload transcoding for a room full of guests without tuning.

Provisioning then SSHes in as the IP attaches and runs the restore: extract skeleton and assets, docker compose up database redis, wait for Postgres, then

zcat $SEED_FILE | sudo docker exec -i immich_postgres psql -U postgres -d immich
sudo docker compose up -d
bash

The stack at the edge

Four containers, no orchestration:

  • immich-server (:release) with the library on the boot volume
  • Postgres 14 with the vector extensions, pinned by image digest, because a half-restored ML database is not a debugging experiment you want mid-event
  • Redis for jobs and sessions
  • Caddy in front with ACME certificates, gzip, /logo.png from the assets bundle, and a one-line redirect that opens the album on the bare domain
<event-domain> {
  handle /logo.png { root * /srv; file_server }
  encode gzip
  redir / <share_link_id> temporary
  reverse_proxy immich-server:2283
}
text

That redirect runs the whole event on one short address, example.com/s/sharing, with no accounts or instructions. Immich’s server-side rendering fills the social preview card (“156 shared photos & videos”), so the link looks right pasted into a group chat.

The share page grid, captured live

The Fri, Feb 6 setup-day group on the same page

Why not just share the home instance?

Three reasons, all learned the hard way:

  1. Privacy: the home library holds everything personal; an event instance holds exactly one curated album.
  2. Blast radius: a public URL will get crawled, probed and rate-limited; let it hit a disposable box whose terraform destroy erases VCN, instance and reserved IP in one command.
  3. Bandwidth: event week uploads should not share a home uplink with the household’s Jellyfin.

Security and convenience pull against each other hardest here. The room is mostly parents and children who will not create an account or install an app to see photos, and the existing options, commercial ones included, nearly all demand exactly that. The invitation QR code was the balance that held: the URL is never advertised online, so only people scanning the code at the venue learn it. Guests still forward the link to family afterward, but person-to-person spread from the room is a different exposure than a public post.

The personal instance stays on the Proxmox host, untouched. The event instance stays up a while after the party; then the album moves to VietPEI’s private Facebook group, where the association already operates, and only then does the instance disappear. The next event: curate locally, re-run ./export-seed.sh, fill in domain_name and share_link_id, terraform apply, point DNS at the output IP. An afternoon from “we should collect photos” to a public share link, most of it upload time.

Reproducible event photo sharing with Immich and Terraform
https://tin.ng/blog/2026-01-21--immich-event-sharing-with-terraform
Author Tin Nguyen
Published at January 21, 2026
Comment seems to stuck. Try to refresh?✨