aetaric / checkrr

Checkrr Scans your library files for corrupt media and replace the files via sonarr and radarr
MIT License
179 stars 8 forks source link

[BUG] address for *arr service doesn't work #58

Closed JackBailey closed 1 year ago

JackBailey commented 1 year ago

Describe the bug In a docker network you can reference a service, such as sonarr with just http://sonarr:7878, but checkrr doesn't seem to work with this.

To Reproduce Steps to reproduce the behavior:

  1. Have checkrr, sonarr and radarr in a docker network
  2. Set address to sonarr

Expected behavior It should connect to sonarr/radarr

Logs

time="2023-04-26T10:24:57+01:00" level=info msg="api.Get(v3/system/status): httpClient.Do(req): Get \"http://<nil>:7878/api/v3/system/status\": dial tcp: lookup <nil>: no such host" Radarr "radarr" Connected=false Startup=true
time="2023-04-26T10:24:57+01:00" level=info msg="api.Get(v3/system/status): httpClient.Do(req): Get \"http://<nil>:8989/api/v3/system/status\": dial tcp: lookup <nil>: no such host" Sonarr "sonarr" Connected=false Startup=true

Desktop (please complete the following information):

JackBailey commented 1 year ago

Checked it with the 172.21.. addresses and it still fails. Same error to above. arr configuration:

arr:
  radarr:
    process: true
    service: radarr # should be one of: sonarr radarr lidarr
    address: 172.17.0.7
    apikey: "REDACTED"
    baseurl: /
    port: 7878
    mappings: # maps directories between docker and arr services
      "/media/movies/": "/media/movies/" # what radarr sees: what checkrr sees
  sonarr:
    process: true
    service: sonarr
    address: 172.21.0.8
    apikey: "REDACTED"
    baseurl: /
    port: 8989
    mappings:
      "/media/shows/": "/media/shows/"
aetaric commented 1 year ago

Checkrr does expect the address field to be an IP. I've seen numerous people since version 1 just toss a URL in there and expect it to magically sort that out. I switched it back in 2.x to work off an IP just to sanitize the input at the time. It could easily be switched over to allow hostnames directly (and the code is built with the option that would let resolution work just fine https://github.com/aetaric/checkrr/blob/main/.goreleaser.yaml#L19).

I have no issue hitting my services over the IP on my testing environment or in my "production" use:

INFO[0000] Using config file: ./checkrr.yaml            
INFO[0000] Next Run: 2023-04-26 20:28:00      
INFO[0001] Sonarr Connected.                             Sonarr "sonarr" Connected=true Startup=true
WARN[0001] No config options for notifications found.    Notifications Connected=false Startup=true

For ref, I run checkrr in both docker and via command line with sonarr and radarr setup with dummy data in docker for testing prior to release.

As for adjustments to the code to enable hostname usage, changes would have to be done for each connection type under https://github.com/aetaric/checkrr/tree/main/connections: on line 19, changing Address net.IPAddr to Address string, adjusting each FromConfig() function to stop casting the string to an IP, and finally in each Connect() function the starr.New() call would have to be adjusted to remove the IP logic. A fairly straight forward change all told, but not something I'd want to version bump on alone.

JackBailey commented 1 year ago

Okay that makes sense thank you. It's now working for sonarr with ips but I'm getting the following error:

time="2023-04-27T10:17:29+01:00" level=info msg="api.Get(v3/system/status): httpClient.Do(req): Get \"http://172.17.0.7:7878/api/v3/system/status\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)" Radarr "radarr" Connected=false Startup=true

any ideas? radarr is completely accessible and fine

aetaric commented 1 year ago

Nothing should block it from working on checkrr's side. I'm assuming radarr is on the same bridge as checkrr, but that's something you should verify. Outside of that, you could apk install tcpdump in the checkrr container and then use tcpdump to see what's going on with the networking, or just install tcpdump on the host and see if you can see the traffic flowing.

JackBailey commented 1 year ago

Ah turns out it was just radarr changing its network ip, I've set it to a static one and now its all fine. Thank you for your help