se1exin / Cleanarr

A simple UI to help find and delete duplicate and sample files from your Plex server
https://hub.docker.com/r/selexin/cleanarr
MIT License
214 stars 18 forks source link

Docker - check your Plex settings and try again #100

Closed televisi closed 12 months ago

televisi commented 1 year ago

Hi, I setup cleanarr from docker compose (as defined on the instruction page) on QNAP container station:

version: '3'

services:

  cleanarr:
    image: selexin/cleanarr:latest
    container_name: cleanarr
    hostname: cleanarr
    ports:
      - "5000:80"
    environment:
      - BYPASS_SSL_VERIFY=1
      - PLEX_TOKEN=somerandomstring
      - PLEX_BASE_URL=https://192.168.1.26:32400
      - LIBRARY_NAMES=Movies;TV
    volumes:
      - /share/Container-Data/cleanarr-new:/config
    restart: unless-stopped

Upon first run, this error is presented, what could gone wrong with this?

Failed to load content!
Please check your Plex settings and try again.

Thanks

dromicron commented 1 year ago

same problem..

5H3RM commented 1 year ago

I can't even pull the image, I try but the last part fails. 118c4efe49a7: Extracting [==================================================>] 4.938MB/4.938MB failed to register layer: unlinkat /usr/local/lib/python3.7/site-packages/Flask-2.2.5.dist-info: invalid argument

peter-mcconnell commented 12 months ago

Hey @televisi - thanks for flagging. My first line of thought is that it would be good to eliminate network issues. If the container is still running, can you exec a bash session from the container and test your plex settings? Something like:

test setup

docker-compose up -d # run cleanarr and detach
docker-compose ps # validate it's running
docker-compose exec -ti cleanarr bash # exec a bash in the container

tests from inside the container swap the IP and token in these examples.

validate network (unauthenticated request). You should see 401 Unauthorized.

root@cleanarr:/app# curl -I https://192.168.1.26:32400
HTTP/1.1 401 Unauthorized
X-Plex-Protocol: 1.0
Content-Length: 193
Content-Type: text/html
Connection: close
Cache-Control: no-cache
Date: Mon, 06 Nov 2023 22:46:28 GMT

If you do not see 401 Unauthorized it indicates the address https://192.168.1.26:32400 isn't valid for you, from this container.

If you do see 401 Unauthorized, you can attach your token to the request to validate your token is correct:

root@cleanarr:/app# curl -I https://192.168.1.26:32400?X-Plex-Token=somerandomstring
HTTP/1.1 200 OK
X-Plex-Protocol: 1.0
Content-Type: text/xml;charset=utf-8
Content-Length: 8219
Connection: Keep-Alive
Keep-Alive: timeout=20
Cache-Control: no-cache
Date: Mon, 06 Nov 2023 22:49:04 GMT

If you get anything but a 200 OK here it indicates an issue with your token.

If you do get a 200, but the UI still isn't working, then I'm stumped for now but let me know and I can keep digging

televisi commented 12 months ago

Hey @televisi - thanks for flagging. My first line of thought is that it would be good to eliminate network issues. If the container is still running, can you exec a bash session from the container and test your plex settings? Something like:

Hi @peter-mcconnell Thanks for your reply!

I attached myself to the container and ran a couple of commands, it confirmed that the container can access plex. Note: I used curl "-k" operator to avoid SSL error

root@cleanarr-new:/app# curl -I https://192.168.1.26:32400
curl: (60) SSL: no alternative certificate subject name matches target host name '192.168.1.26'
More details here: https://curl.se/docs/sslcerts.html

root@cleanarr-new:/app# ping 192.168.1.26
PING 192.168.1.26 (192.168.1.26) 56(84) bytes of data.
64 bytes from 192.168.1.26: icmp_seq=1 ttl=64 time=0.059 ms
64 bytes from 192.168.1.26: icmp_seq=2 ttl=64 time=0.040 ms
^C
--- 192.168.1.26 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1026ms
rtt min/avg/max/mdev = 0.040/0.049/0.059/0.009 ms

root@cleanarr-new:/app# curl -Ik https://192.168.1.26:32400
HTTP/1.1 401 Unauthorized
X-Plex-Protocol: 1.0
Content-Length: 193
Content-Type: text/html
Connection: close
Cache-Control: no-cache
Date: Tue, 07 Nov 2023 01:19:30 GMT

root@cleanarr-new:/app# curl -Ik https://192.168.1.26:32400?X-Plex-Token=SomeString
HTTP/1.1 200 OK
X-Plex-Protocol: 1.0
Content-Type: text/xml;charset=utf-8
Content-Length: 8477
Connection: Keep-Alive
Keep-Alive: timeout=20
Cache-Control: no-cache
Date: Tue, 07 Nov 2023 01:21:18 GMT

