Browse Source

replaced Transmission with Deluge

master
sscraggles 5 years ago
parent
commit
fc86d9f78a
7 changed files with 303 additions and 0 deletions
  1. 14
    0
      deluge/blocklist.conf
  2. 105
    0
      deluge/core.conf
  3. 28
    0
      deluge/environment-variables.tmpl
  4. 71
    0
      deluge/start.sh
  5. 20
    0
      deluge/stop.sh
  6. 43
    0
      deluge/userSetup.sh
  7. 22
    0
      deluge/web.conf

+ 14
- 0
deluge/blocklist.conf View File

@@ -0,0 +1,14 @@
{
"file": 1,
"format": 1
}{
"check_after_days": 4,
"timeout": 180,
"url": "https://raw.githubusercontent.com/brjppru/bltr/master/blocklist.txt",
"try_times": 3,
"list_size": 17349670,
"last_update": 1504868257.779394,
"list_type": "PeerGuardian",
"list_compression": "GZip",
"load_on_start": false
}

+ 105
- 0
deluge/core.conf View File

@@ -0,0 +1,105 @@
{
"file": 1,
"format": 1
}{
"info_sent": 0.0,
"lsd": true,
"send_info": false,
"move_completed_path": "/data/complete",
"enc_in_policy": 1,
"queue_new_to_top": false,
"ignore_limits_on_local_network": true,
"rate_limit_ip_overhead": true,
"daemon_port": 58846,
"natpmp": true,
"max_active_limit": 40,
"utpex": true,
"max_active_downloading": 10,
"max_active_seeding": 5,
"allow_remote": true,
"max_half_open_connections": 20,
"download_location": "/data/incomplete",
"compact_allocation": false,
"max_upload_speed": 256.0,
"cache_expiry": 60,
"prioritize_first_last_pieces": false,
"auto_managed": true,
"enc_level": 2,
"max_connections_per_second": 20,
"dont_count_slow_torrents": true,
"random_outgoing_ports": true,
"max_upload_slots_per_torrent": 4,
"new_release_check": false,
"enc_out_policy": 1,
"outgoing_ports": [
0,
0
],
"seed_time_limit": 0,
"cache_size": 512,
"share_ratio_limit": 0.0,
"max_download_speed": 4608.0,
"geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
"torrentfiles_location": "/data/torrents",
"stop_seed_at_ratio": true,
"peer_tos": "0x00",
"listen_interface": "",
"upnp": true,
"max_download_speed_per_torrent": -1,
"max_upload_slots_global": 4,
"enabled_plugins": [
"Label",
"IfaceWatch",
"DeletePartials"
],
"random_port": false,
"autoadd_enable": true,
"max_connections_global": 200,
"enc_prefer_rc4": true,
"listen_ports": [
8563,
8575
],
"dht": true,
"stop_seed_ratio": 0.5,
"seed_time_ratio_limit": 0.0,
"max_upload_speed_per_torrent": -1,
"copy_torrent_file": true,
"del_copy_torrent_file": false,
"move_completed": true,
"proxies": {
"peer": {
"username": "",
"password": "",
"type": 0,
"hostname": "",
"port": 8080
},
"web_seed": {
"username": "",
"password": "",
"type": 0,
"hostname": "",
"port": 8080
},
"tracker": {
"username": "",
"password": "",
"type": 0,
"hostname": "",
"port": 8080
},
"dht": {
"username": "",
"password": "",
"type": 0,
"hostname": "",
"port": 8080
}
},
"add_paused": false,
"max_connections_per_torrent": 40,
"remove_seed_at_ratio": false,
"autoadd_location": "/data/torrents_watch",
"plugins_location": "/config/plugins"
}

+ 28
- 0
deluge/environment-variables.tmpl View File

@@ -0,0 +1,28 @@
#! /bin/sh

