How am I supposed to restore a database when the service I deploy doesn't have immich-postgres?

I just recently switched from unraid to HexOS (effectively just a truenas instance) but I'm having issues trying to restore my previous backup from unraid. When starting an immich instance locally from the apps directory, I get the following docker containers: - server - pgvecto - redis - machine learning - permissions (refer to attached image) it seems to be creating some(?) postgres server somwhere on truenas that I just don't seem to have access to (or don't know where it exists) because recreating the server I can't seem to login anymore. Additionally - how am I supposed to try restoring if immich postgres doesn't exist at all?
No description
No description
No description
10 Replies
Immich
Immich•4w ago
:wave: Hey @👾 hackr, Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich :immich:. References - Container Logs: docker compose logs docs - Container Status: docker ps -a docs - Reverse Proxy: https://immich.app/docs/administration/reverse-proxy - Code Formatting https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline#h_01GY0DAKGXDEHE263BCAYEGFJA Checklist I have... 1. :ballot_box_with_check: verified I'm on the latest release(note that mobile app releases may take some time). 2. :ballot_box_with_check: read applicable release notes. 3. :ballot_box_with_check: reviewed the FAQs for known issues. 4. :ballot_box_with_check: reviewed Github for known issues. 5. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy). 6. :blue_square: uploaded the relevant information (see below). 7. :blue_square: 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) Information In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider: - Your docker-compose.yml and .env files. - Logs from all the containers and their status (see above). - All the troubleshooting steps you've tried so far. - Any recent changes you've made to Immich or your system. - Details about your system (both software/OS and hardware). - Details about your storage (filesystems, type of disks, output of commands like fdisk -l and df -h). - The version of the Immich server, mobile app, and other relevant pieces. - Any other information that you think might be relevant. Please paste files and logs with proper code formatting, and especially avoid blurry screenshots. Without the right information we can't work out what the problem is. Help us help you ;) If this ticket can be closed you can use the /close command, and re-open it later if needed.
👾 hackr
👾 hackrOP•4w ago
I don't exactly have docker compose files or a .env - so not 100% sure what to put here but I have attached all my containers, detailed the software/os. Hardware is just your typical x86 machine on the AM4 platform w 64GB DDR4 memory etc
👾 hackr
👾 hackrOP•4w ago
No description
👾 hackr
👾 hackrOP•4w ago
No description
Zeus
Zeus•4w ago
The container is pgvecto(rs) = Postgres with vectors extension In terms of how to restore it, probably best to reach out to hexos for help with that
👾 hackr
👾 hackrOP•4w ago
okay - I assumed as much, I did try to restore it via that container name but it gave me another error I lost track of - I'll send it over once I find it again.
Zeus
Zeus•4w ago
I would recommend to just direct it to hexos. We can’t really assist with super specific / locked down OSes here They’ll have to help you adapt our docker commands for however they have it setup.
👾 hackr
👾 hackrOP•4w ago
got it!
👾 hackr
👾 hackrOP•4w ago
So I didn't end up asking (yet) but I figured more stuff out and am (hopefully?) on the right path here. I can manually move the files over and everything just fine. My primary issue is the database at the moment. I read up on the documentation showing how the server shouldn't start right away etc but the immich service starts up pretty much instantaneously so I've gone ahead and made it so that I manually reset the entire system once it's been created by deleting all of the files inside of the database directory. I now have a basic instance of the database running without any of the other services up and running just yet but I'm dealing with an error along the lines of role "postgres" does not exist
No description
👾 hackr
👾 hackrOP•4w ago
(also to note, I was using version 16 of the postgres db and immich on unraid but truenas expects v 15. I'm going to try restoring down to a previous version anyways and hope that works? - if not I'm going to create a small temp vm and store my files there for the time being maybe) (I figured it out, will post updates soon in case anyone needs the instructions) Okay so here's my write-up and complete process for restoring a backup onto a TrueNAS Scale System via immich installed via the app market: A few Notes: - for my specific case, I was on postgres 16 when I had the immich service running on my unraid server - at the time of writing, the immich image available via the TrueNAS Apps Store included postgres 15 Steps: 1. install the immich app. Make sure to assign actual accessible stoage points for all the config items (except machine-learning, that one can stay as is). 2. login to the terminal (I preferred to login as truenas_admin via ssh and then sudo -s to start a session as root so I don't need to keep typing sudo and my password each time 3. using docker, stop all the services for the immich service (should be the following ones: ix-immich-server-1,ix-immich-pgvecto-1,ix-immich-machine-learning-1, and ix-immich-redis-1) [NOTE: Do not try stopping it from the UI as it also removes the containers. you need to keep them created but just showing up as "crashed" in the ui] 4. navigate to your selected database location (for me this was /mnt/SSDs/immich/database) and delete everything inside using rm -rf ./* 5. run docker start ix-immich-pgvector-1 and wait until the database is fully up and running (check status via docker ps) 6. run the following but replace items in the angled brackets with your own parameters for your system
gunzip --stdout "</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 ix-immich-pgvecto-1 psql -U immich --dbname=postgres --username=<immich> # Restore Backup
gunzip --stdout "</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 ix-immich-pgvecto-1 psql -U immich --dbname=postgres --username=<immich> # Restore Backup
7. start the rest of your docker services pertaining to immich 8. reintroduce your missing thumbnails, files, etc by copying them over smb, nfs, a literal flash drive, whatever. 9. rebuild your missing thumbnails etc that are missing and do any remaining cleanup tasks via the admin maintenance dashboard as needed

Did you find this page helpful?