mirror of
https://github.com/immich-app/immich.git
synced 2025-01-21 00:52:43 -05:00
add auto postgress dump docs (#2349)
* add auto postgress dump docs * add link to repo for auto db dumps --------- Co-authored-by: Luke McCarthy <mail@lukehmcc.com>
This commit is contained in:
parent
e22cdea485
commit
b21c99eb12
1 changed files with 40 additions and 0 deletions
|
@ -16,6 +16,46 @@ docker exec -t immich_postgres pg_dumpall -c -U postgres | gzip > "/path/to/back
|
||||||
gunzip < /path/to/backup/dump.sql.gz | docker exec -i immich_postgres psql -U postgres -d immich
|
gunzip < /path/to/backup/dump.sql.gz | docker exec -i immich_postgres psql -U postgres -d immich
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The database dumps can also be automated (using [this image](https://github.com/prodrigestivill/docker-postgres-backup-local)) by editing the docker compose file to match the following:
|
||||||
|
```
|
||||||
|
container_name: immich_postgres
|
||||||
|
image: postgres:14
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||||
|
POSTGRES_USER: ${DB_USERNAME}
|
||||||
|
POSTGRES_DB: ${DB_DATABASE_NAME}
|
||||||
|
PGDATA: /var/lib/postgresql/data
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
- ./db_dumps:/db_dumps
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
backup:
|
||||||
|
container_name: immich_db_dumper
|
||||||
|
image: prodrigestivill/postgres-backup-local
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
POSTGRES_HOST: database
|
||||||
|
POSTGRES_DB: ${DB_DATABASE_NAME}
|
||||||
|
POSTGRES_USER: ${DB_USERNAME}
|
||||||
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||||
|
SCHEDULE: "@daily"
|
||||||
|
BACKUP_NUM_KEEP: 7
|
||||||
|
BACKUP_DIR: /db_dumps
|
||||||
|
volumes:
|
||||||
|
- ./db_dumps:/db_dumps
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you can restore with the same command but pointed at the latest dump.
|
||||||
|
```bash title='Automated Restore'
|
||||||
|
gunzip < db_dumps/last/immich-latest.sql.gz | docker exec -i immich_postgres psql -U postgres -d immich
|
||||||
|
```
|
||||||
|
|
||||||
## Filesystem
|
## Filesystem
|
||||||
|
|
||||||
Immich stores two types of content in the filesystem: (1) original, unmodified content, and (2) generated content. Only the original content needs to be backed-up, which includes the following folders:
|
Immich stores two types of content in the filesystem: (1) original, unmodified content, and (2) generated content. Only the original content needs to be backed-up, which includes the following folders:
|
||||||
|
|
Loading…
Add table
Reference in a new issue