export DELUGE_PASSWORD={{ .Env.DELUGE_PASSWORD }}
export DELUGE_USERNAME={{ .Env.DELUGE_USERNAME }}
export DELUGE_PEER_PORT={{ .Env.DELUGE_PEER_PORT }}
export DELUGE_PEER_PORT_RANDOM_HIGH={{ .Env.DELUGE_PEER_PORT_RANDOM_HIGH }}
export DELUGE_PEER_PORT_RANDOM_LOW={{ .Env.DELUGE_PEER_PORT_RANDOM_LOW }}
export DELUGE_PEER_PORT_RANDOM_ON_START={{ .Env.DELUGE_PEER_PORT_RANDOM_ON_START }}
export DELUGE_RPC_PORT={{ .Env.DELUGE_RPC_PORT }}
export DELUGE_DOWNLOAD_DIR={{ .Env.DELUGE_DOWNLOAD_DIR }}
export DELUGE_INCOMPLETE_DIR={{ .Env.DELUGE_INCOMPLETE_DIR }}
export DELUGE_WATCH_DIR={{ .Env.DELUGE_WATCH_DIR }}
export DELUGE_HOME={{ .Env.DELUGE_HOME }}

# Deluge needs to know which VPN provider is used
export OPENVPN_PROVIDER={{ .Env.OPENVPN_PROVIDER }}

export ENABLE_UFW={{ .Env.ENABLE_UFW }}

export PUID={{ .Env.PUID }}
export PGID={{ .Env.PGID }}

# Need to pass through our tinyproxy settings
export WEBPROXY_ENABLED={{ .Env.WEBPROXY_ENABLED }}
export WEBPROXY_PORT={{ .Env.WEBPROXY_PORT }}

# Support dropping the default route after connection
export DROP_DEFAULT_ROUTE={{ .Env.DROP_DEFAULT_ROUTE }}

+ 71
- 0
deluge/start.sh View File

@@ -0,0 +1,71 @@
#!/bin/sh

# Source our persisted env variables from container startup
. /etc/deluge/environment-variables.sh

# This script will be called with tun/tap device name as parameter 1, and local IP as parameter 4
# See https://openvpn.net/index.php/open-source/documentation/manuals/65-openvpn-20x-manpage.html (--up cmd)
echo "Up script executed with $*"
if [ "$4" = "" ]; then
echo "ERROR, unable to obtain tunnel address"
echo "killing $PPID"
kill -9 $PPID
exit 1
fi

# If deluge-pre-start.sh exists, run it
if [ -x /scripts/deluge-pre-start.sh ]
then
echo "Executing /scripts/deluge-pre-start.sh"
/scripts/deluge-pre-start.sh
echo "/scripts/deluge-pre-start.sh returned $?"
fi

echo "Updating DELUGE_BIND_ADDRESS_IPV4 to the ip of $1 : $4"
export DELUGE_BIND_ADDRESS_IPV4=$4

#echo "Generating transmission settings.json from env variables"
## Ensure DELUGE_HOME is created
#mkdir -p ${DELUGE_HOME}
dockerize -template /etc/deluge/settings.tmpl:${DELUGE_HOME}/settings.json

#echo "sed'ing True to true"
#sed -i 's/True/true/g' ${DELUGE_HOME}/settings.json

#if [ ! -e "/dev/random" ]; then
# # Avoid "Fatal: no entropy gathering module detected" error
# echo "INFO: /dev/random not found - symlink to /dev/urandom"
# ln -s /dev/urandom /dev/random
#fi

. /etc/deluge/userSetup.sh

if [ "true" = "$DROP_DEFAULT_ROUTE" ]; then
echo "DROPPING DEFAULT ROUTE"
ip r del default || exit 1
fi

echo "STARTING DELUGED"
exec su --preserve-environment ${RUN_AS} -s /bin/bash -c "deluged -d -c /config -L info -l /data/deluged.log" &
#exec su --preserve-environment abc -s /bin/bash -c "deluged -d -c /data -L info -l /data/deluged.log" &
echo "STARTING DELUGE-WEB"
exec su --preserve-environment ${RUN_AS} -s /bin/bash -c "deluge-web -c /config" &
#exec su --preserve-environment abc -s /bin/bash -c "deluge-web -c /data" &