I guess there might be another issue? Thanks

peter-mcconnell commented 12 months ago

Thanks for the info @televisi . The next layer to jump into would be the debug logs - you can enable these by adding it to the environment section of your docker-compose.yaml file:

version: '3'

services:

  cleanarr:
    image: selexin/cleanarr:latest
    container_name: cleanarr
    hostname: cleanarr
    ports:
      - "5000:80"
    environment:
      - BYPASS_SSL_VERIFY=1
      - PLEX_TOKEN=somerandomstring
      - PLEX_BASE_URL=https://192.168.1.26:32400
      - LIBRARY_NAMES=Movies;TV
      - DEBUG=1
    volumes:
      - /share/Container-Data/cleanarr-new:/config
    restart: unless-stopped

You can then view the logs (after running this configuration) with docker-compose logs. Could you do so and post the logs here?

Additionally, if you could open the network panel of your browser and show a fresh page load that would be useful too (I'm curious if this is a timeout issue from the get_dupes requests)

peter-mcconnell commented 12 months ago

Possibly relevant: I've pushed some updates over lunch which should dramatically improve perf, which could help you if these are timeout related. You may want to pull the latest image and retry

televisi commented 12 months ago

@peter-mcconnell thanks for your responses so far! appreciate your help in getting this up and running.

I just pulled the image from docker-hub and this time around, it threw the following error:

Failed to load content!
HTTPSConnectionPool(host='192.168.1.26', port=32400): Max retries exceeded with url: / (Caused by SSLError(CertificateError("hostname '192.168.1.26' doesn't match '*.xxx.plex.direct'")))
image

and the following is the log:

plexwrapper  2023-11-07 20:04:53,702 DEBUG    plexwrapper.py:__init__ PlexWrapper Init
plexwrapper  2023-11-07 20:04:53,703 DEBUG    plexwrapper.py:__init__ PLEX_BASE_URL https://192.168.1.26:32400
plexwrapper  2023-11-07 20:04:53,703 DEBUG    plexwrapper.py:__init__ LIBRARY_NAMES ['Movies', 'TV']
plexwrapper  2023-11-07 20:04:53,704 DEBUG    plexwrapper.py:__init__ Connecting to Plex...
plexwrapper  2023-11-07 20:04:53,705 DEBUG    plexwrapper.py:__init__ PlexWrapper Init
plexwrapper  2023-11-07 20:04:53,706 DEBUG    plexwrapper.py:__init__ PLEX_BASE_URL https://192.168.1.26:32400
plexwrapper  2023-11-07 20:04:53,706 DEBUG    plexwrapper.py:__init__ LIBRARY_NAMES ['Movies', 'TV']
plexwrapper  2023-11-07 20:04:53,707 DEBUG    plexwrapper.py:__init__ Connecting to Plex...
main         2023-11-07 20:04:53,751 ERROR    main.py:internal_error HTTPSConnectionPool(host='192.168.1.26', port=32400): Max retries exceeded with url: / (Caused by SSLError(CertificateError("hostname '192.168.1.26' doesn't match '*.xxx.plex.direct'")))
main         2023-11-07 20:04:53,754 ERROR    main.py:internal_error HTTPSConnectionPool(host='192.168.1.26', port=32400): Max retries exceeded with url: / (Caused by SSLError(CertificateError("hostname '192.168.1.26' doesn't match '*.xxx.plex.direct'")))
192.168.1.166 - - [07/Nov/2023:20:04:53 +0000] "GET /content/dupes?page=2 HTTP/1.1" 500 230 "http://192.168.1.175/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "-"

Thank you

peter-mcconnell commented 12 months ago

That's helpful - so it seems we have ssl verification, despite BYPASS_SSL_VERIFY=1 being set 😕 I don't have a test lab for this but let me see if I can get you a test image that uses a different approach ...

peter-mcconnell commented 12 months ago

Pushed a custom tag to pemcconnell/cleanarr:sslfix on docker hub. Unfortunately I don't have a test lab for this so shooting in the dark a little: https://hub.docker.com/layers/pemcconnell/cleanarr/sslfix/images/sha256-9fc26af100121783b8c660859b8321cddbeac8fc114f69058b41d62c0d38eb26?context=explore

If this doesn'tt work I'll configure a lab for ssl and test

televisi commented 12 months ago

Pushed a custom tag to pemcconnell/cleanarr:sslfix on docker hub

Thanks @peter-mcconnell I downloaded an updated container from https://hub.docker.com/r/pemcconnell/cleanarr and it works!

Thank you!

peter-mcconnell commented 12 months ago

Great news, pushed a new version to the docker hub image with this fix also