Merge branch 'master' into dev

This commit is contained in:
Kristian Haugene
2016-12-29 18:38:00 +01:00
5 changed files with 46 additions and 24 deletions

View File

@@ -15,7 +15,7 @@ RUN apt-get update \
&& add-apt-repository ppa:transmissionbt/ppa \ && add-apt-repository ppa:transmissionbt/ppa \
&& apt-get update \ && apt-get update \
&& apt-get install -y transmission-cli transmission-common transmission-daemon \ && apt-get install -y transmission-cli transmission-common transmission-daemon \
&& apt-get install -y openvpn curl rar unrar zip unzip \ && apt-get install -y openvpn curl rar unrar zip unzip wget \
&& curl -sLO https://github.com/Yelp/dumb-init/releases/download/v1.0.1/dumb-init_1.0.1_amd64.deb \ && curl -sLO https://github.com/Yelp/dumb-init/releases/download/v1.0.1/dumb-init_1.0.1_amd64.deb \
&& dpkg -i dumb-init_*.deb \ && dpkg -i dumb-init_*.deb \
&& rm -rf dumb-init_*.deb \ && rm -rf dumb-init_*.deb \

View File

@@ -114,7 +114,7 @@ To use this env file, use the following to run the docker image:
$ docker run --privileged -d \ $ docker run --privileged -d \
-v /your/storage/path/:/data \ -v /your/storage/path/:/data \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
-env-file /your/docker/env/file \ --env-file /your/docker/env/file \
-p 9091:9091 \ -p 9091:9091 \
haugene/transmission-openvpn haugene/transmission-openvpn
``` ```

View File

@@ -1,3 +1,6 @@
version: '2'
services:
transmission: transmission:
build: build:
context: . context: .
@@ -5,7 +8,7 @@ transmission:
privileged: true privileged: true
restart: always restart: always
ports: ports:
- 9091:9091 - "9091:9091"
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@@ -13,17 +16,17 @@ transmission:
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
- /your/storage/path/:/data - /your/storage/path/:/data
environment: environment:
OPENVPN_PROVIDER: PIA - OPENVPN_PROVIDER=PIA
OPENVPN_USERNAME: username - OPENVPN_USERNAME=username
OPENVPN_PASSWORD: password - OPENVPN_PASSWORD=password
OPENVPN_OPTS: "--inactive 3600 --ping 10 --ping-exit 60" - OPENVPN_OPTS="--inactive 3600 --ping 10 --ping-exit 60"
LOCAL_NETWORK: 192.168.0.0/24 - LOCAL_NETWORK=192.168.0.0/24
proxy: proxy:
build: ./proxy/Dockerfile.armhf build: ./proxy/Dockerfile.armhf
links: links:
- transmission - transmission
ports: ports:
- 8080:8080 - "8080:8080"
volumes: volumes:
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro

View File

@@ -1,9 +1,11 @@
version: '2'
services:
transmission: transmission:
image: haugene/transmission-openvpn image: haugene/transmission-openvpn
privileged: true privileged: true
restart: always restart: always
ports: ports:
- 9091:9091 - "9091:9091"
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@@ -11,11 +13,11 @@ transmission:
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
- /your/storage/path/:/data - /your/storage/path/:/data
environment: environment:
OPENVPN_PROVIDER: PIA - OPENVPN_PROVIDER=PIA
OPENVPN_USERNAME: username - OPENVPN_USERNAME=username
OPENVPN_PASSWORD: password - OPENVPN_PASSWORD=password
OPENVPN_OPTS: "--inactive 3600 --ping 10 --ping-exit 60" - OPENVPN_OPTS="--inactive 3600 --ping 10 --ping-exit 60"
LOCAL_NETWORK: 192.168.0.0/24 - LOCAL_NETWORK=192.168.0.0/24
proxy: proxy:
image: haugene/transmission-openvpn-proxy image: haugene/transmission-openvpn-proxy

View File

@@ -31,10 +31,28 @@ if [ -z ${pia_client_id} ]; then
fi fi
# Get the port # Get the port
pia_response=$(curl -d "user=$pia_username&pass=$pia_passwd&client_id=$pia_client_id&local_ip=$local_vpn_ip" $port_assignment_url) pia_response=$(curl -s -f -d "user=$pia_username&pass=$pia_passwd&client_id=$pia_client_id&local_ip=$local_vpn_ip" $port_assignment_url)
# Check for curl error (curl will fail on HTTP errors with -f flag)
ret=$?
if [ $ret -ne 0 ]; then
echo "curl encountered an error looking up new port: $ret"
fi
# Check for errors in PIA response
error=$(echo $pia_response | grep -oE "\"error\".*\"")
if [ ! -z "$error" ]; then
echo "PIA returned an error: $error"
exit
fi
# Get new port, check if empty
new_port=$(echo $pia_response | grep -oE "[0-9]+") new_port=$(echo $pia_response | grep -oE "[0-9]+")
echo "Got new port $new_port from pia" if [ -z "$new_port" ]; then
echo "Could not find new port from PIA"
exit
fi
echo "Got new port $new_port from PIA"
# #
# Now, set port in Transmission # Now, set port in Transmission
@@ -61,4 +79,3 @@ if [ "$new_port" != "$transmission_peer_port" ]
else else
echo "No action needed, port hasn't changed" echo "No action needed, port hasn't changed"
fi fi