#if [ "$OPENVPN_PROVIDER" = "PIA" ]
#then
# echo "CONFIGURING PORT FORWARDING"
# exec /etc/deluge/updatePort.sh &
#else
# echo "NO PORT UPDATER FOR THIS PROVIDER"
#fi

# If deluge-post-start.sh exists, run it
if [ -x /scripts/deluge-post-start.sh ]
then
echo "Executing /scripts/deluge-post-start.sh"
/scripts/deluge-post-start.sh
echo "/scripts/deluge-post-start.sh returned $?"
fi

echo "Deluge startup script complete."

+ 20
- 0
deluge/stop.sh View File

@@ -0,0 +1,20 @@
#! /bin/sh

# If deluge-pre-stop.sh exists, run it
if [ -x /scripts/deluge-pre-stop.sh ]
then
echo "Executing /scripts/deluge-pre-stop.sh"
/scripts/deluge-pre-stop.sh
echo "/scripts/deluge-pre-stop.sh returned $?"
fi

kill $(pidof deluged)
kill $(pidof deluge-web)

# If deluge-post-stop.sh exists, run it
if [ -x /scripts/deluge-post-stop.sh ]
then
echo "Executing /scripts/deluge-post-stop.sh"
/scripts/deluge-post-stop.sh
echo "/scripts/deluge-post-stop.sh returned $?"
fi

+ 43
- 0
deluge/userSetup.sh View File

@@ -0,0 +1,43 @@
#!/bin/sh

# More/less taken from https://github.com/linuxserver/docker-baseimage-alpine/blob/3eb7146a55b7bff547905e0d3f71a26036448ae6/root/etc/cont-init.d/10-adduser

RUN_AS=root

if [ -n "$PUID" ] && [ ! "$(id -u root)" -eq "$PUID" ]; then
RUN_AS=abc
if [ ! "$(id -u ${RUN_AS})" -eq "$PUID" ]; then usermod -o -u "$PUID" ${RUN_AS} ; fi
if [ ! "$(id -g ${RUN_AS})" -eq "$PGID" ]; then groupmod -o -g "$PGID" ${RUN_AS} ; fi

echo "Setting owner for deluge paths to ${PUID}:${PGID}"
chown -R ${RUN_AS}:${RUN_AS} \
/config \
/data \
${DELUGE_HOME} \
${DELUGE_DOWNLOAD_DIR} \
${DELUGE_INCOMPLETE_DIR} \
${DELUGE_WATCH_DIR}
echo "Setting permission for files (644) and directories (755)"
chmod -R go=rX,u=rwX \
/config \
/data \
${DELUGE_HOME} \
${DELUGE_DOWNLOAD_DIR} \
${DELUGE_INCOMPLETE_DIR} \
${DELUGE_WATCH_DIR}
fi

echo "
-------------------------------------
Deluge will run as
-------------------------------------
User name: ${RUN_AS}
User uid: $(id -u ${RUN_AS})
User gid: $(id -g ${RUN_AS})
-------------------------------------
"

export PUID
export PGID
export RUN_AS

+ 22
- 0
deluge/web.conf View File

@@ -0,0 +1,22 @@
{
"file": 1,
"format": 1
}{
"port": 8112,
"enabled_plugins": [],
"pwd_sha1": "be5ef7c4cb35ebc1b514d0b0b9fef4ef5509d0f5",
"theme": "gray",
"show_sidebar": true,
"sidebar_show_zero": false,
"pkey": "ssl/daemon.pkey",
"https": false,
"sessions": {},
"base": "/",
"pwd_salt": "b0bf9c98ec37745e19d9ff680ca3b2fff9f90c8d",
"show_session_speed": false,
"first_login": false,
"cert": "ssl/daemon.cert",
"session_timeout": 3600,
"default_daemon": "127.0.0.1:58846",
"sidebar_multiple_filters": true
}

Loading…
Cancel
Save