Files
immich/compose.yml
autonomic-bot a846cf38dc
Some checks failed
cc-ci/testme cc-ci: failure
fix(backup): back up the postgres database (was unprotected)
The immich recipe declared backupbot.backup only on the app service (whose volumes
are all excluded), so the postgres database — all of immich users metadata, albums,
people, settings — was NOT backed up at all. Restoring a backup yielded an empty DB.

Add a database-service postgres backup mirroring the coop-cloud convention
(matrix-synapse, keycloak, ...): a /pg_backup.sh config-mounted hook driven by
backupbot pre/restore hooks. backup = pg_dump | gzip -> backup.sql in the postgres
volume; restore = terminate immich-server connections, FORCE-drop, recreate, reimport
(the VectorChord/pgvecto.rs extensions and all data round-trip cleanly).
2026-05-29 22:56:10 +00:00

100 lines
2.7 KiB
YAML

---
version: "3.8"
services:
app:
image: ghcr.io/immich-app/immich-server:v2.7.5
volumes:
- uploads:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
environment:
- TZ
- IMMICH_VERSION
- DB_PASSWORD_FILE=/run/secrets/db_password
- DB_USERNAME
- DB_DATABASE_NAME
secrets:
- db_password
networks:
- proxy
- backend
healthcheck:
disable: false
depends_on:
- redis
- database
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=2283"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
- "coop-cloud.${STACK_NAME}.version=1.6.0+v2.7.5"
- "backupbot.backup=${ENABLE_BACKUPS:-true}"
- "backupbot.volumes.model-cache=false"
- "backupbot.volumes.uploads=false"
- "backupbot.volumes.external_storage=false"
immich-machine-learning: # TODO: this has to be that name, as the frontend tries to reach it at: http://immich-machine-learning:3003
image: ghcr.io/immich-app/immich-machine-learning:v2.7.5
volumes:
- model-cache:/cache
networks:
- backend
healthcheck:
disable: false
redis:
image: docker.io/valkey/valkey:9@sha256:3b55fbaa0cd93cf0d9d961f405e4dfcc70efe325e2d84da207a0a8e6d8fde4f9
healthcheck:
test: redis-cli ping || exit 1
networks:
- backend
database:
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:bcf63357191b76a916ae5eb93464d65c07511da41e3bf7a8416db519b40b1c23
environment:
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: '--data-checksums'
DB_STORAGE_TYPE: ${DB_STORAGE_TYPE:-SSD}
secrets:
- db_password
volumes:
- postgres:/var/lib/postgresql/data
networks:
- backend
deploy:
labels:
backupbot.backup: "${ENABLE_BACKUPS:-true}"
backupbot.backup.pre-hook: "/pg_backup.sh backup"
backupbot.backup.volumes.postgres.path: "backup.sql"
backupbot.restore.post-hook: "/pg_backup.sh restore"
configs:
- source: pg_backup
target: /pg_backup.sh
mode: 0555
configs:
pg_backup:
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
file: pg_backup.sh
secrets:
db_password:
external: true
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
networks:
proxy:
external: true
backend:
volumes:
uploads:
postgres:
model-cache: