agross / immich-duplicates

Find image and video duplicates in Immich.
136 stars 5 forks source link

Readme Step 4 #11

Closed Frankenberrypi closed 10 months ago

Frankenberrypi commented 10 months ago

The link in step 4 of the readme doesn't work. https://github.com/immich-app/immich/blob/main/nginx/templates/default.conf.template#L61
Maybe this is related to Immich release 1.88 where they got rid of the immich-web and immich-proxy containers.

agross commented 10 months ago

You're correct.

You will need to put a reverse proxy in front of Immich adding the CORS headers outlined in the readme, otherwise immich-duplicates won't be able to make API calls to Immich.

Frankenberrypi commented 10 months ago

Ah, ok, I misunderstood then. I am already running an nginx reverse proxy. Does the nginx code from step 4 go in the custom nginx configuration field?

agross commented 10 months ago

I don't think you misunderstood. In earlier versions of Immich, when they still used nginx you could patch immich's nginx config directly, regardless of any extra reverse proxy in front of the immich's nginx.

Since you have nginx in front of immich's new web server, find the /api location (if you don't have it, use /) and add those add_header lines.

You can check if your settings work if the duplicate browser works. Otherwise you'll see errors related to CORS in your browser's developer tools.

Unfortunately I don't know what you mean by "custom nginx configuration field".

Frankenberrypi commented 10 months ago

To clarify, I am using NPM, https://nginxproxymanager.com/

find the /api location (if you don't have it, use /) and add those add_header lines.

Probably showing my ignorance here, do you mean somewhere in the file system of the nginx container, or in a config file? When I said "custom nginx configuration field", I was referring to the proxy host edit form for the NPM web configuration. It also has a "Custom Locations" field. I may be in a bit over my head. image

agross commented 10 months ago

OK, understood. I think I'm not going to fiddle with your proxy manager and I don't want you to fiddle with its config as well.

Can you please have a look at c3c6cf7 and see if the updated instructions help?

The idea is this:

Frankenberrypi commented 10 months ago

OK, your explanation makes sense to me, but I'm still having a little trouble implementing it based on the new instructions. Where exactly are these commands entered?

$ cd immich-cors-proxy
$ ./run https://immich.example.com/

My first attempts were in the command prompt after the docker container for the browser started up, like this: image That does not seem to have been successful. I am able to navigate to the browser, but get these errors after entering the information on the setup page and clicking OK.
image I also connected to the running container and rooted around for the immich-cors-proxy directory, but couldn't find it.

agross commented 10 months ago

Where exactly are these commands entered?

You need to download this repo to your local machine, either using git or download and extract the zip file. For the git or zip address click on the green button labeled "Code" on the top right of this page.

Then enter the directory containing the git clone (or the extracted zip) and run cd and run from the README.

agross@firiel ~
$ git clone https://github.com/agross/immich-duplicates.git
Cloning into 'immich-duplicates'...
remote: Enumerating objects: 280, done.
remote: Counting objects: 100% (74/74), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 280 (delta 37), reused 32 (delta 13), pack-reused 206
Receiving objects: 100% (280/280), 568.60 KiB | 6.39 MiB/s, done.
Resolving deltas: 100% (140/140), done.

agross@firiel ~
$ cd immich-duplicates

agross@firiel ~/immich-duplicates  master
$ cd immich-cors-proxy

agross@firiel ~/immich-duplicates/immich-cors-proxy  master
$ ./run https://photos.therightstuff.de
[+] Running 1/1
 ✔ Container immich-cors-proxy-traefik-1  Recreated                                                                                                 0.1s
Attaching to traefik-1
traefik-1  | time="2023-12-16T17:26:40Z" level=info msg="Configuration loaded from file: /etc/traefik/traefik.yml"
...

Then try again to open the duplicate-browser as before. It appears to point to the correct http://localhost:8081/api address already.

agross commented 10 months ago

My first attempts were in the command prompt after the docker container for the browser started up, like this:

Just for your understanding: The duplicates-browser container never saw what you entered (cd etc.).

This container does not run with standard input nor a TTY attached (normally enabled by the -it argument to docker commands), so while you saw what you entered echoed by your shell the container did not receive it. The duplicate-browser cannot forward requests elsewhere, so you could not find any trace of immich-cors-proxy in the container's file system.

Frankenberrypi commented 10 months ago

Ah ha! Success! I knew I was doing something wrong, but didn't have enough background to put together what I was missing. Thank you so much for all the help.

I may submit a pull request in a few days with a few ideas on how to clarify the instructions for someone like me if you're interested in that. Gotta go learn how to do a pull request first though.

agross commented 10 months ago

I'm working on a simpler solution without an additional container. I'll let you know. I would be grateful if you would test the new variant and provide feedback.

agross commented 10 months ago

OK, the new variant is up. Please update the docker image of the browser:

$ docker pull ghcr.io/agross/immich-duplicates-browser

You can stop and remove the CORS proxy container.

The new invocation to start the duplicates-browser is this:

$ docker container run \
                   --env IMMICH_URL=https://immich.example.com \
                   --rm \
                   --publish 8080:80 \
                   ghcr.io/agross/immich-duplicates-browser

Replace https://immich.example.com accordingly.

After the container is up, visit the Setup screen and

If the Setup screen does not include both fields, refresh the page (Ctrl + F5).

agross commented 10 months ago

These are the changes to the README after removing the "old" CORS proxy that I added earlier today:

https://github.com/agross/immich-duplicates/compare/c3c6cf7..cf44e2e#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5

Frankenberrypi commented 10 months ago

I just tried the new method and it works for me. Only 2595 duplicates to go!

agross commented 10 months ago

Excellent. You can get rid of the git clone as well, forgot that in the earlier reply.

Have fun working through your dupes (I only had ~1000) and please let me know if the readme is good now.