mirror of
https://github.com/MarkusMcNugen/docker-qBittorrentvpn
synced 2024-12-25 02:21:43 +00:00
Merge pull request #18 from haugene/dev
Bind transmission IPv4 address. Minor changes in run options, bump to version 1.1
This commit is contained in:
commit
f54b7c1f40
17
Dockerfile
17
Dockerfile
@ -1,11 +1,12 @@
|
||||
# Transmission and OpenVPN
|
||||
#
|
||||
# Version 1.0
|
||||
# Version 1.1
|
||||
|
||||
FROM ubuntu:14.04
|
||||
MAINTAINER Kristian Haugene
|
||||
|
||||
VOLUME /data
|
||||
VOLUME /config
|
||||
|
||||
# Update packages and install software
|
||||
RUN apt-get update \
|
||||
@ -17,16 +18,8 @@ RUN apt-get update \
|
||||
&& curl -L https://github.com/jwilder/dockerize/releases/download/v0.0.2/dockerize-linux-amd64-v0.0.2.tar.gz | tar -C /usr/local/bin -xzv
|
||||
|
||||
# Add configuration and scripts
|
||||
ADD piaconfig/* /etc/openvpn/
|
||||
ADD piaconfig/ca.crt /etc/openvpn/ca.crt
|
||||
ADD piaconfig/crl.pem /etc/openvpn/crl.pem
|
||||
ADD transmission/defaultSettings.tmpl /etc/transmission-daemon/settings.tmpl
|
||||
ADD transmission/updateTransmissionPort.sh /etc/transmission-daemon/updatePort.sh
|
||||
ADD transmission/periodicUpdates.sh /etc/transmission-daemon/periodicUpdates.sh
|
||||
ADD transmission/run.sh /etc/transmission-daemon/start.sh
|
||||
ADD transmission/runUpdates.sh /etc/transmission-daemon/startPortUpdates.sh
|
||||
ADD transmission/down.sh /etc/transmission-daemon/stop.sh
|
||||
ADD runOpenVpn.sh /etc/openvpn/start.sh
|
||||
ADD openvpn/* /etc/openvpn/
|
||||
ADD transmission/* /etc/transmission-daemon/
|
||||
|
||||
ENV PIA_USERNAME=**None** \
|
||||
PIA_PASSWORD=**None** \
|
||||
@ -103,6 +96,6 @@ ENV PIA_USERNAME=**None** \
|
||||
"TRANSMISSION_WATCH_DIR_ENABLED=true" \
|
||||
RESOLV_OVERRIDE=**None**
|
||||
|
||||
# Expose port and run. Use baseimage-docker's init system
|
||||
# Expose port and run
|
||||
EXPOSE 9091
|
||||
CMD ["/etc/openvpn/start.sh"]
|
||||
|
27
README.md
27
README.md
@ -2,7 +2,7 @@ Private Internet Access OpenVPN - Transmission
|
||||
===
|
||||
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.
|
||||
|
||||
# Run container from Docker registry
|
||||
## 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:
|
||||
|
||||
```
|
||||
@ -30,26 +30,19 @@ As you can see, the container expects a data volume to be mounted. It is used fo
|
||||
|
||||
The only mandatory configuration is to set two environment variables for your PIA username and password. You must set the environment variables `PIA_USERNAME` and `PIA_PASSWORD` to your login credentials. The container will connect to the Private Internet Access VPN servers in Netherlands by default.
|
||||
|
||||
NB: Instructions on how to use your own Transmission settings, and how to connect to the WebUI, is further down in the README.
|
||||
|
||||
## Required environment options
|
||||
### Required environment options
|
||||
| Variable | Function | Example |
|
||||
|----------|----------|-------|
|
||||
|`PIA_USERNAME`|Your login username for PIA|`PIA_USERNAME=asdf`|
|
||||
|`PIA_PASSWORD`|Your login password for PIA|`PIA_PASSWORD=asdf`|
|
||||
|
||||
## Network configuration options
|
||||
### Network configuration options
|
||||
| Variable | Function | Example |
|
||||
|----------|----------|-------|
|
||||
|`OPEN_VPN_CONFIG` | Sets the PIA endpoint to connect to. | `OPEN_VPN_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`|
|
||||
|
||||
## Storage options
|
||||
| Variable | Function | Example |
|
||||
|----------|----------|-------|
|
||||
|`KEEP_TRANSMISSION_STATE`|If set, persists transmission data to your /data mount point. Keeps state between restarts. Delete the folder to disable this later. |`KEEP_TRANSMISSION_STATE=YES`|
|
||||
|
||||
## Transmission configuration options
|
||||
### Transmission configuration options
|
||||
|
||||
You may override transmission options by setting the appropriate environment variable.
|
||||
|
||||
@ -64,7 +57,9 @@ The environment variables are the same name as used in the transmission settings
|
||||
|
||||
As you can see the variables are prefixed with `TRANSMISSION_`, the variable is capitalized, and `-` is converted to `_`.
|
||||
|
||||
# Building the container yourself
|
||||
PS: `TRANSMISSION_BIND_ADDRESS_IPV4` will be overridden to the IP assigned to tunnel interface by PIA. This is to prevent leaking of the host IP.
|
||||
|
||||
## Building the container yourself
|
||||
To build this container, clone the repository and cd into it.
|
||||
|
||||
### Build it:
|
||||
@ -84,7 +79,7 @@ $ docker run --privileged -d \
|
||||
|
||||
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.
|
||||
|
||||
### Access the WebUI
|
||||
## Access the WebUI
|
||||
But what's going on? My http://my-host:9091 isn't responding?
|
||||
This is because the VPN is active, and since docker is running in a different ip range than your client the response to your request will be treated as "non-local" traffic and therefore be routed out through the VPN interface.
|
||||
|
||||
@ -113,7 +108,7 @@ http {
|
||||
Your Transmission WebUI should now be avaliable at "your.host.ip.addr:8080/transmission/web/".
|
||||
Change the port in the docker run command if 8080 is not suitable for you.
|
||||
|
||||
### What if I want to run the container interactively.
|
||||
## What if I want to run the container interactively.
|
||||
If you want do have access inside the container while running you have two choices. To have a look inside an already running container, use docker exec to get a terminal inside the container.
|
||||
|
||||
```
|
||||
@ -129,3 +124,7 @@ $ docker run --privileged -it transmission-openvpn bash
|
||||
```
|
||||
|
||||
From there you can start the service yourself, or do whatever (probably developer-related) you came to do.
|
||||
|
||||
## Controlling Transmission remotely
|
||||
The container exposes /config as a volume. This is the directory where the supplied transmission and PIA credentials will be stored. If you have transmission authentication enabled and want scripts in another container to access and control the transmission-daemon, this can be a handy way to access the credentials.
|
||||
For example, another container may pause or restrict transmission speeds while the server is streaming video.
|
||||
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote aus-melbourne.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote aus.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote ca.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote ca-toronto.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote france.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote germany.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote hk.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote israel.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote japan.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote mexico.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote nl.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote ro.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote russia.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote sg.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote sweden.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote swiss.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote uk-london.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote uk-southampton.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote us-california.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote us-east.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote us-florida.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote us-midwest.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote us-seattle.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote us-siliconvalley.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote us-texas.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -1,5 +1,5 @@
|
||||
client
|
||||
dev tun
|
||||
dev tun0
|
||||
proto udp
|
||||
remote us-west.privateinternetaccess.com 1194
|
||||
resolv-retry infinite
|
@ -38,13 +38,7 @@ fi
|
||||
echo $TRANSMISSION_RPC_USERNAME > /config/transmission-credentials.txt
|
||||
echo $TRANSMISSION_RPC_PASSWORD >> /config/transmission-credentials.txt
|
||||
|
||||
|
||||
if [ ! -z ${KEEP_TRANSMISSION_STATE} ]
|
||||
then
|
||||
mkdir -p /data/transmission-data/
|
||||
dockerize -template /etc/transmission-daemon/settings.tmpl:/data/transmission-data/settings.json true
|
||||
else
|
||||
dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-daemon/settings.json true
|
||||
fi
|
||||
# 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"
|
74
transmission/environment-variables.tmpl
Normal file
74
transmission/environment-variables.tmpl
Normal file
@ -0,0 +1,74 @@
|
||||
#! /bin/sh
|
||||
|
||||
export TRANSMISSION_ALT_SPEED_DOWN={{ .Env.TRANSMISSION_ALT_SPEED_DOWN }}
|
||||
export TRANSMISSION_ALT_SPEED_ENABLED={{ .Env.TRANSMISSION_ALT_SPEED_ENABLED }}
|
||||
export TRANSMISSION_ALT_SPEED_TIME_BEGIN={{ .Env.TRANSMISSION_ALT_SPEED_TIME_BEGIN }}
|
||||
export TRANSMISSION_ALT_SPEED_TIME_DAY={{ .Env.TRANSMISSION_ALT_SPEED_TIME_DAY }}
|
||||
export TRANSMISSION_ALT_SPEED_TIME_ENABLED={{ .Env.TRANSMISSION_ALT_SPEED_TIME_ENABLED }}
|
||||
export TRANSMISSION_ALT_SPEED_TIME_END={{ .Env.TRANSMISSION_ALT_SPEED_TIME_END }}
|
||||
export TRANSMISSION_ALT_SPEED_UP={{ .Env.TRANSMISSION_ALT_SPEED_UP }}
|
||||
export TRANSMISSION_BIND_ADDRESS_IPV4={{ .Env.TRANSMISSION_BIND_ADDRESS_IPV4 }}
|
||||
export TRANSMISSION_BIND_ADDRESS_IPV6={{ .Env.TRANSMISSION_BIND_ADDRESS_IPV6 }}
|
||||
export TRANSMISSION_BLOCKLIST_ENABLED={{ .Env.TRANSMISSION_BLOCKLIST_ENABLED }}
|
||||
export TRANSMISSION_BLOCKLIST_URL={{ .Env.TRANSMISSION_BLOCKLIST_URL }}
|
||||
export TRANSMISSION_CACHE_SIZE_MB={{ .Env.TRANSMISSION_CACHE_SIZE_MB }}
|
||||
export TRANSMISSION_DHT_ENABLED={{ .Env.TRANSMISSION_DHT_ENABLED }}
|
||||
export TRANSMISSION_DOWNLOAD_DIR={{ .Env.TRANSMISSION_DOWNLOAD_DIR }}
|
||||
export TRANSMISSION_DOWNLOAD_LIMIT={{ .Env.TRANSMISSION_DOWNLOAD_LIMIT }}
|
||||
export TRANSMISSION_DOWNLOAD_LIMIT_ENABLED={{ .Env.TRANSMISSION_DOWNLOAD_LIMIT_ENABLED }}
|
||||
export TRANSMISSION_DOWNLOAD_QUEUE_ENABLED={{ .Env.TRANSMISSION_DOWNLOAD_QUEUE_ENABLED }}
|
||||
export TRANSMISSION_DOWNLOAD_QUEUE_SIZE={{ .Env.TRANSMISSION_DOWNLOAD_QUEUE_SIZE }}
|
||||
export TRANSMISSION_ENCRYPTION={{ .Env.TRANSMISSION_ENCRYPTION }}
|
||||
export TRANSMISSION_IDLE_SEEDING_LIMIT={{ .Env.TRANSMISSION_IDLE_SEEDING_LIMIT }}
|
||||
export TRANSMISSION_IDLE_SEEDING_LIMIT_ENABLED={{ .Env.TRANSMISSION_IDLE_SEEDING_LIMIT_ENABLED }}
|
||||
export TRANSMISSION_INCOMPLETE_DIR={{ .Env.TRANSMISSION_INCOMPLETE_DIR }}
|
||||
export TRANSMISSION_INCOMPLETE_DIR_ENABLED={{ .Env.TRANSMISSION_INCOMPLETE_DIR_ENABLED }}
|
||||
export TRANSMISSION_LPD_ENABLED={{ .Env.TRANSMISSION_LPD_ENABLED }}
|
||||
export TRANSMISSION_MAX_PEERS_GLOBAL={{ .Env.TRANSMISSION_MAX_PEERS_GLOBAL }}
|
||||
export TRANSMISSION_MESSAGE_LEVEL={{ .Env.TRANSMISSION_MESSAGE_LEVEL }}
|
||||
export TRANSMISSION_PEER_CONGESTION_ALGORITHM={{ .Env.TRANSMISSION_PEER_CONGESTION_ALGORITHM }}
|
||||
export TRANSMISSION_PEER_ID_TTL_HOURS={{ .Env.TRANSMISSION_PEER_ID_TTL_HOURS }}
|
||||
export TRANSMISSION_PEER_LIMIT_GLOBAL={{ .Env.TRANSMISSION_PEER_LIMIT_GLOBAL }}
|
||||
export TRANSMISSION_PEER_LIMIT_PER_TORRENT={{ .Env.TRANSMISSION_PEER_LIMIT_PER_TORRENT }}
|
||||
export TRANSMISSION_PEER_PORT={{ .Env.TRANSMISSION_PEER_PORT }}
|
||||
export TRANSMISSION_PEER_PORT_RANDOM_HIGH={{ .Env.TRANSMISSION_PEER_PORT_RANDOM_HIGH }}
|
||||
export TRANSMISSION_PEER_PORT_RANDOM_LOW={{ .Env.TRANSMISSION_PEER_PORT_RANDOM_LOW }}
|
||||
export TRANSMISSION_PEER_PORT_RANDOM_ON_START={{ .Env.TRANSMISSION_PEER_PORT_RANDOM_ON_START }}
|
||||
export TRANSMISSION_PEER_SOCKET_TOS={{ .Env.TRANSMISSION_PEER_SOCKET_TOS }}
|
||||
export TRANSMISSION_PEX_ENABLED={{ .Env.TRANSMISSION_PEX_ENABLED }}
|
||||
export TRANSMISSION_PORT_FORWARDING_ENABLED={{ .Env.TRANSMISSION_PORT_FORWARDING_ENABLED }}
|
||||
export TRANSMISSION_PREALLOCATION={{ .Env.TRANSMISSION_PREALLOCATION }}
|
||||
export TRANSMISSION_PREFETCH_ENABLED={{ .Env.TRANSMISSION_PREFETCH_ENABLED }}
|
||||
export TRANSMISSION_QUEUE_STALLED_ENABLED={{ .Env.TRANSMISSION_QUEUE_STALLED_ENABLED }}
|
||||
export TRANSMISSION_QUEUE_STALLED_MINUTES={{ .Env.TRANSMISSION_QUEUE_STALLED_MINUTES }}
|
||||
export TRANSMISSION_RATIO_LIMIT={{ .Env.TRANSMISSION_RATIO_LIMIT }}
|
||||
export TRANSMISSION_RATIO_LIMIT_ENABLED={{ .Env.TRANSMISSION_RATIO_LIMIT_ENABLED }}
|
||||
export TRANSMISSION_RENAME_PARTIAL_FILES={{ .Env.TRANSMISSION_RENAME_PARTIAL_FILES }}
|
||||
export TRANSMISSION_RPC_AUTHENTICATION_REQUIRED={{ .Env.TRANSMISSION_RPC_AUTHENTICATION_REQUIRED }}
|
||||
export TRANSMISSION_RPC_BIND_ADDRESS={{ .Env.TRANSMISSION_RPC_BIND_ADDRESS }}
|
||||
export TRANSMISSION_RPC_ENABLED={{ .Env.TRANSMISSION_RPC_ENABLED }}
|
||||
export TRANSMISSION_RPC_PASSWORD={{ .Env.TRANSMISSION_RPC_PASSWORD }}
|
||||
export TRANSMISSION_RPC_PORT={{ .Env.TRANSMISSION_RPC_PORT }}
|
||||
export TRANSMISSION_RPC_URL={{ .Env.TRANSMISSION_RPC_URL }}
|
||||
export TRANSMISSION_RPC_USERNAME={{ .Env.TRANSMISSION_RPC_USERNAME }}
|
||||
export TRANSMISSION_RPC_WHITELIST={{ .Env.TRANSMISSION_RPC_WHITELIST }}
|
||||
export TRANSMISSION_RPC_WHITELIST_ENABLED={{ .Env.TRANSMISSION_RPC_WHITELIST_ENABLED }}
|
||||
export TRANSMISSION_SCRAPE_PAUSED_TORRENTS_ENABLED={{ .Env.TRANSMISSION_SCRAPE_PAUSED_TORRENTS_ENABLED }}
|
||||
export TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED={{ .Env.TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED }}
|
||||
export TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME={{ .Env.TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME }}
|
||||
export TRANSMISSION_SEED_QUEUE_ENABLED={{ .Env.TRANSMISSION_SEED_QUEUE_ENABLED }}
|
||||
export TRANSMISSION_SEED_QUEUE_SIZE={{ .Env.TRANSMISSION_SEED_QUEUE_SIZE }}
|
||||
export TRANSMISSION_SPEED_LIMIT_DOWN={{ .Env.TRANSMISSION_SPEED_LIMIT_DOWN }}
|
||||
export TRANSMISSION_SPEED_LIMIT_DOWN_ENABLED={{ .Env.TRANSMISSION_SPEED_LIMIT_DOWN_ENABLED }}
|
||||
export TRANSMISSION_SPEED_LIMIT_UP={{ .Env.TRANSMISSION_SPEED_LIMIT_UP }}
|
||||
export TRANSMISSION_SPEED_LIMIT_UP_ENABLED={{ .Env.TRANSMISSION_SPEED_LIMIT_UP_ENABLED }}
|
||||
export TRANSMISSION_START_ADDED_TORRENTS={{ .Env.TRANSMISSION_START_ADDED_TORRENTS }}
|
||||
export TRANSMISSION_TRASH_ORIGINAL_TORRENT_FILES={{ .Env.TRANSMISSION_TRASH_ORIGINAL_TORRENT_FILES }}
|
||||
export TRANSMISSION_UMASK={{ .Env.TRANSMISSION_UMASK }}
|
||||
export TRANSMISSION_UPLOAD_LIMIT={{ .Env.TRANSMISSION_UPLOAD_LIMIT }}
|
||||
export TRANSMISSION_UPLOAD_LIMIT_ENABLED={{ .Env.TRANSMISSION_UPLOAD_LIMIT_ENABLED }}
|
||||
export TRANSMISSION_UPLOAD_SLOTS_PER_TORRENT={{ .Env.TRANSMISSION_UPLOAD_SLOTS_PER_TORRENT }}
|
||||
export TRANSMISSION_UTP_ENABLED={{ .Env.TRANSMISSION_UTP_ENABLED }}
|
||||
export TRANSMISSION_WATCH_DIR={{ .Env.TRANSMISSION_WATCH_DIR }}
|
||||
export TRANSMISSION_WATCH_DIR_ENABLED={{ .Env.TRANSMISSION_WATCH_DIR_ENABLED }}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
while [ 1 ]
|
||||
do
|
||||
|
@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f /data/transmission-data/settings.json ]
|
||||
then
|
||||
echo "STARTING TRANSMISSION: Using transmission-data subdirectory to your /data mount point to store state."
|
||||
exec /usr/bin/transmission-daemon -g /data/transmission-data/ &
|
||||
else
|
||||
echo "STARTING TRANSMISSION: Storing state in container only."
|
||||
exec /usr/bin/transmission-daemon -g /etc/transmission-daemon/ &
|
||||
fi
|
||||
|
||||
exec /etc/transmission-daemon/startPortUpdates.sh &
|
||||
|
||||
echo "STARTED PORT UPDATER"
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec /etc/transmission-daemon/periodicUpdates.sh
|
19
transmission/start.sh
Executable file
19
transmission/start.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Source our persisted env variables from container startup
|
||||
. /etc/transmission-daemon/environment-variables.sh
|
||||
|
||||
tun0ip=$(ifconfig tun0 | sed -n '2 p' | awk '{print $2}' | cut -d: -f2)
|
||||
echo "Updating TRANSMISSION_BIND_ADDRESS_IPV4 to tun0 ip: ${tun0ip}"
|
||||
export TRANSMISSION_BIND_ADDRESS_IPV4=${tun0ip}
|
||||
|
||||
echo "Generating transmission settings.json from env variables"
|
||||
dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-daemon/settings.json /bin/true
|
||||
|
||||
echo "STARTING TRANSMISSION"
|
||||
exec /usr/bin/transmission-daemon -g /etc/transmission-daemon/ &
|
||||
|
||||
echo "STARTING PORT UPDATER"
|
||||
exec /etc/transmission-daemon/periodicUpdates.sh &
|
||||
|
||||
echo "Transmission startup script complete."
|
@ -1,3 +1,3 @@
|
||||
#! /bin/bash
|
||||
#! /bin/sh
|
||||
|
||||
kill $(ps aux | grep transmission-daemon | grep -v grep | awk '{print $2}')
|
@ -1,4 +1,4 @@
|
||||
#/bin/bash
|
||||
#! /bin/sh
|
||||
|
||||
# Settings
|
||||
PIA_PASSWD_FILE=/config/pia-credentials.txt
|
||||
@ -13,13 +13,6 @@ pia_client_id_file=/etc/transmission-daemon/pia_client_id
|
||||
transmission_settings_file=/etc/transmission-daemon/settings.json
|
||||
port_assignment_url=https://www.privateinternetaccess.com/vpninfo/port_forward_assignment
|
||||
|
||||
if [ -f /data/transmission-data/settings.json ];
|
||||
then
|
||||
transmission_settings_file=/data/transmission-data/settings.json
|
||||
else
|
||||
transmission_settings_file=/etc/transmission-daemon/settings.json
|
||||
fi
|
||||
|
||||
#
|
||||
# First get a port from PIA
|
||||
#
|
||||
@ -29,7 +22,7 @@ new_client_id() {
|
||||
}
|
||||
|
||||
pia_client_id="$(cat $pia_client_id_file 2>/dev/null)"
|
||||
if [[ -z "$pia_client_id" ]]; then
|
||||
if [ -z ${pia_client_id} ]; then
|
||||
echo "Generating new client id for PIA"
|
||||
pia_client_id=$(new_client_id)
|
||||
fi
|
||||
@ -46,7 +39,7 @@ echo "Got new port $new_port from pia"
|
||||
|
||||
# Check if transmission remote is set up with authentication
|
||||
auth_enabled=$(grep 'rpc-authentication-required\"' $transmission_settings_file | grep -oE 'true|false')
|
||||
if [[ "true" = "$auth_enabled" ]]
|
||||
if [ "true" = "$auth_enabled" ]
|
||||
then
|
||||
echo "transmission auth required"
|
||||
myauth="--auth $transmission_username:$transmission_passwd"
|
||||
@ -57,7 +50,7 @@ fi
|
||||
|
||||
# get current listening port
|
||||
transmission_peer_port=$(transmission-remote $myauth -si | grep Listenport | grep -oE '[0-9]+')
|
||||
if [[ "$new_port" != "$transmission_peer_port" ]]
|
||||
if [ "$new_port" != "$transmission_peer_port" ]
|
||||
then
|
||||
transmission-remote $myauth -p "$new_port"
|
||||
echo "Checking port..."
|
Loading…
Reference in New Issue
Block a user