Umbrel 1.1 - Immich database restore

Hello,

how to restore Immich database backup on Umbrel 1.1?

docker compose down -v  # 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 < "/path/to/backup/dump.sql.gz" | docker exec -i immich_postgres psql --username=postgres    # Restore Backup
docker compose up -d    # Start remainder of Immich apps

I found here:

that docker and docker compose cannot be controlled directly, but how to execute above command with umbreld client? Is it even currently possible?

You can do this by doing something like:

  1. Acessing the terminal

  2. Executing this command:
    cd /data/umbrel-os/home/umbrel/umbrel/app-data/immich/ and the ls. Doing that, you will be able to see the docker-compose.

@Tomas did you figure out how it works? I’m not able to restore it

No :cry: I ended up importing the photos with Immich Go and creating the library from scratch: GitHub - simulot/immich-go: An alternative to the immich-CLI command that doesn't depend on nodejs installation. It tries its best for importing google photos takeout archives.

Too bad, thanks for replying. Than I hope it newer brakes, before there is a easier way of backing up.

1 Like

I just managed to do this, so here is my steps.

  • Require additional machine with SSH client
  • Working SSH to umbrel server (not in scope)
  • The immich dump.sql available via storage. You need local file system access to it.
  1. SSH to umbrel server
  2. stop all the immich services, excluding postgres
sudo docker stop immich_server_1 immich_redis_1 immich_machine-learning_1 immich_app_proxy_1
  1. Enter the postgres docker instance.

sudo docker exec -it immich_postgres_1 /bin/bash

Now run these commands inside it: (basically using pgsql to delete the existing db)

3.1 psql -U immich postgres

you should see this:

psql (14.10 (Debian 14.10-1.pgdg120+1))
Type "help" for help.

postgres=# 

3.2 list existing db’s

\l

you should see immich listed. Now delete it

DROP DATABASE immich;

result: use \l and you should not see immich db anymore. if it still shows, you are wrong. try the db username as : postgres as in psql -U postgres postgres

now create a blank db:

create database immich;

3.4 exit pgsql using exit and then the docker again using exit

So, now you should be back at the umbrel server prompt. You can now run the db import / restore

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" | sudo docker exec -i immich_postgres_1 psql --username=postgres

you need to place the root of your old server files here: /data/umbrel-os/home/umbrel/umbrel/app-data/immich/data/upload/

reboot