rutherford Posted October 6, 2023 Share Posted October 6, 2023 (edited) Looks like the dev didn't add a thread to the Docker support area, so I'm going to start this thread. Space Invader One howto's part 1: A closer look at Immich before you switch youtube part 2: how to actually set it up youtube support at github for us unRaiders, the docker template in Community Applications read me first project home also at github https://immich.app/ github v1.95.0 release notes I installed Spaceinvader1's Docker "PostgreSQL_Immich" You DO have to change the tensorchord Repository to "tensorchord/pgvecto-rs:pg16-v0.2.0" I believe you have to setup the initial database. Drop into the PostgreSQL_Immich Docker Command Line Interface CLI, left click on the docker image, select >_Console # psql -U postgres -W Password: psql (15.5 (Debian 15.5-1.pgdg120+1)) Type "help" for help. postgres=# CREATE USER immich WITH PASSWORD 'immichpass'; CREATE ROLE postgres=# CREATE DATABASE immichdb TEMPLATE template0 ENCODING 'UNICODE'; CREATE DATABASE postgres=# ALTER DATABASE immichdb OWNER TO immich; ALTER DATABASE postgres=# GRANT ALL PRIVILEGES ON DATABASE immichdb TO immich; GRANT postgres=# ALTER USER immich WITH SUPERUSER; ALTER ROLE postgres=# (*re SUPERUSER: i was getting the "earthdistance" error in immich logs, and that additional command seemed to sort that out) reverse proxy. cool, SWAG included a template for it! cd /mnt/user/appdata/swag/nginx/proxy-confs cp immich.subdomain.conf.sample immich.subdomain.conf nano immich.subdomain.conf couple of changes in here: this is your subdomain. I'm using photos.mydomain.com server_name immich.*; to server_name photos.*; this is the name of our docker. Mine's called "immich". This is in two spots in the file. set $upstream_app immich-server; to set $upstream_app immich; correct the port. I had to change mine to 8081. Also two places in the file. set $upstream_port 3001; to set $upstream_port 8080; There is some wizardry happening here. I'm sure it's supposed to be 8081. That's what I'm looking at when, locally, I hit the web GUI and it goes to http://192.168.11.54:8081/. BUT the SWAG .conf file has the 8081. In fact, if I go to http://192.168.11.54:8080, I get sabnzbd. <shrug> That should be it, you should be up and running. As immich is "under heavy development" you want to turn off auto-update so you don't discover a busted install randomly. Install Squid's "Auto Update Applications". This will enable: unraid gui > Settings > Auto update applications (scroll to bottom of page) > Docker auto update settings <tab> Turn off Immich Autoupdate. BACKUP BACKUP BACKUP This is the first dive into IRRIPLACEABLE self-hosted files. If you use Immich, and it's got pics of your kid in it, that would be SUPER BUMMER if you lost your stuff (my github request). Here's my backup system: install CA > "user scripts" also from Squid This will enable unraid gui > Settings > User Scripts (scroll down) alright! Here come these scripts: New script. Gear > Edit script This one is "backup postgresql DBs" #!/bin/bash ############################## ## VARIABLES ## ############################## DATE=$(date +"%Y-%m-%d.%H%M") BACKUP_DIR="/mnt/disks/TOSHIBA_EXTERNAL_USB/unraid-postgresql" EMAIL="[email protected]" # Perform the database backup docker exec -t PostgreSQL_Immich pg_dumpall -c -U postgres | gzip > $BACKUP_DIR/$DATE.PostgreSQL_Immich.sql.tar.gz # Rotate backups to keep the 7 most recent ls -t $BACKUP_DIR/*Immich.sql.tar.gz | tail -n +8 | xargs rm -f # Perform the database backup docker exec -t postgresql15 pg_dumpall -c -U postgres | gzip > $BACKUP_DIR/$DATE.postgresql15_nextcloud.sql.tar.gz # Rotate backups to keep the 7 most recent ls -t $BACKUP_DIR/*nextcloud.sql.tar.gz | tail -n +8 | xargs rm -f this one is called "immich" #!/bin/bash rsync -av --progress /mnt/user/memories/immich/library /mnt/disks/TOSHIBA_EXTERNAL_USB/immich rsync -av --progress /mnt/user/memories/immich/upload /mnt/disks/TOSHIBA_EXTERNAL_USB/immich rsync -av --progress /mnt/user/memories/immich/profile /mnt/disks/TOSHIBA_EXTERNAL_USB/immich The first one does a pg_dump from the immich database into a compressed .tar.gz file, that I like. I also like the date naming convention. Makes me feel good seeing all those dates in my file list. I copy this stuff to an external USB drive that I mount via Unassigned Devices. This is the source docs that are important https://immich.app/docs/administration/backup-and-restore The backup of the actual jpgs and mov files happens in the "immich" script via rsync, and just copies the stuff over to that external drive. In the future, I'm going to setup a syncthing with a buddy to copy EVERYTHING over to his server. Syncthing at unraid forums Also: do a dry run on a backup and restore. I've had to do this twice, and I hate it, but it happened with those breaking updates I referenced above. Good luck! Be safe. Profit. Below is old stuff. Might help someone who's in the weeds. =========================================================================================== Working now, here's my setup. installed docker "immich" ghcr.io/imagegenius/immich, imagegenius. Via regular unRaid APPS tab. Had to change default port from 8080 to 8081 installed docker "postgresql14" library/postgres:14, jj9987 installed docker "redis" library/redis, jj9987 Setup SWAG reverse proxy remember to change "Network Type" on the immich Docker to whatever your proxy dockers use. created /mnt/user/appdata/swag/nginx/proxy-confs/immich.subdomain.conf Spoiler server { listen 443 ssl; listen [::]:443 ssl; server_name photos.*; include /config/nginx/ssl.conf; client_max_body_size 0; location / { include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; set $upstream_app immich; set $upstream_port 8080; set $upstream_proto http; proxy_pass $upstream_proto://$upstream_app:$upstream_port; } For some reason this would only work pointing to 8080, vs the unraid-local-ip:8081 My subdomain is photos.mywebsite.com You also need to add "photos" or whatever your subdomain is gonna be, to the field in Docker SWAG Setup Importing the Google Takeout. I had 10 files at 50GB each. I extracted each of the zip files into the same folder. Windows combined the folders and files just fine. Did a couple test runs with a handful of folders to make sure it worked. I tried github simulot immich go, but it made way too many mis-dated imports. hundreds and hundreds of pics from year 0, or maybe it was year 36947... so I went along with github mattwilson1024 google photos exif. The trick here is that I'm on Windows 11, and can't run this stuff. So I installed Git For Windows. That gave me yarn from the cmd.exe command line. It also installed some other cli program, "git bash" and "git CMD," but I had the command yarn in the regular CLI after installing Git For Windows, so I just went with that. From the mattwilson git page, green Code button, download ZIP file. Unzipped that to the desktop, gave me files and folders. I created a couple more folders Desktop/processed, Desktop/failed, and the source was Desktop/takeout. Go into C:\Users\user\Desktop\google-photos-exif-master ran "yarn". It did some stuff. then the longer command that started flying through all my stuff: yarn start --inputDir "C:\Users\user\Desktop\takeout" --outputDir "C:\Users\user\Desktop\processed" --errorDir "C:\Users\user\Desktop\error" I had 687 files in my error directory (143k in processed directory), only about 1/2% error rate. <meh> Following along with directions in the immich post here, I'll call it post 1340, I run exiftool (github) on the problem files in error directory. It's a perl program. Happily, perl came along with the MINGW64 git-hub for windows thingy. $ perl exiftool -all= -tagsfromfile @ -all:all -unsafe -icc_profile /d/error/ Looks like most of the errors are from screenshots that saved as PNG but exiftool reports "Error: Not a valid PNG, looks more like a JPG" <shrug> I am a little concerned that all my albums will be gone. At the moment, all the files in d/processed have gone into that folder with zero subfolders at all. The immich post 1340 says I have to deal with all my albums first individually. Hmmmm, I hope the google-photos-exif mattwilson1024 tool did something and added some gallery meta data into the files... we'll see. hmmm 1 directories scanned 68 image files updated 270 files weren't updated due to errors $ yarn start --inputDir "/d/error/" --outputDir "/d/processed2/" --errorDir "/d/error2/" nice! That went through nicely and ended up with: 30 error files and their other weird data files. Mostly HEIC files. sorted another 347 files. Half videos looks like. Manually move those 347 into the /d/processed folder Move external drive to server. Something got borked with the postgres connection. The unRaid>Immich>logs are showing loads of failure to connect [Nest] 921 - 10/25/2023, 11:29:57 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (3)... error: password authentication failed for user "postgres" But: I get into the postgres container, and am able to connect via psql no problem. I'll try creating a different database, user and pass see if that helps. This database is already populated, and the error reporting might be dog shit (user auth error vs database full error) That worked. Got a few errors (watching log go by) about undefined request failed with HTTP code 503, but after less than a minute it sorted itself out. Start regular immich import for the whole kitten-caboodle. badda bing This process loses all the albums. I forget where the details were for preserving albums. I think it's below in my "history stuff." Most important source is our unRaid github docker maintainer page https://github.com/imagegenius/docker-immich =====================history stuff below here======================== Wiping current setup, starting from https://documentation.immich.app/docs/install/unraid already a couple of changes in there Editing /boot/config/plugins/compose.manager/projects/Immich/.env added DB_PORT=5432 TYPESENSE_API_KEY=xxxxxxxxxxxx DB_PASSWORD=xxxxxxxxxxxx # The values below this line do not need to be changed ################################################################################### DB_HOSTNAME=xxx.xxx.xxx.xxx DB_USERNAME=xxxxxxxxxxxx DB_DATABASE_NAME=xxxxxxxxxxxx DB_PORT=5432 Another question here: from the documentation.immich.app unraid stuff "if you're using an existing database docker click here..." I can do this without using an external Postgres14 docker??? Seems like that would be easier. Will it be as good/fast? From other installations that can use mysql, it's supposed to be faster to setup a mysql connection, otherwise it will use a flat-file or built in sql-express or something to organize itself but it's not supposed to be as good. And, follow up, how many thousands of entries will I have to have (entries = pics,vids) for it to be noticeable? Finished that piece, clicked Save Changes and Compose Up. My pop-up window went immediately to Connection Closed, and Done. I go to unRaid Docker page, and there's nothing in there. So much for several minutes depending on my hardware... hmmmm I do still see the Immich entry at the bottom of the Docker page under the Compose section, but it doesn't look like the picture. Going to try this again from defaults, and NOT using that external PostgreSQL container... there we go, now something is happening. I must've edited a file incorrectly. Now on unRaid Docker page I have "several entries," namely: 8 of them: 1. immich_machine_learning 2. immich_microservices 3. immich_postgres 4. immich_proxy 5. immich_redis 6. immich_server 7. immich_typesense 8. immich_web Immich docker requires PostgreSQL 14, I installed that docker with defaults (unraidstaticIP:5432). Must set password. requires REDIS, I already have that installed. Used defaults - though I have no idea what the password is, if I ever set one to connect to REDIS. Need to connect to Postgres database. Error message from Immich Log [Nest] 1002 - 10/06/2023, 9:50:14 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (3)... error: database "immich" does not exis So I supposed I'll have to connect myself, create database and username etc. click unraid GUI > Dashboard > Postgresql > commandline # psql -U postgres -W<enter> Password: psql (14.9 (Debian 14.9-1.pgdg120+1)) Type "help" for help. postgres=# create database immich;<enter> CREATE DATABASE postgres=# create user immuser with encrypted password 'thispass';<enter> CREATE ROLE postgres=# grant all privileges on database immich to immuser;<enter> GRANT postgres=# \q<enter> # exit<enter> you should have set password on your Docker Settings for postgreSQL 14 Immich docker not quite running yet, getting weird error Quote [Nest] 2865 - 10/06/2023, 9:51:40 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (9)... QueryFailedError: relation "migrations" already exists at PostgresQueryRunner.query (/app/immich/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async PostgresQueryRunner.executeQueries (/app/immich/server/node_modules/typeorm/query-runner/BaseQueryRunner.js:424:13) at async PostgresQueryRunner.createTable (/app/immich/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:410:9) at async MigrationExecutor.createMigrationsTableIfNotExist (/app/immich/server/node_modules/typeorm/migration/MigrationExecutor.js:351:13) at async MigrationExecutor.executePendingMigrations (/app/immich/server/node_modules/typeorm/migration/MigrationExecutor.js:129:9) at async DataSource.runMigrations (/app/immich/server/node_modules/typeorm/data-source/DataSource.js:260:35) at async DataSource.initialize (/app/immich/server/node_modules/typeorm/data-source/DataSource.js:148:17) [Nest] 2865 - 10/06/2023, 9:51:40 PM ERROR [ExceptionHandler] relation "migrations" already exists QueryFailedError: relation "migrations" already exists real similar to this https://github.com/nextcloud/docker/issues/1529#issuecomment-875552116 SWAG proxy setup. There is no template for Immich, so I used /mnt/user/appdata/swag/nginx/proxy-confs/_template.subdomain.conf.sample created /mnt/user/appdata/swag/nginx/proxy-confs/immich.subdomain.conf * below, I had changed the Immich Docker template from 8080 to 8081, already had a service on 8080. I'm still getting a "welcome to your SWAG instance" boiler plate page, the Immich Docker isn't really up yet I think. server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name immich.*; include /config/nginx/ssl.conf; client_max_body_size 0; location / { include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; set $upstream_app immich; set $upstream_port 8081; set $upstream_proto https; proxy_pass $upstream_proto://$upstream_app:$upstream_port; } https://github.com/imagegenius/docker-immich https://immich.app/docs/install/unraid https://www.reddit.com/r/selfhosted/comments/x44qzi/immich_on_unraid/ Edited March 29 by rutherford 1 2 Quote Link to comment
rutherford Posted October 13, 2023 Author Share Posted October 13, 2023 In the future, I'd like to see the Docker template a little better formatted, and hardware acceleration options. Also: how to begin the big Google photo migration would be great too. Quote Link to comment
talmania Posted November 26, 2023 Share Posted November 26, 2023 Thank you for sharing your config. I was having a helluva time getting swag to work with Immich inspite of the fact I host tons of other apps and domains and sure enough when I used 8080 (instead of the 8081 I was redirecting to) it started working. Really appreciate you sharing your notes here as this one has been a struggle. Thank you! 1 Quote Link to comment
rutherford Posted November 27, 2023 Author Share Posted November 27, 2023 (edited) So new complication: our Immich docker now says it required Postgresql15. yay. Got postgresql15 installed with following settings: You can see I changed the port so it's available in parallel with the other postres14 docker. Dropped into the postgresql15 Console # pg_dump -h <myserverIP> -p 5432 -U postgres immichdb > immichdb5.sql this is also where my postgresql14 port is 5432. I was prompted for the postgres userpass, entered it. postgres=# create database immichdb; CREATE DATABASE postgres=# create user immichuser with encrypted password 'immichpass'; CREATE ROLE postgres=# grant all privileges on database immichdb to immichuser; GRANT postgres=# then ran this command psql -U immichuser immichdb < immichdb5.tar I've been getting fail after fail here..... Oooo got it. I ended up installing pgAdmin4 (available in unRaid Apps the dpage version) to manage these two database dockers. Setup connections to both, and used the Backup and Restore from inside those. The only thing I can think of that I did differently here was setup identical database, user, and userpass. I'm thinking those were hardcoded somewhere into the v14 database. ?? change port on Immich docker from 5432 to 5433. Wait for it to come up... This always takes a couple minutes for me. Seems to have worked. I'll take the old postgresql14 docker down, make sure it keeps working... yup. we're good to go on postgres15. whew. I'm going to tack this problem solution into this reply of this thread as well. It related to postgres15. The post I made at github. I was getting an error in my immich log 2023-12-07 21:02:20.914 PST [29601] ERROR: permission denied to create extension "earthdistance" 2023-12-07 21:02:20.914 PST [29601] HINT: Must be superuser to create this extension. Alright so how to add SUPERUSER to my existing immich database user. Spoiler I wanted to elaborate for posterity here for those that aren't as familiar with databases. I certainly am not, but I managed to hack my way to a working solution. To connect to your postgres15 instance, you need to get into the console that is connected to the docker. When you run the command psql, or "which psql" you will get positive results, rather than Unknown command. Once you get into the postgres15 docker command line (click on the postgres15 docker icon, select >_Console), here are some commands that will be helpful. BTW: I had a setting that will accept any connection from local, so the passwords didn't matter. I left that as is for now. # psql -U postgres psql (15.5 (Debian 15.5-1.pgdg120+1)) Type "help" for help. postgres=# That command is psql -U postgres. Remember password doesn't matter, -U, capitol U, specifies this user postgres, which is the default SUPERUSER on the postgres instance. postgres=# \list List of databases Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges -----------+------------+----------+------------+------------+------------+-----------------+------------------------------ immichdb | immichuser | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =Tc/immichuser + | | | | | | | immichuser=C*T*c*/immichuser postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres + | | | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres + | | | | | | | postgres=CTc/postgres (4 rows) List all the databases, good: immichdb is there. postgres=# \du List of roles Role name | Attributes | Member of ------------+------------------------------------------------------------+----------- immichuser | | {} postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} that command \du, shows the users and their permissions. A hah, immichuser has diddly. postgres=# ALTER USER immichuser WITH SUPERUSER; ALTER ROLE Double checked that it worked with \du<enter>. Sure enough, immichuser is now SUPERUSER. Errors gone Edited December 8, 2023 by rutherford 1 Quote Link to comment
talmania Posted November 27, 2023 Share Posted November 27, 2023 (edited) There's conflicting information on Immich's site about what version is required (some spots say 14, others 15)--having just installed it I went with postgres15 so I guess I lucked out. Edited November 27, 2023 by talmania Quote Link to comment
martabal Posted November 28, 2023 Share Posted November 28, 2023 Currently, the postgres version doesn't matter 1 Quote Link to comment
martabal Posted November 28, 2023 Share Posted November 28, 2023 The only thing with postgres is that you manage the major version upgrade. Before moving from postgres 14 to postgres 15, you have to export your databases from postgres 14 and import your export in postgres 15 1 Quote Link to comment
EvilNievel Posted December 17, 2023 Share Posted December 17, 2023 i have install yesterday the immich container but after i update today i have a Error [Nest] 3102 - 12/17/2023, 9:50:17 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... QueryFailedError: extension "vectors" is not available at PostgresQueryRunner.query (/app/immich/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async UsePgVectors1700713871511.up (/app/immich/server/dist/infra/migrations/1700713871511-UsePgVectors.js:19:9) at async MigrationExecutor.executePendingMigrations (/app/immich/server/node_modules/typeorm/migration/MigrationExecutor.js:225:17) at async DataSource.runMigrations (/app/immich/server/node_modules/typeorm/data-source/DataSource.js:260:35) at async DataSource.initialize (/app/immich/server/node_modules/typeorm/data-source/DataSource.js:148:17) anyone know what i have to do? Quote Link to comment
riff.79 Posted December 17, 2023 Share Posted December 17, 2023 (edited) 2 hours ago, EvilNievel said: i have install yesterday the immich container but after i update today i have a Error [Nest] 3102 - 12/17/2023, 9:50:17 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... QueryFailedError: extension "vectors" is not available at PostgresQueryRunner.query (/app/immich/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async UsePgVectors1700713871511.up (/app/immich/server/dist/infra/migrations/1700713871511-UsePgVectors.js:19:9) at async MigrationExecutor.executePendingMigrations (/app/immich/server/node_modules/typeorm/migration/MigrationExecutor.js:225:17) at async DataSource.runMigrations (/app/immich/server/node_modules/typeorm/data-source/DataSource.js:260:35) at async DataSource.initialize (/app/immich/server/node_modules/typeorm/data-source/DataSource.js:148:17) anyone know what i have to do? Check out https://github.com/imagegenius/docker-immich/issues/254 - it has a new Postgres repository as they are now using a plugin that is not in the default package. Edited December 17, 2023 by riff.79 Quote Link to comment
robinh Posted December 17, 2023 Share Posted December 17, 2023 Ye you have to change your postgres repository to: tensorchord/pgvecto-rs:pg14-v0.1.11 After that you won't get the 'Unable to connect to the database' error it was part of the changelog. Quote Link to comment
gottoesplosivo Posted December 17, 2023 Share Posted December 17, 2023 After changing the postgres repo and updating, I'm having a lot of duplicate pictures. Any idea how to solve this? Quote Link to comment
Nirvash Posted December 18, 2023 Share Posted December 18, 2023 On 12/17/2023 at 12:42 PM, robinh said: Ye you have to change your postgres repository to: tensorchord/pgvecto-rs:pg14-v0.1.11 After that you won't get the 'Unable to connect to the database' error it was part of the changelog. Remember to do a backup first! docker exec -i postgres14 /usr/bin/pg_dumpall -U root > postgres-backup.sql 1 Quote Link to comment
rutherford Posted December 19, 2023 Author Share Posted December 19, 2023 I'm really struggling with postgres15 vs what I'm used to, old mysql. I'm used to a database, and you grant all privileges to a user on that database. But now, there are RELATIONS and SCHEMA and it's very confusing. I was getting something about VECTOR errors (which I think the fix above from @Nirvash addresses), but I've managed to get more basic, not even connecting successfully to the database. I'm here as a circus act: I make all the mistakes, record them, and hopefully cut down on the other circus acts out there. Quote Link to comment
rutherford Posted December 20, 2023 Author Share Posted December 20, 2023 Anyone have a fix for the new "vector" requirements in the database connection? Besides the different repository? Or is that the best/only way to do it. Quote Link to comment
Burgherh Posted December 22, 2023 Share Posted December 22, 2023 On 12/20/2023 at 6:53 PM, rutherford said: Anyone have a fix for the new "vector" requirements in the database connection? Besides the different repository? Or is that the best/only way to do it. I installed the recommended tensorchord/pgvecto-rs docker container (if you pick the latest build, Immich will complain about it. It'll tell you what version to use in the logs). The github install instructions says to enable the vector plugin by running the following command: DROP EXTENSION IF EXISTS vectors; CREATE EXTENSION vectors; Quote Link to comment
rutherford Posted December 27, 2023 Author Share Posted December 27, 2023 On 12/22/2023 at 12:15 AM, Karlsbergh said: The github install instructions says to enable the vector plugin by running the following command: DROP EXTENSION IF EXISTS vectors; CREATE EXTENSION vectors Is this in lieu of installing the other docker container? would you post some screen shots of what the unraid docker settings look like? Thanks! Quote Link to comment
rutherford Posted January 1 Author Share Posted January 1 So here's the thing I have going on now: moving this install to a new system. When I did my Google Takeout, it was a shitshow. Awful dates and metadata. Once I ran it through the process there, it was way better. Immich has this technique of saving all it's metadata separate from the original files. Good when you don't want to mess with those, but bad when you're migrating. You must also move the database over. There are decent instructions for it, but they really are tailored towards the official install method, which I've not chose here: I went with our Community Applications template, imagegenius docker. https://immich.app/docs/administration/backup-and-restore My previous installation was postgres15, as is this one, and they are both up and running. But: "Note that for the database restore to proceed properly, it requires a completely fresh install (i.e. the Immich server has never run since creating the Docker containers)." I'm going to have to nuke this new one, and try again. Anyone already do this procedure and can share some steps, with relation to the CA imagegenius version? thanks! Quote Link to comment
martabal Posted January 1 Share Posted January 1 Just use immich-go https://github.com/simulot/immich-go Quote Link to comment
rutherford Posted January 6 Author Share Posted January 6 (edited) moving install from one server to another. I'm adapting the instructions at https://immich.app/docs/administration/backup-and-restore command pg_dumpall dumps ALL the databases. I don't want to restore ALL databases, because I'm also using the postgresql15 docker for my nextcloud install. I imagine that the reason we're also dumping the postgres database is that it contains user information. I'll have to manually re-add the database user before proceeding. https://www.postgresqltutorial.com/postgresql-administration/postgresql-backup-database/ Another funny thing: Immich makes a point of NOT modifying my original files. Generally I appreciate that, but when I got my junk out of Google Takeout they were missing all sorts of stuff! I had to jump through several hoops to make the import meaningful with the missing metadata. If that process could just make those metadata changes CORRECT, and make changes to my files, the import, and future migrations, would also work smoothly. Get your database name from existing Immich docker>edit. Mine is immichdb Console into your postgresql15 dock For ease of getting the backup file out of the docker, I'm going to move over to the appdata connected folder at /var/lib/postgresql/data, which is mapped to /mnt/cache/appdata/postgresql15 on my unRaid server. Also by the by: you don't connect to your database server to run this command, only the console of the docker. # cd /var/lib/postgresql/data # pg_dump -U postgres -F t immichdb > immichdb.sql.tar # ls -lh | grep immich -rw-r--r-- 1 root root 807M Jan 6 08:53 immichdb.sql.tar I'm going to eat my shorts if this works.... and this is why I have doubts: "Note that for the database restore to proceed properly, it requires a completely fresh install (i.e. the Immich server has never run since creating the Docker containers). If the Immich app has run, Postgres conflicts may be encountered upon database restoration (relation already exists, violated foreign key constraints, multiple primary keys, etc.)." location of jpg file library oldserver:/mnt/user/memories/immich/library/d8435a7b-c642-46c7-9f84-2f5832215e48# rsync'ed to newserver:/mnt/user/memories/immich/library/d8435a7b-c642-46c7-9f84-2f5832215e48# (I have a hunch on the new install that file location d8435a7b-c642-46c7-9f84-2f5832215e48, will be a different random string... I'll see about how to get at that later...) oldserver immich docker Path /photos > /mnt/user/memories/immich Get into the postgresql docker CLI # psql -U postgres -W Password: psql (15.5 (Debian 15.5-1.pgdg120+1)) Type "help" for help. postgres=# note: postgresql15 doesn't require a password when connecting from localhost <shrug> postgres=# \list List of databases Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges -------------+-----------+----------+------------+------------+------------+-----------------+------------------------- immichdb | immich | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =Tc/immich + | | | | | | | immich=CTc/immich nextclouddb | nextcloud | UTF8 | en_US.utf8 | en_US.utf8 | | libc | nextcloud=CTc/nextcloud postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres + | | | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres + | | | | | | | postgres=CTc/postgres (5 rows) There's my immichdb, nuke it. postgres=# DROP DATABASE immichdb; DROP DATABASE postgres=# \list List of databases Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges -------------+-----------+----------+------------+------------+------------+-----------------+------------------------- nextclouddb | nextcloud | UTF8 | en_US.utf8 | en_US.utf8 | | libc | nextcloud=CTc/nextcloud postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres + | | | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres + | | | | | | | postgres=CTc/postgres (4 rows) postgres=# cool. Now import other one... I tried to rsync a single file, but ended up just dragging from oldserver to Windows desktop, then up to newserver. # psql -U postgres -W Password: psql (15.5 (Debian 15.5-1.pgdg120+1)) Type "help" for help. postgres=# CREATE USER immichuser WITH PASSWORD 'immichpass'; CREATE ROLE postgres=# CREATE DATABASE immichdb TEMPLATE template0 ENCODING 'UNICODE'; CREATE DATABASE postgres=# ALTER DATABASE immichdb OWNER TO immichuser; ALTER DATABASE postgres=# GRANT ALL PRIVILEGES ON DATABASE immichdb TO immichuser; GRANT postgres=# ALTER USER immichuser WITH SUPERUSER; ALTER ROLE postgres=# pg_restore -c -U postgres -d immichdb -v immichdb.sql.tar -W and by god it worked. I can't believe it. I really don't recommend doing this. What a PITA. buuuuut <shrug> seems to have worked! My settings: also /mnt/user/appdata/swag/nginx/proxy-confs/immich.subdomain.conf only changes below are server_name. I thought I'd have to change upstream_port, but nope! upstream_app already matched docker name. Spoiler ## Version 2023/11/26 # make sure that your immich container is named immich # make sure that your dns has a cname set for immich # immich v1.88+ only server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name photos.*; include /config/nginx/ssl.conf; client_max_body_size 0; # enable for ldap auth (requires ldap-location.conf in the location block) #include /config/nginx/ldap-server.conf; # enable for Authelia (requires authelia-location.conf in the location block) #include /config/nginx/authelia-server.conf; # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; location / { # enable the next two lines for http auth #auth_basic "Restricted"; #auth_basic_user_file /config/nginx/.htpasswd; # enable for ldap auth (requires ldap-server.conf in the server block) #include /config/nginx/ldap-location.conf; # enable for Authelia (requires authelia-server.conf in the server block) #include /config/nginx/authelia-location.conf; # enable for Authentik (requires authentik-server.conf in the server block) #include /config/nginx/authentik-location.conf; include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; set $upstream_app immich; set $upstream_port 8080; set $upstream_proto http; proxy_pass $upstream_proto://$upstream_app:$upstream_port; } location ~ (/immich)?/api { include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; set $upstream_app immich; set $upstream_port 8080; set $upstream_proto http; proxy_pass $upstream_proto://$upstream_app:$upstream_port; } } Edited January 7 by rutherford Quote Link to comment
[email protected] Posted January 11 Share Posted January 11 这个位置需要填什么呢?我有原来的照片需要导入,是不是填这里,后续怎么操作,请帮助我一下 谢谢 Quote Link to comment
Ikeasofa Posted January 31 Share Posted January 31 Huge thanks to your guide! It's super helpful for me. Too bad no one mentions that you need to create a database anywhere. Hope this thread can get linked to the app at some point. 1 Quote Link to comment
rutherford Posted February 17 Author Share Posted February 17 (edited) the official docs about backup and restore. They want me to use pg_dump command, and ya know, I have a few other databases on the "old" postgresql instance, but f-it, I'll take them to the "new" PostgreSQL_Immich from spacedinvader1 maintainer. Then just ignore the unused databases, or DROP them. the command from the docs is docker exec -t immich_postgres pg_dumpall -c -U postgres | gzip > "/path/to/backup/dump.sql.gz" I ran the following, because my postgres database for immich, previously, was this "postgresql15" docker. docker exec -t postgresql15 pg_dumpall -c -U postgres | gzip > "dump.sql.gz" that created a single 376MB file, dump.sql.gz Next: I'm thinking I have to use the EXACT same username, password, and database name to make this thing sing... so, I'm going to ... well, first I'm just going to try and restore the thing. drop into docker console for PostgreSQL_Immich # psql -U postgres -W Password: psql (16.1 (Debian 16.1-1.pgdg120+1)) Type "help" for help. postgres=# \l Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges -----------+----------+----------+-----------------+------------+------------+------------+-----------+----------------------- immichdb | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | | =Tc/postgres + | | | | | | | | postgres=CTc/postgres+ | | | | | | | | immich=CTc/postgres postgres | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | | template0 | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | | =c/postgres + | | | | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | | =c/postgres + | | | | | | | | postgres=CTc/postgres (4 rows) postgres=# There's that no beuno immichdb, nuke it: postgres=# \connect template1 Password: You are now connected to database "template1" as user "postgres". template1=# DROP DATABASE immichdb; DROP DATABASE template1=# \l List of databases Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges -----------+----------+----------+-----------------+------------+------------+------------+-----------+----------------------- postgres | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | | template0 | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | | =c/postgres + | | | | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | | =c/postgres + | | | | | | | | postgres=CTc/postgres (3 rows) Good, that's gone. I'm pretty sure the postgres database holds all the user/pass info. I don't care about any of it at this point, so I'm going to restore the whole pg_dump from earlier, which I think overwrites all that stuff. Stop the Immich container. Open the regular unraid CLI. command from official docs is gunzip < "/path/to/backup/dump.sql.gz" | docker exec -i immich_postgres psql -U postgres -d immich here's the one I used: gunzip < "dump.sql.gz" | docker exec -i PostgreSQL_Immich psql -U postgres -d immichdb I'm still just sitting in the same directory on my unraid machine that I did this command before /root, the backup file is here with me. so I can lose all that beginning path stuff. The docker I'm shooting this to is PostgreSQL_Immich, and the database I want is called immichdb. Those are the changes I made. It's running this as the super user postgres. psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "immichdb" does not exist ah, I had changed the port, or Ed/spacedinvader1 had default changed the port, which was good because I'm planning on keeping the other postgresql container for my nextcloud. I need to include a port number with the command to specify 5433, not 5432. We'll slap a -p 5433 on the tail... root@mayorgoodway:~# gunzip < "dump.sql.gz" | docker exec -i PostgreSQL_Immich psql -U postgres -d immichdb -p 5433 psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5433" failed: No such file or directory Is the server running locally and accepting connections on that socket? damn. Took a look in the log for docker PostgreSQL_Immich, odd, it says it's on port 5432, even though I'd specified 5433 in the Docker settings. Ed!!!! wtf!?? Let's try this: root@mayorgoodway:~# gunzip < "dump.sql.gz" | docker exec -i PostgreSQL_Immich psql -U postgres -d immichdb -p 5432 psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "immichdb" does not exist Hey hey, we're getting somewhere. Going through my ol' trusty database config and assign stuff... drop into the PostgreSQL_Immich docker command line interface: Spoiler postgres=# CREATE USER immich WITH PASSWORD 'immichpass'; ERROR: role "immich" already exists postgres=# ALTER USER immich WITH PASSWORD 'immichpass'; ALTER ROLE postgres=# CREATE DATABASE immichdb TEMPLATE template0 ENCODING 'UNICODE'; CREATE DATABASE postgres=# ALTER DATABASE immichdb OWNER TO immich; ALTER DATABASE postgres=# GRANT ALL PRIVILEGES ON DATABASE immichdb TO immich; GRANT postgres=# ALTER USER immich WITH SUPERUSER; ALTER ROLE postgres=# aaand that command from above... This command was entered into normal unraid command line interface. gunzip < "dump.sql.gz" | docker exec -i PostgreSQL_Immich psql -U postgres -d immichdb -p 5432 boom! Restored database. Flying through it's steps. Seems to have worked. Let's see what we got here... Immich docker is still shut down. Double check username, pass, portnumber is 5433: ooo I'm going to shut down the "old" postgresql docker to make sure this Immich is using the right one. Started up Immich docker, no complains in it's log about database connections... seems to be going slow, like usual, which bodes well perhaps loading all it's stuff... BOOM we're back babbbeeeeee! Had to access via localIP:8081/photos Now why isn't the SWAG reverse proxy workin'... root@mayorgoodway:/mnt/user/appdata/swag/nginx/proxy-confs# ls *.conf immich.subdomain.conf nextcloud.subdomain.conf vaultwarden.subdomain.conf that's looks fine... none of my subdomains are working, nextcloud.mydomain.com, bitwarden, or photos.mydomain.com weird, I think my IP changed. windows CMD command line interface: ping photos.mydomain.com > an IP address vs whatismyip.com shows a similar but different IP address. I know what happened. I had two servers in my duckdns account. I had swapped them out, and only today did that become a problem for some awesome reason. Sorted that, should be fine now! Or at least until the dns propagates, and that ping photos.mydomain.com start matching the whatismyip.com Now to rewrite this thing so you don't waste as much of your time, as I did mine! ha this stuff down here didn't work. I'd be happy if anyone knew why it didn't work? <shrug> had more problems with immich when my server sh%#$ the bed and lost that docker. Time to backup, and restore to a different postgresql docker. Looks like spacedinvader1 put out a docker with postgresql-immich specifically. I'll use that one. First thing to do: check the backup. Damn, they're all a month old. Looks like that was failing quietly. Awesome. I still have a live postgresql docker. Dashboard > drop into the postgresql console I had issues with many of the easy postgresql backup methods. This one worked, and is reflected below. pg_dump --file immichdb.bkp --format=custom --host 192.168.11.54 --dbname immichdb --username immich That created 341MB immichdb.bkp. Get that to the other docker... That postgresql docker has a path to the appdata, I'll slap that db file in there: mv immichdb.bkp /var/lib/postgresql/data get to regular command prompt, move the .sql file from one docker to another path accessible folder root@mayorgoodway:/mnt/user/appdata/postgresql15# mv immichdb.bkp ../PostgreSQL_Immich/ create new database, user, permissions # psql -U postgres -W Password: psql (16.1 (Debian 16.1-1.pgdg120+1)) Type "help" for help. postgres=# CREATE USER immich WITH PASSWORD 'immichpass'; CREATE ROLE postgres=# CREATE DATABASE immichdb TEMPLATE template0 ENCODING 'UNICODE'; CREATE DATABASE postgres=# ALTER DATABASE immichdb OWNER TO immich; ALTER DATABASE postgres=# GRANT ALL PRIVILEGES ON DATABASE immichdb TO immich; GRANT postgres=# ALTER USER immich WITH SUPERUSER; ALTER ROLE postgres=# restore the .bkp file pg_restore --verbose --clean --no-acl --no-owner --host 192.168.11.54 -U immich --dbname immichdb immichdb.bkp Edited February 17 by rutherford Quote Link to comment
IronBeardKnight Posted February 18 Share Posted February 18 anyone have any information on enabling cuda on the new version just being released as it appears that they have gotten rid of any inkling that the separate tensort models are still needed or not. I have just added the additional variable to the container for "cuda" to be added however not sure its actually doing anything. As the immich documentation only pertaining to running it normally through docker i'm not sure if I should need to map the docker config files to my local system in unraid so I can persistently edit them in accordance with immich documentation. Any information for fellow immich users is greatly appreciated as its a fantastic application. Quote Link to comment
JaviPas Posted February 21 Share Posted February 21 (edited) Today I saw there was an update available for immich. I installed it from the Apps (ghcr.io/imagegenius/immich) with Postgres14 and Redis and everything was working fine (around 150K photos/videos already indexed), but after the update, who seemed to go well, Immich no longer starts up. The log shows this message: The pgvecto.rs extension version is 0.1.11, but Immich only supports 0.2.0 and later minor releases. And this is consistent with the v1.95 release notes. The problem is, I have installed it through Apps (not following the Unraid howto published on their site) and I don't know how to fix this. Can someone help? Edited February 21 by JaviPas 1 Quote Link to comment
gottoesplosivo Posted February 21 Share Posted February 21 (edited) 3 hours ago, JaviPas said: Today I saw there was an update available for immich. I installed it from the Apps (ghcr.io/imagegenius/immich) with Postgres14 and Redis and everything was working fine (around 150K photos/videos already indexed), but after the update, who seemed to go well, Immich no longer starts up. The log shows this message: The pgvecto.rs extension version is 0.1.11, but Immich only supports 0.2.0 and later minor releases. And this is consistent with the v1.95 release notes. The problem is, I have installed it through Apps (not following the Unraid howto published on their site) and I don't know how to fix this. Can someone help? What I did was actually following the instructions that you linked, and it seems to be working. OPTIONAL: Create a db back up just in case. Change the values in brackets with the one for your database, and remove the brackets: docker exec -t (postgrescontainer) pg_dump -c -U (usernamedatabaseimmich) -d (immichdatabase) | gzip > (/mnt/user/Data/)immich.sql.gz Stop immich and postgres Change the container version on my postgres container. Make sure you choose the right version of pg, in my case it's 15. It's key to use a repo with -v0.2.0 at the end, like in this picture!!!! Restarted postgres Opened a shell in the postgres container: docker exec -it (postgrescontainer) bash enter the database: psql -U (usernamedatabaseimmich) -d (immichdatabase) Run the postgres command (making sure to change the name of the database if needed where it says “ALTER DATABASE immich”) BEGIN; CREATE SCHEMA IF NOT EXISTS vectors; ALTER DATABASE immich SET search_path TO "$user", public, vectors; SET search_path TO "$user", public, vectors; UPDATE pg_catalog.pg_extension SET extversion = '0.1.11' WHERE extname = 'vectors'; UPDATE pg_catalog.pg_extension SET extrelocatable = true WHERE extname = 'vectors'; ALTER EXTENSION vectors SET SCHEMA vectors; UPDATE pg_catalog.pg_extension SET extrelocatable = false WHERE extname = 'vectors'; ALTER EXTENSION vectors UPDATE TO '0.2.0'; SELECT pgvectors_upgrade(); COMMIT; Restarted postgres container Restarted immich container Edited February 21 by gottoesplosivo 1 2 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.