#Database restore not working as per docs?

1 messages · Page 1 of 1 (latest)

true depot
#

Hello,

I'm trying to migrate Immich to a new device. I've copied my immich folder (excluding the data folder as that's in a docker volume) and migrated the docker-compose and .env files. Then, I made the pg dump as specified in the docs. Now, I'm trying to restore from it and I keep on getting errors.

Here's my .env file:

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=/media/toshi/immich-data

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=v1.111.0

# Connection secret for postgres. You should change it to a random password
DB_PASSWORD=postgres

# The values below this line do not need to be changed
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres_immich
DB_DATABASE_NAME=immich

REDIS_HOSTNAME=immich_redis```

These are the commands in question I'm running:

gunzip < "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 -e PGPASSWORD=postgres -i immich_postgres psql --username=postgres_immich --dbname=immich # Restore Backup


And this is the output:

| 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 -e PGPASSWORD=postgres -i immich_postgres psql --username=postgres_immich --dbname=immich # Restore Backup
ERROR: syntax error at or near "pg_dumpall"
LINE 1: pg_dumpall: error: connection to server on socket "/var/run/...


What am I doing wrong?
graceful trenchBOT
#

:wave: Hey @true depot,

Thanks for reaching out to us. Please follow the recommended actions below; this will help us be more effective in our support effort and leave more time for building Immich immich.

References

Checklist

  1. :blue_square: I have verified I'm on the latest release(note that mobile app releases may take some time).
  2. :ballot_box_with_check: I have read applicable release notes.
  3. :ballot_box_with_check: I have reviewed the FAQs for known issues.
  4. :ballot_box_with_check: I have reviewed Github for known issues.
  5. :ballot_box_with_check: I have tried accessing Immich via local ip (without a custom reverse proxy).
  6. :ballot_box_with_check: I have uploaded the relevant logs, docker compose, and .env files, making sure to use code formatting.
  7. :blue_square: I have tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable

(an item can be marked as "complete" by reacting with the appropriate number)

If this ticket can be closed you can use the /close command, and re-open it later if needed.

hearty reef
#

Can you post the first few lines of the sql dump? It looks like there's a literal error message in the file

true depot
#

Ah.. I never realized unzipping the file would make me able to just read it and see an error there.. that explains it
pg_dumpall: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "postgres" does not exist

#

I'm gonna try to get it done properly now

#

Well that was easy.. thanks for that ^^