Docker mod for the linuxserver.io qbittorrent container that automatically updates the torrenting port to the forwarded vpn port (via gluetun) and checks if you are connectable.
Adapted from a script made by schumi4
Pick the dynamic port installation for VPN providers who decide the port that you will be forwarding for you (for example ProtonVPN and PIA), the script will then automatically update the port qBittorrent uses for torrent traffic.
If your VPN provider lets you select a port to be forwarded that stays the same (like AirVPN), follow the instructions for the static port installation.
Important: If you were using an older version of this script (that uses custom services and is not a docker mod), remove it first: Delete the custom-services volume and the corresponding folder on your drive. After you've upgraded, the script will update itself and no manual intervention is needed.
First, enable the option "Bypass authentication for clients on localhost" in the qBittorrent settings under the "Web UI" tab
Add the following environment variables to your qBittorrent container:
- WEBUI_PORT=8080 # if it doesn't exist already and you changed the port from the default 8080
- DOCKER_MODS=ghcr.io/techclusterhq/qbt-portchecker:main
- PORTCHECKER_GLUETUN_API_KEY=API KEY HERE # instructions below
- PORTCHECKER_SLEEP=180 # optional, default 180: how long the script should wait between each check
- PORTCHECKER_KILL_ON_NOT_CONNECTABLE=true # optional, default true: whether or not to restart qBittorrent if the port stops being connectable
Note
If you are already using another docker mod with your qBittorrent container you have to combine both into one DOCKER_MODS variable, seperated by a pipe:
- DOCKER_MODS=ghcr.io/techclusterhq/qbt-portchecker:main|ghcr.io/techclusterhq/qbt-slowban:main
If it exists, remove the TORRENTING_PORT
variable completely.
Then, volume the gluetun folder from the gluetun container to your host if you haven't already:
volumes:
- ./gluetun:/gluetun
Note
Refer to the gluetun documentation for more information regarding the auth system
Generate an api key using docker run --rm -v ./gluetun:/gluetun qmcgaw/gluetun genkey
, which should also create the gluetun folder.
Navigate to the gluetun folder and create the "auth" subdirectory. If there are issues with folder permissions, run the mkdir command as root.
Copy the following template to a file called config.toml
(create it if it doesn't exist) and paste in your generated api key.
[[roles]]
name = "qbt-portchecker"
routes = ["GET /v1/openvpn/portforwarded"]
auth = "apikey"
apikey = "API KEY HERE"
Now, set the qBittorrent environment variable PORTCHECKER_GLUETUN_API_KEY
to the api key.
Start the stack again and check if the program updates the port accordingly. Feel free to open a GitHub issue or DM me on Discord (username app.py
).
First, enable the option "Bypass authentication for clients on localhost" in the qBittorrent settings under the "Web UI" tab
Add the following environment variables to your qBittorrent container:
- WEBUI_PORT=8080 # if it doesn't exist already and you changed the port from the default 8080
- DOCKER_MODS=ghcr.io/techclusterhq/qbt-portchecker:main
- FIREWALL_VPN_INPUT_PORTS= # set this to your forwarded vpn port
- PORTCHECKER_SLEEP=180 # optional, default 180: how long the script should wait between each check
- PORTCHECKER_KILL_ON_NOT_CONNECTABLE=true # optional, default true: whether or not to restart qBittorrent if the port stops being connectable
If it exists, remove the TORRENTING_PORT
variable completely.
Start the stack again and check if the program updates the port accordingly. Feel free to open a GitHub issue or DM me on Discord (username app.py
).