sashkachan / tribler-arr-shim

Tribler Arr integration shim. Translates common API calls from *arr apps to Tribler.
MIT License
3 stars 1 forks source link

Shim in docker aborts connection #1

Closed eturpin closed 1 month ago

eturpin commented 1 month ago

Cloned the repo and tried using the Docker method:

Created this .env file:

TRIBLER_ARR_SHIM_SCHEME="http"
TRIBLER_ARR_SHIM_ADDR="localhost"
TRIBLER_ARR_SHIM_PORT="8091"
TRIBLER_API_ENDPOINT="localhost:20100"
TRIBLER_DOWNLOAD_DIR="/downloads"
TLS_SKIP_VERIFY="true"
TRIBLER_API_KEY="TEST"
TRIBLER_ANON_HOPS="1"
DEFAULT_CATEGORY=""
SQLITE_PATH="/data/database.db"

Created this docker-compose file

version: "3.3"

services:
  tribler-arr-shim:
    image: tribler-arr-shim:latest
    container_name: tribler-arr-shim
    env_file:
      - .env
    ports:
      - "8091:8091"
    volumes:
      - "./.env:/root/.env"
      - "./data:/data"
      - "/net/nas/downloads/tribler:/downloads"
    restart: always

Running docker compose up I get the following output:

tribler-arr-shim  | [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
tribler-arr-shim  | 
tribler-arr-shim  | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
tribler-arr-shim  |  - using env:   export GIN_MODE=release
tribler-arr-shim  |  - using code:  gin.SetMode(gin.ReleaseMode)
tribler-arr-shim  | 
tribler-arr-shim  | [GIN-debug] POST   /api/v2/auth/login        --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).LoginHandler.func2 (5 handlers)
tribler-arr-shim  | [GIN-debug] GET    /api/v2/app/webapiVersion --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).GetWebApiVersion.func3 (5 handlers)
tribler-arr-shim  | [GIN-debug] GET    /api/v2/app/version       --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).GetVersion.func4 (5 handlers)
tribler-arr-shim  | [GIN-debug] GET    /api/v2/app/preferences   --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).GetAppPreferences.func5 (5 handlers)
tribler-arr-shim  | [GIN-debug] GET    /api/v2/torrents/info     --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).GetInfo.func6 (5 handlers)
tribler-arr-shim  | [GIN-debug] GET    /api/v2/torrents/properties --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).GetProperties.func7 (5 handlers)
tribler-arr-shim  | [GIN-debug] GET    /api/v2/torrents/files    --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).GetTorrentsContents.func8 (5 handlers)
tribler-arr-shim  | [GIN-debug] POST   /api/v2/torrents/add      --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).Add.func9 (5 handlers)
tribler-arr-shim  | [GIN-debug] POST   /api/v2/torrents/delete   --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).Delete.func10 (5 handlers)
tribler-arr-shim  | [GIN-debug] POST   /api/v2/torrents/setCategory --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).SetCategory.func11 (5 handlers)
tribler-arr-shim  | [GIN-debug] GET    /api/v2/torrents/categories --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).GetCategories.func12 (5 handlers)
tribler-arr-shim  | [GIN-debug] POST   /api/v2/torrents/setShareLimits --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).SetShareLimits.func13 (5 handlers)
tribler-arr-shim  | [GIN-debug] POST   /api/v2/torrents/topPrio  --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).SetTopPriority.func14 (5 handlers)
tribler-arr-shim  | [GIN-debug] POST   /api/v2/torrents/pause    --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).PauseTorrent.func15 (5 handlers)
tribler-arr-shim  | [GIN-debug] POST   /api/v2/torrents/resume   --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).ResumeTorrent.func16 (5 handlers)
tribler-arr-shim  | [GIN-debug] POST   /api/v2/torrents/setForceStart --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).SetForceStartTorrent.func17 (5 handlers)
tribler-arr-shim  | [GIN-debug] POST   /api/v2/torrents/createCategory --> tribler-arr-shim/cmd/server.apiv2Routes.(*Handler).CreateCategory.func18 (5 handlers)
tribler-arr-shim  | 2024/08/13 11:23:34 Starting server on localhost:8091

When I try to set up a qBittorrent download client in Sonarr and click "test" I get "Unable to connect to bittorrent".

When I do http -v localhost:8091/api/v2/app/version or http -v localhost:8091, I get:

GET /api/v2/app/version HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:8091
User-Agent: HTTPie/2.6.0

http: error: ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) while doing a GET request to URL: http://localhost:8091/api/v2/app/version

and no further log output from the docker container nor log output from the tribbler-core docker container indicating it received a request.

docker ps shows that the container is bound to port 8091: bbfd410ac6df tribler-arr-shim:latest "./tribler_arr_shim …" 7 minutes ago Up 7 minutes 0.0.0.0:8091->8091/tcp, :::8091->8091/tcp tribler-arr-shim

I'm not familiar with Go at all, so I don't really know how to debug further.

eturpin commented 1 month ago

NVM. Just realized I had TRIBLER_ARR_SHIM_ADDR="localhost" in my .env file, which won't work correctly in a docker container. Changed to "0.0.0.0," and it passed the test in Sonarr.