From fd496f864dbd9066aedb46506cb4ab66230fb84f Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Sat, 8 Aug 2015 01:10:20 +0200 Subject: [PATCH] renamed variable plus updates for README --- README.md | 42 +++++++++++++++++++++--------------------- openvpn/start.sh | 16 ++++++++-------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 87ad93c..05fbea8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -Private Internet Access OpenVPN - Transmission +# Transmission with WebUI and OpenVPN === -This Docker container lets you run Transmission with WebUI while connecting to PIA VPN. It updates Transmission hourly with assigned open port from PIA. Please read the instructions below. +This Docker container lets you run Transmission with WebUI while connecting to either BTGUARD or PIA OpenVPN. +When using PIA as provider it will update Transmission hourly with assigned open port. Please read the instructions below. ## Run container from Docker registry The container is available from the Docker registry and this is the simplest way to get it. To run the container use this command: @@ -8,38 +9,33 @@ The container is available from the Docker registry and this is the simplest way ``` $ docker run --privileged -d \ -v /your/storage/path/:/data \ + -e "OPENVPN_PROVIDER=PIA" \ + -e "OPENVPN_CONFIG=Netherlands" \ -e "OPENVPN_USERNAME=user" \ -e "OPENVPN_PASSWORD=pass" \ -p 9091:9091 \ haugene/transmission-openvpn ``` -or you could optionally specify which vpn server to use by setting an environment variable to one of the ovpn configs avaliable [in this folder](https://github.com/haugene/docker-transmission-openvpn/tree/master/piaconfig). +The `OPENVPN_PROVIDER` and `OPENVPN_CONFIG` are optional variables. If no provider is given, it will default to PIA. If no config is given, a default config will be selected for the provider you have chosen. +The only mandatory environment variables are your OpenVPN username and password. You must set the environment variables `OPENVPN_USERNAME` and `OPENVPN_PASSWORD` to the credentials given by your OpenVPN provider. -``` -$ docker run --privileged -d \ - -v /your/storage/path/:/data \ - -e "OPENVPN_USERNAME=user" \ - -e "OPENVPN_PASSWORD=pass" \ - -p 9091:9091 \ - -e "OPEN_VPN_CONFIG=US West" \ - haugene/transmission-openvpn -``` +Find the OpenVPN configurations avaliable by looking in the openvpn folder of the GitHub repository. -As you can see, the container expects a data volume to be mounted. It is used for storing your downloads from Transmission. The container comes with a default Transmission `settings.json` file that expects the folders `completed`, `incomplete`, and `watch` to be present in /your/storage/path (aka /data). This is where Transmission will store your downloads, incomplete downloads and a watch directory to look for new .torrent files. +As you can see, the container also expects a data volume to be mounted. It is used for storing your downloads from Transmission. The container comes with a default Transmission `settings.json` file that expects the folders `completed`, `incomplete`, and `watch` to be present in /your/storage/path (aka /data). This is where Transmission will store your downloads, incomplete downloads and a watch directory to look for new .torrent files. -The only mandatory configuration is to set two environment variables for your PIA username and password. You must set the environment variables `OPENVPN_USERNAME` and `OPENVPN_PASSWORD` to your login credentials. The container will connect to the Private Internet Access VPN servers in Netherlands by default. ### Required environment options | Variable | Function | Example | |----------|----------|-------| -|`OPENVPN_USERNAME`|Your login username for PIA|`OPENVPN_USERNAME=asdf`| -|`OPENVPN_PASSWORD`|Your login password for PIA|`OPENVPN_PASSWORD=asdf`| +|`OPENVPN_USERNAME`|Your OpenVPN username |`OPENVPN_USERNAME=asdf`| +|`OPENVPN_PASSWORD`|Your OpenVPN password |`OPENVPN_PASSWORD=asdf`| ### Network configuration options | Variable | Function | Example | |----------|----------|-------| -|`OPEN_VPN_CONFIG` | Sets the PIA endpoint to connect to. | `OPEN_VPN_CONFIG=UK Southampton`| +|`OPENVPN_PROVIDER` | Sets the OpenVPN provider to use. | `OPENVPN_PROVIDER=BTGUARD`| +|`OPENVPN_CONFIG` | Sets the OpenVPN endpoint to connect to. | `OPENVPN_CONFIG=UK Southampton`| |`RESOLV_OVERRIDE` | The value of this variable will be written to `/etc/resolv.conf`. | `RESOLV_OVERRIDE=nameserver 8.8.8.8\nnameserver 8.8.4.4\n`| ### Transmission configuration options @@ -65,22 +61,26 @@ To build this container, clone the repository and cd into it. ### Build it: ``` $ cd /repo/location/docker-transmission-openvpn -$ docker build -t="docker-transmission-openvpn" . +$ docker build -t docker-transmission-openvpn . ``` ### Run it: ``` $ docker run --privileged -d \ -v /your/storage/path/:/data \ + -e "OPENVPN_PROVIDER=PIA" \ + -e "OPENVPN_CONFIG=Netherlands" \ -e "OPENVPN_USERNAME=user" \ -e "OPENVPN_PASSWORD=pass" \ -p 9091:9091 \ docker-transmission-openvpn ``` -As described in the "Run container from Docker registry" section, this will start a container with default settings. This means that you should have the folders "completed, incomplete and watch" in /your/storage/path, and pia-credentials.txt in /your/config/path. +This will start a container as described in the "Run container from Docker registry" section. This means that you should have the folders "completed, incomplete and watch" in /your/storage/path, and pia-credentials.txt in /your/config/path. -### Issues -If you are having some issues running the local build then please ensure you are using the latest version of docker. Using the latest stable verison is always recommended. Support for older version is on a best-effort basis. +### Known issues +Some have encountered problems with DNS resolving inside the docker container. This causes trouble because OpenVPN will not be able to resolve the host to connect to. If you have this problem, please refer to issue #4 on GitHib and you might want to use the `RESOLV_OVERRIDE` flag described in "Network configuration options" + +If you are having issues with this container please submit an issue on GitHub. Please provide logs, docker version and other information that can simplify reproducing the issue. Using the latest stable verison of Docker is always recommended. Support for older version is on a best-effort basis. ## Access the WebUI But what's going on? My http://my-host:9091 isn't responding? diff --git a/openvpn/start.sh b/openvpn/start.sh index e78c24e..f9ca392 100755 --- a/openvpn/start.sh +++ b/openvpn/start.sh @@ -9,20 +9,20 @@ else vpn_provider="pia" fi -if [ ! -z "$OPEN_VPN_CONFIG" ] +if [ ! -z "$OPENVPN_CONFIG" ] then - if [ -f /etc/openvpn/$vpn_provider/"${OPEN_VPN_CONFIG}".ovpn ] + if [ -f /etc/openvpn/$vpn_provider/"${OPENVPN_CONFIG}".ovpn ] then - echo "Starting OpenVPN using config ${OPEN_VPN_CONFIG}.ovpn" - OPEN_VPN_CONFIG=/etc/openvpn/$vpn_provider/${OPEN_VPN_CONFIG}.ovpn + echo "Starting OpenVPN using config ${OPENVPN_CONFIG}.ovpn" + OPENVPN_CONFIG=/etc/openvpn/$vpn_provider/${OPENVPN_CONFIG}.ovpn else - echo "Supplied config ${OPEN_VPN_CONFIG}.ovpn could not be found." + echo "Supplied config ${OPENVPN_CONFIG}.ovpn could not be found." echo "Using default OpenVPN gateway for provider ${vpn_provider}" - OPEN_VPN_CONFIG=/etc/openvpn/$vpn_provider/default.ovpn + OPENVPN_CONFIG=/etc/openvpn/$vpn_provider/default.ovpn fi else echo "No VPN configuration provided. Using default." - OPEN_VPN_CONFIG=/etc/openvpn/$vpn_provider/default.ovpn + OPENVPN_CONFIG=/etc/openvpn/$vpn_provider/default.ovpn fi # override resolv.conf @@ -50,4 +50,4 @@ echo $TRANSMISSION_RPC_PASSWORD >> /config/transmission-credentials.txt # Persist transmission settings for use by transmission-daemon dockerize -template /etc/transmission-daemon/environment-variables.tmpl:/etc/transmission-daemon/environment-variables.sh /bin/true -exec openvpn --config "$OPEN_VPN_CONFIG" +exec openvpn --config "$OPENVPN_CONFIG"