From 1a72602ff9641f5ec8f28a725e665ff95d4dcf09 Mon Sep 17 00:00:00 2001 From: Joren Guillaume Date: Wed, 9 Oct 2024 17:37:47 +0200 Subject: [PATCH] docs: Add DB name to backup-and-restore (#13244) * Update backup-and-restore.md changelog: Add database name to the restore command and document it in the notes * docs: remove added database flag and change warn wording * docs: fix forgotten warning change Co-authored-by: Matthew Momjian <50788000+mmomjian@users.noreply.github.com> --------- Co-authored-by: Matthew Momjian <50788000+mmomjian@users.noreply.github.com> --- .../docs/administration/backup-and-restore.md | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/docs/docs/administration/backup-and-restore.md b/docs/docs/administration/backup-and-restore.md index 860b1e1ce7426..19d716643b414 100644 --- a/docs/docs/administration/backup-and-restore.md +++ b/docs/docs/administration/backup-and-restore.md @@ -34,14 +34,15 @@ docker exec -t immich_postgres pg_dumpall --clean --if-exists --username=postgre docker compose down -v # CAUTION! Deletes all Immich data to start from scratch ## Uncomment the next line and replace DB_DATA_LOCATION with your Postgres path to permanently reset the Postgres database # 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 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 +sleep 10 # Wait for Postgres server to start up +# Check the database user if you deviated from the default gunzip < "/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 --username=postgres # Restore Backup -docker compose up -d # Start remainder of Immich apps +| docker exec -i immich_postgres psql --username=postgres # Restore Backup +docker compose up -d # Start remainder of Immich apps ``` @@ -55,12 +56,13 @@ docker exec -t immich_postgres pg_dumpall --clean --if-exists --username=postgre docker compose down -v # CAUTION! Deletes all Immich data to start from scratch ## Uncomment the next line and replace DB_DATA_LOCATION with your Postgres path to permanently reset the Postgres database # Remove-Item -Recurse -Force 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 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 -gc "C:\path\to\backup\dump.sql" | docker exec -i immich_postgres psql --username=postgres # Restore Backup -docker compose up -d # Start remainder of Immich apps +sleep 10 # Wait for Postgres server to start up +# Check the database user if you deviated from the default +gc "C:\path\to\backup\dump.sql" | docker exec -i immich_postgres psql --username=postgres # Restore Backup +docker compose up -d # Start remainder of Immich apps ``` @@ -103,6 +105,7 @@ services: Then you can restore with the same command but pointed at the latest dump. ```bash title='Automated Restore' +# Be sure to check the username if you changed it from default gunzip < db_dumps/last/immich-latest.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