initial commit to gitea

This commit is contained in:
2025-10-28 12:04:28 -05:00
commit 3f36303a14
3 changed files with 166 additions and 0 deletions

8
.env Normal file
View File

@@ -0,0 +1,8 @@
UPLOAD_LOCATION=/srv/photos
IMMICH_VERSION=release
DB_PASSWORD=postgres
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
DB_DATA_LOCATION=./postgres
REDIS_HOSTNAME=immich_redis

76
README.md Normal file
View File

@@ -0,0 +1,76 @@
# Immich
> [!Note]
> The official backup and restore documentation for Immich is located here - https://immich.app/docs/administration/backup-and-restore/. The steps below were taken from the official documentation and adapted to our local installation.
# Backup Immich
> [!Warning]
> Do not backup the db_data_location folder while Immich is running. This will lead to a corrupt and unusable backup. Instead, use the following pg_dumpall command to get a clean and usable backup.
## Database Backup
Run the following command to backup the Immich database
``` bash
sudo docker exec -t immich_postgres pg_dumpall --clean --if-exists --username=postgres | gzip > "/mnt/5TB-Disk1/backup/server/immich/dump.sql.gz"
```
## Photo / Filesystem Backup
Run the following command to backup the photos stored in Immich. This command will place a full copy of all photos into /mnt/5TB-Disk1/backup/server/immich/photos/library. Modify the destination if you want to copy them to a different destination.
``` bash
sudo rsync -avz /photos/library /mnt/5TB-Disk1/backup/server/immich/photos/library
sudo rsync -avz /photos/upload /mnt/5TB-Disk1/backup/server/immich/photos/upload
sudo rsync -avz /photos/profile /mnt/5TB-Disk1/backup/server/immich/photos/profile
```
## Immich Config Backup
Immich configuration backup is performed in the admin web interface.
> [!note]
> This is not mentioned in the official immich documentation so it may not be necessary.
1. Click "Export as JSON" link in the top header of the page to download
2. Move the backup file to your network backup folder.
# Restore Immich
## Restore Photos / Filesystem
> [!note]
> The source path below assumes the photos are located in on the backup media and that it is mounted on `/mnt/5TB-Disk1`. Replace the rsync source if needed.
``` bash
sudo rsync -avz /mnt/5TB-Disk1/backup/server/immich/photos/library /photos/library
sudo rsync -avz /mnt/5TB-Disk1/backup/server/immich/photos/upload /photos/upload
sudo rsync -avz /mnt/5TB-Disk1/backup/server/immich/photos/profile /photos/profile
```
## Database Restore
The recommended way to backup and restore the Immich database is to use the `pg_dumpall` command. When restoring, you need to delete the `DB_DATA_LOCATION` folder (if it exists) to reset the database.
> [!warning]
> For the database restore to proceed properly, it requires a completely fresh install (i.e. the Immich server has never run since creating the Docker containers). If the Immich app has run, Postgres conflicts may be encountered upon database restoration (relation already exists, violated foreign key constraints, multiple primary keys, etc.).
``` bash
docker compose down -v # CAUTION! Deletes all Immich data to start from scratch.
# rm -rf DB_DATA_LOCATION # CAUTION! Deletes all Immich data to start from scratch.
docker compose pull # Update to latest version of Immich (if desired)
docker compose create # Create Docker containers for Immich apps without running them.
docker start immich_postgres # Start Postgres server
sleep 10 # Wait for Postgres server to start up
gunzip < "mnt/5TB-Disk1/backup/server/immich/dump.sql.gz" \
| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
| docker exec -i immich_postgres psql --username=postgres # Restore Backup
docker compose up -d # Start remainder of Immich apps
```
## Authors and acknowledgment
See https://immich.app and https://github.com/immich-app/immich

82
docker-compose.yml Normal file
View File

@@ -0,0 +1,82 @@
#
# WARNING: To install Immich, follow our guide: https://docs.immich.app/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:
container_name: immich_server
labels:
- "com.centurylinklabs.watchtower.monitor-only=true"
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
# extends:
# file: hwaccel.transcoding.yml
# service: cpu # 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
- ${UPLOAD_LOCATION}:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
env_file:
- stack.env
ports:
- 2283:2283
depends_on:
- redis
- database
restart: always
healthcheck:
disable: false
immich-machine-learning:
container_name: immich_machine_learning
labels:
- "com.centurylinklabs.watchtower.monitor-only=true"
# 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:-release}
# extends: # uncomment this section for hardware acceleration - see https://docs.immich.app/features/ml-hardware-acceleration
# file: hwaccel.ml.yml
# service: cpu # set to one of [armnn, cuda, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the `-wsl` version for WSL2 where applicable
volumes:
- model-cache:/cache
env_file:
- stack.env
restart: always
healthcheck:
disable: false
redis:
container_name: immich_redis
labels:
- "com.centurylinklabs.watchtower.monitor-only=true"
image: docker.io/valkey/valkey:8-bookworm@sha256:fea8b3e67b15729d4bb70589eb03367bab9ad1ee89c876f54327fc7c6e618571
healthcheck:
test: redis-cli ping || exit 1
restart: always
database:
container_name: immich_postgres
labels:
- "com.centurylinklabs.watchtower.monitor-only=true"
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:41eacbe83eca995561fe43814fd4891e16e39632806253848efaf04d3c8a8b84
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: '--data-checksums'
# Uncomment the DB_STORAGE_TYPE: 'HDD' var if your database isn't stored on SSDs
# DB_STORAGE_TYPE: 'HDD'
volumes:
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
shm_size: 128mb
restart: always
volumes:
model-cache: