nylonee / watchlistarr

Customizable sync of Plex Watchlist to Sonarr/Radarr
GNU General Public License v3.0
172 stars 13 forks source link

Unable to configure sonarr #120

Closed glensc closed 5 months ago

glensc commented 5 months ago

I've configured sonar via env variable SONARR_BASE_URL=http://sonarr/sonarr, but starting container tries to connect to host.docker.internal:8989, why? i verified with bash -x that java arg is set to -Dsonarr.baseUrl=http://sonarr/sonarr:8989

this is docker image built locally from 4c43573.

$ docker-compose run --rm watchlistarr 
Creating mediaserver_watchlistarr_run ... done
12:03:47.400 [io-compute-0] ERROR configuration.ConfigurationUtils$ - Unable to connect to Sonarr at host.docker.internal:8989, with error java.net.ConnectException: Connection refused
java.lang.IllegalArgumentException: Unable to connect to Sonarr at host.docker.internal:8989, with error java.net.ConnectException: Connection refused
        at configuration.ConfigurationUtils$.throwError(ConfigurationUtils.scala:290)
        at configuration.ConfigurationUtils$.$anonfun$getSonarrConfig$5(ConfigurationUtils.scala:122)
        at getAndSet @ org.typelevel.keypool.KeyPool$.destroy(KeyPool.scala:120)
        at flatMap @ org.typelevel.keypool.KeyPool$.destroy(KeyPool.scala:120)
        at main$ @ Server$.main(Server.scala:11)
        at getAndSet @ org.typelevel.keypool.KeyPool$.destroy(KeyPool.scala:120)
        at clear @ org.http4s.client.middleware.FollowRedirect$.redirectLoop$1(FollowRedirect.scala:105)
        at clear @ org.http4s.client.middleware.FollowRedirect$.redirectLoop$1(FollowRedirect.scala:105)
ERROR: 1
docker-compose.yml ```yml # https://github.com/nylonee/watchlistarr watchlistarr: image: nylonee/watchlistarr container_name: watchlistarr environment: - SONARR_BASE_URL=http://sonarr/sonarr:8989 - SONARR_API_KEY=$SONARR_API_KEY - RADARR_BASE_URL=http://radarr/radarr:7878 - RADARR_API_KEY=$RADARR_API_KEY - PLEX_TOKEN=$PLEX_TOKEN volumes: - ./watchlistarr:/app/config user: 1000:1000 restart: unless-stopped logging: driver: json-file options: max-size: "10m" max-file: "10" ```
nylonee commented 5 months ago

I'm not sure how your sonarr/radarr URLs are set up, but the URL looks a bit odd, were you meant to point to:

http://sonarr:8989

This probably needs to be better logged, but I added a line here to add a series of URLs to try to hit Sonarr with. Your env variable/java property takes precedence, but I think it failed to find a sonarr instance at that URL, so then it started cycling through all the other URLs to see if it could find it there, stopping at this one.

When all the URLs failed, it reported an error but only on the last URL, which isn't very intuitive.

I put this in because one of the top misconfiguration I've seen are users who do not know how to point Watchlistarr at their Sonarr URL. The biggest culprit is running Sonarr and Watchlistarr both within Docker, so they have to communicate with each other at host.docker.internal, but because the port is exposed to the main machine users get confused when localhost works for them but not for Watchlistarr

glensc commented 5 months ago

yeah, i've put port to wrong place. but correcting it, it still fails with http://sonarr:8989/sonarr

$ docker-compose run --rm watchlistarr 
Creating mediaserver_watchlistarr_run ... done
21:14:32.715 [io-compute-0] INFO  configuration.ConfigurationUtils$ - Successfully connected to Sonarr
21:14:32.983 [io-compute-2] ERROR configuration.ConfigurationUtils$ - Unable to connect to Radarr at host.docker.internal:7878, with error java.net.ConnectException: Connection refused
java.lang.IllegalArgumentException: Unable to connect to Radarr at host.docker.internal:7878, with error java.net.ConnectException: Connection refused
        at configuration.ConfigurationUtils$.throwError(ConfigurationUtils.scala:290)
        at configuration.ConfigurationUtils$.$anonfun$getRadarrConfig$5(ConfigurationUtils.scala:159)
        at getAndSet @ org.typelevel.keypool.KeyPool$.destroy(KeyPool.scala:120)
        at flatMap @ org.typelevel.keypool.KeyPool$.destroy(KeyPool.scala:120)
        at main$ @ Server$.main(Server.scala:11)
        at getAndSet @ org.typelevel.keypool.KeyPool$.destroy(KeyPool.scala:120)
        at clear @ org.http4s.client.middleware.FollowRedirect$.redirectLoop$1(FollowRedirect.scala:105)
        at clear @ org.http4s.client.middleware.FollowRedirect$.redirectLoop$1(FollowRedirect.scala:105)
ERROR: 1
glensc commented 5 months ago

ah. i had error in Radarr url too

-      - RADARR_BASE_URL=http://radarr:7878/sonarr
+      - RADARR_BASE_URL=http://radarr:7878/radarr

now with both errors fixed, application started.

so yeah, it's not intuitive error messages you have. should log "trying URL xxx... failed: error message", "trying next URL"... something a like.

glensc commented 5 months ago

🚧 Never link to branches, share a permalink 🚧