web-arm: migrate existing Nextcloud photos into Immich (manual, one-time) #184

Open
opened 2026-06-26 17:03:08 +02:00 by dominik.polakovics · 0 comments

Goal

One-time, manual migration of existing photos from Nextcloud into the freshly-deployed Immich on web-arm. OIDC login now works (#181, #182); Immich is empty and needs the existing library imported. (#178 explicitly deferred data migration to "a separate human issue" — this is it.)

Where the data is

  • Nextcloud photos live at /var/lib/nextcloud/data/<nextcloud-username>/files/<…> on web-arm. The data dir is a Storage-Box CIFS mount (sub4); real filenames/folder structure are preserved. Files are owned uid=983 (nextcloud), mode 0770 → read them as root.
    • <nextcloud-username> is your Authelia preferred_username. Find it with ls /var/lib/nextcloud/data.
  • Immich stores originals on Storage-Box sub12 (/var/lib/immich/library), thumbnails local. API: http://127.0.0.1:2283/api (loopback) or https://immich.cloonar.com/api.

Does it work with an API key? Yes

The Immich CLI authenticates only via an API key — no OAuth/password involved.

  1. Log into https://immich.cloonar.com as your admin user.
  2. Account Settings → API Keys → New API Key (grant asset upload / all permissions). Copy it.
    • The key is tied to that account, so assets land in your (admin) library. Use the admin account.

Run it on web-arm so it reads the Nextcloud files locally and uploads over loopback (no double internet transfer). immich-cli is in nixpkgs (binary immich).

# as root on web-arm
nix-shell -p immich-cli --run '
  immich login http://127.0.0.1:2283/api <API_KEY>
  immich upload --recursive --album \
    "/var/lib/nextcloud/data/<nextcloud-username>/files/Photos"
'
  • --recursive walks subfolders; --album makes one album per source subfolder. Use --album-name "Nextcloud import" for a single album instead, or drop both flags to import with no albums.
  • The CLI hashes each file and skips duplicates, so it is safe to re-run / resume / point at overlapping folders.
  • Repeat for each photo location (e.g. .../files/Photos, .../files/InstantUpload for phone auto-uploads, etc.).

Alternative: immich-go

immich-go (also API-key based) is more robust for very large libraries and has richer date/album heuristics:

immich-go upload from-folder --server https://immich.cloonar.com --api-key <KEY> /path/to/photos

Caveats

  • Copy-only — do not delete anything from Nextcloud until verified.
  • Dates: Immich's timeline uses EXIF. Photos with EXIF keep correct dates; files without EXIF fall back to file mtime, which on the CIFS share may be the Nextcloud-upload time rather than the capture date. Phone photos are usually fine; scans/old files may land on the wrong date (immich-go has filename/folder date heuristics if that matters).
  • Processing is throttled (concurrency 1, CPUWeight=20): after upload, thumbnail + face/smart-search generation for a large library takes a while. Watch Administration → Jobs and journalctl -u immich-server. This is by design so it never starves the websites.
  • Capacity: originals go to Storage-Box sub12 — confirm it has room for the whole library before a big import.

Acceptance criteria

  • API key created under the admin account.
  • Photos uploaded (CLI reports N uploaded / M duplicates skipped).
  • Timeline shows the photos with correct dates; thumbnails generate.
  • Originals present under /var/lib/immich/library (sub12); count matches the source.
  • Source library still intact in Nextcloud (nothing deleted).
## Goal One-time, manual migration of existing photos from **Nextcloud** into the freshly-deployed **Immich** on web-arm. OIDC login now works (#181, #182); Immich is empty and needs the existing library imported. (#178 explicitly deferred data migration to "a separate human issue" — this is it.) ## Where the data is - **Nextcloud photos** live at `/var/lib/nextcloud/data/<nextcloud-username>/files/<…>` on web-arm. The data dir is a Storage-Box CIFS mount (`sub4`); real filenames/folder structure are preserved. Files are owned `uid=983` (nextcloud), mode `0770` → read them as **root**. - `<nextcloud-username>` is your Authelia `preferred_username`. Find it with `ls /var/lib/nextcloud/data`. - **Immich** stores originals on Storage-Box `sub12` (`/var/lib/immich/library`), thumbnails local. API: `http://127.0.0.1:2283/api` (loopback) or `https://immich.cloonar.com/api`. ## Does it work with an API key? Yes The Immich CLI authenticates **only** via an API key — no OAuth/password involved. 1. Log into https://immich.cloonar.com as your admin user. 2. **Account Settings → API Keys → New API Key** (grant asset upload / all permissions). Copy it. - The key is tied to that account, so assets land in *your* (admin) library. Use the admin account. ## Recommended: Immich CLI on web-arm Run it on web-arm so it reads the Nextcloud files locally and uploads over loopback (no double internet transfer). `immich-cli` is in nixpkgs (binary `immich`). ```bash # as root on web-arm nix-shell -p immich-cli --run ' immich login http://127.0.0.1:2283/api <API_KEY> immich upload --recursive --album \ "/var/lib/nextcloud/data/<nextcloud-username>/files/Photos" ' ``` - `--recursive` walks subfolders; `--album` makes one album per source subfolder. Use `--album-name "Nextcloud import"` for a single album instead, or drop both flags to import with no albums. - The CLI **hashes each file and skips duplicates**, so it is safe to re-run / resume / point at overlapping folders. - Repeat for each photo location (e.g. `.../files/Photos`, `.../files/InstantUpload` for phone auto-uploads, etc.). ## Alternative: immich-go `immich-go` (also API-key based) is more robust for very large libraries and has richer date/album heuristics: ```bash immich-go upload from-folder --server https://immich.cloonar.com --api-key <KEY> /path/to/photos ``` ## Caveats - **Copy-only — do not delete anything from Nextcloud until verified.** - **Dates:** Immich's timeline uses EXIF. Photos with EXIF keep correct dates; files without EXIF fall back to file mtime, which on the CIFS share may be the Nextcloud-upload time rather than the capture date. Phone photos are usually fine; scans/old files may land on the wrong date (immich-go has filename/folder date heuristics if that matters). - **Processing is throttled** (concurrency 1, `CPUWeight=20`): after upload, thumbnail + face/smart-search generation for a large library takes a while. Watch Administration → Jobs and `journalctl -u immich-server`. This is by design so it never starves the websites. - **Capacity:** originals go to Storage-Box `sub12` — confirm it has room for the whole library before a big import. ## Acceptance criteria - [ ] API key created under the admin account. - [ ] Photos uploaded (CLI reports N uploaded / M duplicates skipped). - [ ] Timeline shows the photos with correct dates; thumbnails generate. - [ ] Originals present under `/var/lib/immich/library` (sub12); count matches the source. - [ ] Source library still intact in Nextcloud (nothing deleted).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/nixos#184
No description provided.