From 1bcd5faae93e79a49352feeae4e4363d9cd7e23f Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 19 Aug 2025 16:33:03 +0100 Subject: [PATCH] Update backup-and-restore.md Added, and consolidated messaging across the md file in relation to updating the username when running scripts. --- docs/docs/administration/backup-and-restore.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/docs/administration/backup-and-restore.md b/docs/docs/administration/backup-and-restore.md index f9c00c7df7..9f8ded153a 100644 --- a/docs/docs/administration/backup-and-restore.md +++ b/docs/docs/administration/backup-and-restore.md @@ -57,6 +57,7 @@ Then please follow the steps in the following section for restoring the database ```bash title='Backup' +# Replace with the database username - usually postgres unless you have changed it. docker exec -t immich_postgres pg_dumpall --clean --if-exists --username= | gzip > "/path/to/backup/dump.sql.gz" ``` @@ -69,6 +70,7 @@ docker compose create # Create Docker containers for Immich apps witho docker start immich_postgres # Start Postgres server sleep 10 # Wait for Postgres server to start up # Check the database user if you deviated from the default +# Replace with the database username - usually postgres unless you have changed it. gunzip --stdout "/path/to/backup/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 --dbname=postgres --username= # Restore Backup @@ -78,6 +80,8 @@ docker compose up -d # Start remainder of Immich apps + Replace with the database username - usually postgres unless you have changed it. + ```powershell title='Backup' [System.IO.File]::WriteAllLines("C:\absolute\path\to\backup\dump.sql", (docker exec -t immich_postgres pg_dumpall --clean --if-exists --username=)) ``` @@ -92,7 +96,9 @@ docker compose create # Create Docker containers for docker start immich_postgres # Start Postgres server sleep 10 # Wait for Postgres server to start up docker exec -it immich_postgres bash # Enter the Docker shell and run the following command -# Check the database user if you deviated from the default. If your backup ends in `.gz`, replace `cat` with `gunzip --stdout` +# If your backup ends in `.gz`, replace `cat` with `gunzip --stdout` +# Replace with the database username - usually postgres unless you have changed it. + cat "/dump.sql" | sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" | psql --dbname=postgres --username= exit # Exit the Docker shell docker compose up -d # Start remainder of Immich apps