56c4888f5e
gates / gates (push) Successful in 2s
The ONLY image move in this commit; the limit rides it (09 decision 39's precedent), because the step itself re-runs immich's geodata import (228 294 -> 228 571 places) — the load that killed the database. Cause, measured on the bench (audits/immich-first-start-2026-09-30/A-cause.md): the first-start import runs up to 9 concurrent 5000-row INSERTs; the database then needs ~400 MB anon + ~170 MB touched shared_buffers (the image's own postgresql.conf fixes 512MB). At 512M with no swap: 61 kills; with 512 MB swap: 0 (swapped ~70 MB) — why 9202 passed; shared_buffers 128MB alone: still killed; 1024M: 0; 768M: 0. Proof at the new definition, fresh install from birth, no swap: bench x2 (anon 409/412 MB = 53 %, 0 kills, import 8.1 s) and box 9202 (anon 368 MB = 48 %, 0 kills, swap.peak 0). Step, written by upgrade-test.py --write-ladder: bench (harness v4) proven, 10-min watch 0 kills 0 restarts, anon peak 51.1 %; box 9202 through the guarded Update: done 58.5 s, album read back, the running database limit 805306368 after. The step carries `files_may_change` (the harness saw only immich's six 13-byte `.immich` folder markers rewritten at start) — the night leg takes it only with a whole copy. Per-box cost: +256 MB on immich-postgres; `mem_limit` 4096M -> 4480M (the old figure was already 128 MB under the sum of the four limits). Header comment corrected (it said postgres 256M). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
152 lines
5.2 KiB
YAML
152 lines
5.2 KiB
YAML
# Immich - Self-hosted Photo & Video Management
|
|
# Domain: ${SUBDOMAIN}.${DOMAIN}
|
|
# Database: PostgreSQL (with VectorChord) + Redis
|
|
# RAM: ~4GB minimum (mem_limit: 4480M total — server 2048M + ML 1536M + postgres 768M + redis 128M) | Pi-compatible: No (ML too heavy)
|
|
#
|
|
# Environment variables:
|
|
# DOMAIN - Your domain (e.g., demo-felhom.eu)
|
|
# HDD_PATH - Drive namespace root (managed upload lives under appdata)
|
|
# USERDATA_PATH - Ügyfél-tartalom gyökér (<namespace>/userdata)
|
|
# DB_PASSWORD - PostgreSQL password (auto-generated)
|
|
#
|
|
# Storage layout (felhom userdata convention):
|
|
# Managed upload (Immich-owned) → ${HDD_PATH}/appdata/immich (HDD, host path — app-managed)
|
|
# External photo library (RO) → ${USERDATA_PATH}/media/photos → /external/photos
|
|
# PostgreSQL data → immich_postgres_data (named volume, NVMe)
|
|
# ML model cache → immich_ml_cache (named volume, NVMe)
|
|
# Redis data → immich_redis_data (named volume, NVMe)
|
|
#
|
|
# ⚠ EXTERNAL LIBRARY IS NOT WIRED BY COMPOSE: mounting /external/photos only makes the files
|
|
# visible to the container. To actually surface them in Immich you MUST register an External
|
|
# Library pointing at /external/photos in the Immich admin UI (Administration → External
|
|
# Libraries) or via the API — a POST-DEPLOY step. Until then photos sharing is "mount ready,
|
|
# registration pending". See .felhom.yml first_steps + REPORT.
|
|
#
|
|
# First-time setup:
|
|
# Create admin account on first visit, then register the External Library (see above).
|
|
|
|
services:
|
|
immich-server:
|
|
image: ghcr.io/immich-app/immich-server:v3.2.2
|
|
container_name: immich-server
|
|
restart: unless-stopped
|
|
depends_on:
|
|
immich-postgres:
|
|
condition: service_healthy
|
|
immich-redis:
|
|
condition: service_healthy
|
|
environment:
|
|
- DB_PASSWORD=${DB_PASSWORD}
|
|
- DB_HOSTNAME=immich-postgres
|
|
- DB_USERNAME=immich
|
|
- DB_DATABASE_NAME=immich
|
|
- REDIS_HOSTNAME=immich-redis
|
|
- IMMICH_MACHINE_LEARNING_URL=http://immich-machine-learning:3003
|
|
- TZ=Europe/Budapest
|
|
volumes:
|
|
- ${HDD_PATH}/appdata/immich:/usr/src/app/upload
|
|
- ${USERDATA_PATH}/media/photos:/external/photos:ro
|
|
networks:
|
|
- traefik-public
|
|
- immich-internal
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 2048M
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-sf", "http://127.0.0.1:2283/api/server/ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.immich.rule=Host(`${SUBDOMAIN}.${DOMAIN}`)"
|
|
- "traefik.http.routers.immich.entrypoints=websecure"
|
|
- "traefik.http.routers.immich.tls=true"
|
|
- "traefik.http.routers.immich.tls.certresolver=letsencrypt"
|
|
- "traefik.http.services.immich.loadbalancer.server.port=2283"
|
|
|
|
immich-machine-learning:
|
|
image: ghcr.io/immich-app/immich-machine-learning:v3.2.2
|
|
container_name: immich-machine-learning
|
|
restart: unless-stopped
|
|
environment:
|
|
- TZ=Europe/Budapest
|
|
- TRANSFORMERS_CACHE=/cache
|
|
volumes:
|
|
- immich_ml_cache:/cache
|
|
networks:
|
|
- immich-internal
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 1536M
|
|
healthcheck:
|
|
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:3003/ping')"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 120s
|
|
|
|
immich-postgres:
|
|
image: ghcr.io/immich-app/postgres:16-vectorchord0.4.3-pgvectors0.2.0
|
|
container_name: immich-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
- POSTGRES_USER=immich
|
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
|
- POSTGRES_DB=immich
|
|
- POSTGRES_INITDB_ARGS=--data-checksums
|
|
- TZ=Europe/Budapest
|
|
volumes:
|
|
- immich_postgres_data:/var/lib/postgresql/data
|
|
networks:
|
|
- immich-internal
|
|
# 768M, not 512M (R-732, measured 2026-09-30): immich's FIRST start imports ~228 000 geodata places in up to
|
|
# 9 concurrent 5000-row INSERTs, and the database then needs ~400 MB of its own memory + ~170 MB of touched
|
|
# shared_buffers (the image's own postgresql.conf sets 512MB). At 512M it was OOM-killed 61 times on a box with
|
|
# no swap and survived on a box with swap only by swapping ~70-110 MB out. At 768M, no swap: 0 kills, peak
|
|
# anon 412 MB (54 %). Lowering shared_buffers to 128MB alone did NOT stop the kills (measured).
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 768M
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U immich -d immich"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
immich-redis:
|
|
image: redis:7-alpine
|
|
container_name: immich-redis
|
|
restart: unless-stopped
|
|
command: redis-server --appendonly yes
|
|
environment:
|
|
- TZ=Europe/Budapest
|
|
volumes:
|
|
- immich_redis_data:/data
|
|
networks:
|
|
- immich-internal
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 128M
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
|
|
volumes:
|
|
immich_ml_cache:
|
|
immich_postgres_data:
|
|
immich_redis_data:
|
|
|
|
networks:
|
|
traefik-public:
|
|
external: true
|
|
immich-internal:
|