From d01189f4cbbe855f577aa04e333453b22f9de397 Mon Sep 17 00:00:00 2001 From: Beda Schmid Date: Fri, 23 Oct 2026 16:43:46 +0000 Subject: [PATCH] Reset history to current sanitized state --- .gitignore | 35 ++++++++++++++++ README.md | 27 ++++++++++++ docker-compose.yml | 92 +++++++++++++++++++++++++++++++++++++++++ hwaccel.ml.yml | 13 ++++++ hwaccel.transcoding.yml | 54 ++++++++++++++++++++++++ 5 files changed, 221 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 hwaccel.ml.yml create mode 100644 hwaccel.transcoding.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..24fa52b --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +# Application state and recovery copies +/postgres/ +/redis-data/ +/model-cache/ +/library/ +/appdata/ +/backups/ +/pre-cleanup/ + +# Environment and secrets +.env +.env.* +*.env +*.env.* +/secrets/ +*.key +*.pem +*.p12 +*.pfx + +# Editor and operating-system files +.DS_Store +*~ +*.swp + +# BEGIN reset-history environment exclusions +.env +.env.* +*.env +*.env.* +!.env.example +!.env.*.example +!*.env.example +!*.env.*.example +# END reset-history environment exclusions diff --git a/README.md b/README.md new file mode 100644 index 0000000..40e79e3 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Immich + +Immich stores, organizes, and searches the homelab's photos and videos. + +## Deployment layout + +- **Compose:** `/srv/docker/immich/docker-compose.yml` +- **Static configuration/source:** `/srv/docker/immich/hwaccel.ml.yml` and `/srv/docker/immich/hwaccel.transcoding.yml` +- **Non-secret environment:** ML logging and model revision are inline in Compose; version and other environment settings are supplied through the protected central environment +- **Secrets:** `/srv/docker/secrets/immich/.env` +- **NVMe application state:** `/srv/appdata/immich/postgres`, `/srv/appdata/immich/redis`, and `/srv/appdata/immich/model-cache` +- **Bulk HDD data:** `/data/Data1/immich/library`, mounted at `/data` +- **Other mounts:** `/etc/localtime` read-only; `/dev/dri` device passthrough for VAAPI transcoding and OpenVINO inference + +Secrets are never committed to this repository. The central environment is +supplied to the server and ML services and is also loaded explicitly by +Compose for version and database-variable interpolation. Required variables +include IMMICH_VERSION, DB_PASSWORD, DB_USERNAME, and DB_DATABASE_NAME. + +Run Compose from `/srv/docker/immich` using: +`sudo docker compose --env-file /srv/docker/secrets/immich/.env -f docker-compose.yml` + +## Dependencies and recovery + +- **Networks/dependencies:** external `npm_proxy`, with the server at `192.168.97.19`; project bridge `immich_internal` with MTU `1420`; PostgreSQL, Valkey, machine learning, mounted Data1 storage, and Intel GPU access +- **Back up:** the database and `/data/Data1/immich/library`, the protected central environment, and deployment files. Preserve Valkey state during migration. Database backups do not contain photos or videos; verify independent backup coverage and restore testing. +- **Re-creatable:** container images and downloaded ML models; thumbnails and encoded videos can be regenerated from originals and a consistent database diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e20d01e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,92 @@ +# +# WARNING: To install Immich, follow our guide: https://immich.app/docs/install/docker-compose +# +# Make sure to use the docker-compose.yml of the current release: +# +# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml +# +# The compose file on main may not be compatible with the latest release. + +name: immich + +services: + immich-server: + mem_limit: 1.5g + memswap_limit: 2g + container_name: immich_server + image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:?Set IMMICH_VERSION} + extends: + file: hwaccel.transcoding.yml + service: vaapi # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding + volumes: + # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file + - /data/Data1/immich/library:/data + - /etc/localtime:/etc/localtime:ro + env_file: + - /srv/docker/secrets/immich/.env + depends_on: + - redis + - database + restart: unless-stopped + healthcheck: + disable: false + networks: + npm_proxy: + ipv4_address: 192.168.97.19 + immich_internal: + + immich-machine-learning: + container_name: immich_machine_learning + # For hardware acceleration, add one of -[armnn, cuda, rocm, openvino, rknn] to the image tag. + # Example tag: ${IMMICH_VERSION:-release}-cuda + image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:?Set IMMICH_VERSION}-openvino + extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration + file: hwaccel.ml.yml + service: openvino # set to one of [armnn, cuda, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the `-wsl` version for WSL2 where applicable + volumes: + - /srv/appdata/immich/model-cache:/cache + env_file: + - /srv/docker/secrets/immich/.env + environment: + - IMMICH_LOG_LEVEL=debug + - MACHINE_LEARNING_MODEL_REVISION=v2 + restart: unless-stopped + healthcheck: + disable: false + networks: + - immich_internal + redis: + container_name: immich_redis + image: docker.io/valkey/valkey:8-bookworm@sha256:fea8b3e67b15729d4bb70589eb03367bab9ad1ee89c876f54327fc7c6e618571 + healthcheck: + test: redis-cli ping || exit 1 + restart: unless-stopped + volumes: + - /srv/appdata/immich/redis:/data + networks: + - immich_internal + + database: + mem_limit: 1.5g + memswap_limit: 2.5g + container_name: immich_postgres + image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:41eacbe83eca995561fe43814fd4891e16e39632806253848efaf04d3c8a8b84 + environment: + POSTGRES_PASSWORD: ${DB_PASSWORD:?Set DB_PASSWORD} + POSTGRES_USER: ${DB_USERNAME:?Set DB_USERNAME} + POSTGRES_DB: ${DB_DATABASE_NAME:?Set DB_DATABASE_NAME} + POSTGRES_INITDB_ARGS: '--data-checksums' + volumes: + - /srv/appdata/immich/postgres:/var/lib/postgresql/data + shm_size: 128mb + restart: unless-stopped + networks: + - immich_internal + +networks: + npm_proxy: + external: true + immich_internal: + driver: bridge + driver_opts: + com.docker.network.driver.mtu: 1420 diff --git a/hwaccel.ml.yml b/hwaccel.ml.yml new file mode 100644 index 0000000..624b54c --- /dev/null +++ b/hwaccel.ml.yml @@ -0,0 +1,13 @@ +# Configurations for hardware-accelerated machine learning + +# If using Unraid or another platform that doesn't allow multiple Compose files, +# you can inline the config for a backend by copying its contents +# into the immich-machine-learning service in the docker-compose.yml file. + +# See https://immich.app/docs/features/ml-hardware-acceleration for info on usage. + +services: + + openvino: + devices: + - /dev/dri:/dev/dri diff --git a/hwaccel.transcoding.yml b/hwaccel.transcoding.yml new file mode 100644 index 0000000..33fb7b3 --- /dev/null +++ b/hwaccel.transcoding.yml @@ -0,0 +1,54 @@ +# Configurations for hardware-accelerated transcoding + +# If using Unraid or another platform that doesn't allow multiple Compose files, +# you can inline the config for a backend by copying its contents +# into the immich-microservices service in the docker-compose.yml file. + +# See https://immich.app/docs/features/hardware-transcoding for more info on using hardware transcoding. + +services: + cpu: {} + + nvenc: + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: + - gpu + - compute + - video + + quicksync: + devices: + - /dev/dri:/dev/dri + + rkmpp: + security_opt: # enables full access to /sys and /proc, still far better than privileged: true + - systempaths=unconfined + - apparmor=unconfined + group_add: + - video + devices: + - /dev/rga:/dev/rga + - /dev/dri:/dev/dri + - /dev/dma_heap:/dev/dma_heap + - /dev/mpp_service:/dev/mpp_service + #- /dev/mali0:/dev/mali0 # only required to enable OpenCL-accelerated HDR -> SDR tonemapping + volumes: + #- /etc/OpenCL:/etc/OpenCL:ro # only required to enable OpenCL-accelerated HDR -> SDR tonemapping + #- /usr/lib/aarch64-linux-gnu/libmali.so.1:/usr/lib/aarch64-linux-gnu/libmali.so.1:ro # only required to enable OpenCL-accelerated HDR -> SDR tonemapping + + vaapi: + devices: + - /dev/dri:/dev/dri + + vaapi-wsl: # use this for VAAPI if you're running Immich in WSL2 + devices: + - /dev/dri:/dev/dri + volumes: + - /usr/lib/wsl:/usr/lib/wsl + environment: + - LIBVA_DRIVER_NAME=d3d12