Restore DB help

I was previously running immich using the https://github.com/imagegenius/docker-immich compose. I have the backup which used a different docker container name and postgres user.
I have now provisioned a new Docker LXC and have deployed the stock compose per https://documentation.immich.app/docs/install/docker-compose using the default container names and postgres user. I ran the restore immediately after the initial install before opening the app per https://documentation.immich.app/docs/administration/backup-and-restore. When I then open the web app, I am able to log in with the user from my backed up db which I thought meant the restore worked. The issue is none of the thumbnails show and opening the image also doesn't work (just a black screen). The metadata looks in tack and all my albums are also available, again with no thumbnails though. I tried running the Generate Thumbnails job but that had no effect (even though it re-ran for All). Hoping someone can help me restore properly. Thanks in advance.
No description
22 Replies
di5cord20
di5cord20OP2y ago
One potential clue (which I don't know how to solve), is the imagegenius version docker-compose used a
- path_to_photos:/photos
- path_to_photos:/photos
volume. Looking at the immich_server logs, I see lots of errors like
ERROR [ExceptionsHandler] ENOENT: no such file or directory, stat '/photos/thumbs/eecc2146-1d4c-4f56-9a08-81e224dbd49f/01/4d/014d2665-37c9-4bce-8463-18e07adf5d20.jpeg'
ERROR [ExceptionsHandler] ENOENT: no such file or directory, stat '/photos/thumbs/eecc2146-1d4c-4f56-9a08-81e224dbd49f/01/4d/014d2665-37c9-4bce-8463-18e07adf5d20.jpeg'
.
Again, not sure if related, but likely. Still looking for help/guidance as I don't know how to fix.
jrasm91
jrasm912y ago
@martabal
martabal
martabal2y ago
Yes the assets paths in your database does not match the paths in the container I suppose you have to change ./upload in your docker-compose.yml to /photos and add IMMICH_MEDIA_LOCATION=/photos in your .env
di5cord20
di5cord20OP2y ago
Thanks for the quick reply and direction. I'll change
${UPLOAD_LOCATION}:/usr/src/app/upload
${UPLOAD_LOCATION}:/usr/src/app/upload
to
${UPLOAD_LOCATION}:/photos
${UPLOAD_LOCATION}:/photos
for both the immich-server and immich-microservices containers in the docker-compose. The IMMICH_MEDIA_LOCATION variable doesn't exist in my .env nor is it referenced in the docker-compose. I can certainly add it to the .env, but where would I update the docker-compose to leverage?
di5cord20
di5cord20OP2y ago
also, do I just run the Restore steps again as per https://documentation.immich.app/docs/administration/backup-and-restore#:~:text=dump.sql.gz%22-,Restore,-docker%2Dcompose%20down once I've updated both the docker-compose and .env?
jrasm91
jrasm912y ago
The docker compose has a env_file thing which passes all the settings to the containers
martabal
martabal2y ago
Just bring the stack down and up with the env and it should update it
jrasm91
jrasm912y ago
You should see it on the server and microservices containers
di5cord20
di5cord20OP2y ago
it worked! Thanks so much for the speedy and accurate support. I'm assuming I can delete the IMMICH_MEDIA_LOCATION variable added to the .env as I don't think it was used. No harm in leaving it there either... just prefer to keep things clean where possible.
jrasm91
jrasm912y ago
It is 100% used and will stop working if you remove it.
di5cord20
di5cord20OP2y ago
I'm curious, where is it referenced if not in the docker-compose?
di5cord20
di5cord20OP2y ago
sorry, to clarify, I know the .env is used and required :). My question is specific to the IMMICH_MEDIA_LOCATION variable I added to the .env as per @martabal instructions. Is that specific variable used somewhere outside of the docker-compose and thus needed? I couldn't find any references for that variable in the compose (although I visually scanned so may have missed it).
jrasm91
jrasm912y ago
It is used in the codebase yes
jrasm91
jrasm912y ago
Environment Variables | Immich
To change environment variables, you must recreate the Immich containers.
di5cord20
di5cord20OP2y ago
got it. thanks again for all your help. Immich and the support are both awesome!
di5cord20
di5cord20OP2y ago
hmm... does that mean I should have not updated the docker-compose and adding the variable to .env was all I needed? Again, just looking to understand and ensure I haven't broken anything
jrasm91
jrasm912y ago
So the path in the database that was restored start with /photos etc To make it continue to work, you need the volume mount to be updated so the photos show up at /photos For new files, unless you set the new env variable, the files will be stored at a new location, not the volume mount, which seems not what you want I guess it's really the original /usr/src/app/upload, the previous value, not the new one, which you just added to change it to /photos
di5cord20
di5cord20OP2y ago
yup, that's the change I made for both containers from:
${UPLOAD_LOCATION}:/usr/src/app/upload
${UPLOAD_LOCATION}:/usr/src/app/upload
to
${UPLOAD_LOCATION}:/photos
${UPLOAD_LOCATION}:/photos
jrasm91
jrasm912y ago
Yes that will fix existing files. The env change makes it so new files are written to that directory as well, instead of the default folder
di5cord20
di5cord20OP2y ago
amazing!!!

Did you find this page helpful?