Automatically updates the listening port for qBittorrent to match the port forwarded by Gluetun. This project is a fork of SnoringDragon's gluetun-qbittorrent-port-manager.
Gluetun can forward ports for supported VPN providers, but qBittorrent lacks the ability to automatically update its listening port to match this forwarded port. This script, available as a Docker container, checks every 30 seconds if the forwarded port file created by Gluetun has changed, and automatically updates qBittorrent's listening port accordingly.
You need to add the provided docker-compose.yml
configuration into your existing Docker Compose setup that includes Gluetun. Make sure to replace the default values with your specific settings. Otherwise, the script will not work properly.
Before using this script, ensure that qBittorrent is properly connected to the forwarded port. You can confirm this if you see a green globe icon at the bottom of the WebUI.
Add a volume mount to your Gluetun container, for example:
volumes:
- /docker/gluetunvpn:/gluetun
Then, add the following environment variable to your Gluetun container:
environment:
- VPN_PORT_FORWARDING_STATUS_FILE=/gluetun/forwarded_port
This ensures that the forwarded port information is saved to the volume at /gluetun/
. Without this setup, Gluetun will not create the file that stores the forwarded port.
Ensure that the correct volume is set to access the forwarded_port
file. In your Docker Compose file, add:
volumes:
- /docker/gluetun:/tmp/gluetun
Within the container, this volume will be accessible at /tmp/gluetun
.
Next, inform the script where to find the forwarded_port
file by adding the following environment variable:
environment:
PORT_FORWARDED: /tmp/gluetun/forwarded_port
That's it! With these steps completed, the script should be able to dynamically update the qBittorrent listening port.