mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:17:11 -05:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									f7ad6efc4a
								
							
						
					
					
						commit
						1a72602ff9
					
				@ -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
 | 
					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
 | 
					## 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
 | 
					# 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 pull             # Update to latest version of Immich (if desired)
 | 
				
			||||||
docker compose create   # Create Docker containers for Immich apps without running them
 | 
					docker compose create           # Create Docker containers for Immich apps without running them
 | 
				
			||||||
docker start immich_postgres    # Start Postgres server
 | 
					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" \
 | 
					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" \
 | 
					| 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 exec -i immich_postgres psql --username=postgres  # Restore Backup
 | 
				
			||||||
docker compose up -d    # Start remainder of Immich apps
 | 
					docker compose up -d            # Start remainder of Immich apps
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</TabItem>
 | 
					</TabItem>
 | 
				
			||||||
@ -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
 | 
					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
 | 
					## 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
 | 
					# 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 pull             # Update to latest version of Immich (if desired)
 | 
				
			||||||
docker compose create   # Create Docker containers for Immich apps without running them
 | 
					docker compose create           # Create Docker containers for Immich apps without running them
 | 
				
			||||||
docker start immich_postgres    # Start Postgres server
 | 
					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
 | 
				
			||||||
gc "C:\path\to\backup\dump.sql" | docker exec -i immich_postgres psql --username=postgres   # Restore Backup
 | 
					# Check the database user if you deviated from the default
 | 
				
			||||||
docker compose up -d    # Start remainder of Immich apps
 | 
					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
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</TabItem>
 | 
					</TabItem>
 | 
				
			||||||
@ -103,6 +105,7 @@ services:
 | 
				
			|||||||
Then you can restore with the same command but pointed at the latest dump.
 | 
					Then you can restore with the same command but pointed at the latest dump.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```bash title='Automated Restore'
 | 
					```bash title='Automated Restore'
 | 
				
			||||||
 | 
					# Be sure to check the username if you changed it from default
 | 
				
			||||||
gunzip < db_dumps/last/immich-latest.sql.gz \
 | 
					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" \
 | 
					| 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
 | 
					| docker exec -i immich_postgres psql --username=postgres
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user