diff --git a/Dockerfile b/Dockerfile index ee3f75ffa..345360748 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,8 @@ RUN set -ex; \ echo "Adding user"; \ groupadd -g 911 abc && \ useradd -u 911 -g 911 -s /bin/false -m abc && \ - usermod -G users abc + usermod -G users abc && \ + mkdir -p /config/deluge && mkdir -p /config/delugeweb # Add configuration and scripts COPY root/ / @@ -37,7 +38,9 @@ ENV OPENVPN_USERNAME=**None** \ LANG='en_US.UTF-8' \ LANGUAGE='en_US.UTF-8' \ TERM='xterm' \ - LOCAL_NETWORK= + LOCAL_NETWORK= \ + PEER_DNS= \ + DISABLE_PORT_UPDATER= HEALTHCHECK --interval=1m CMD /etc/scripts/healthcheck.sh @@ -46,4 +49,4 @@ VOLUME /config EXPOSE 8112 58846 58946 58946/udp -CMD ["dumb-init", "/etc/openvpn/start.sh"] \ No newline at end of file +CMD ["dumb-init", "/etc/openvpn/init.sh"] \ No newline at end of file diff --git a/root/etc/deluge/start.sh b/root/etc/deluge/start.sh index e29d82165..050f56bac 100755 --- a/root/etc/deluge/start.sh +++ b/root/etc/deluge/start.sh @@ -2,7 +2,7 @@ TIMESTAMP_FORMAT='%a %b %d %T %Y' log() { - echo "$(date +"${TIMESTAMP_FORMAT}") [tunnel-up] $*" + echo "$(date +"${TIMESTAMP_FORMAT}") [deluge-start] $*" } # Source our persisted env variables from container startup @@ -72,7 +72,7 @@ fi ufw status log "Starting Deluge" -exec su --preserve-environment abc -s /bin/bash -c "/usr/bin/deluged -d -c /config -L info -l /config/deluged.log" & +exec su --preserve-environment abc -s /bin/bash -c "/usr/bin/deluged -d -c /config/deluge -L info -l /config/deluge/deluged.log" & # wait for deluge daemon process to start (listen for port) while [[ $(netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ".58846"') == "" ]]; do @@ -80,7 +80,7 @@ while [[ $(netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ".58846"') == "" ]]; do done log "Starting Deluge webui..." -exec su --preserve-environment abc -s /bin/bash -c "/usr/bin/deluge-web -d -c /config -L info -l /config/web.log" & +exec su --preserve-environment abc -s /bin/bash -c "/usr/bin/deluge-web -d -c /config/delugeweb -L info -l /config/delugeweb/web.log" & # Configure port forwarding if applicable if [[ -x /etc/openvpn/${OPENVPN_PROVIDER,,}/update-port.sh && -z $DISABLE_PORT_UPDATER ]]; then diff --git a/root/etc/deluge/stop.sh b/root/etc/deluge/stop.sh index 942833255..6f5665ab7 100755 --- a/root/etc/deluge/stop.sh +++ b/root/etc/deluge/stop.sh @@ -2,18 +2,18 @@ TIMESTAMP_FORMAT='%a %b %d %T %Y' log() { - echo "$(date +"${TIMESTAMP_FORMAT}") [tunnel-down] $*" + echo "$(date +"${TIMESTAMP_FORMAT}") [deluge-stop] $*" } # If deluge-pre-stop.sh exists, run it if [[ -x /config/deluge-pre-stop.sh ]] then - echo "Executing /config/deluge-pre-stop.sh" + log "Executing /config/deluge-pre-stop.sh" /config/deluge-pre-stop.sh "$@" - echo "/config/deluge-pre-stop.sh returned $?" + log "/config/deluge-pre-stop.sh returned $?" fi -echo "Sending kill signal to deluge-daemon" +log "Sending kill signal to deluge-daemon" PID=$(pidof deluged) kill -9 $PID # Give deluge-daemon time to shut down @@ -25,7 +25,7 @@ done # If deluge-post-stop.sh exists, run it if [[ -x /config/deluge-post-stop.sh ]] then - echo "Executing /config/deluge-post-stop.sh" + log "Executing /config/deluge-post-stop.sh" /config/deluge-post-stop.sh "$@" - echo "/config/deluge-post-stop.sh returned $?" + log "/config/deluge-post-stop.sh returned $?" fi diff --git a/root/etc/openvpn/start.sh b/root/etc/openvpn/init.sh similarity index 98% rename from root/etc/openvpn/start.sh rename to root/etc/openvpn/init.sh index 5b4e5bdf9..423ddf0be 100755 --- a/root/etc/openvpn/start.sh +++ b/root/etc/openvpn/init.sh @@ -6,7 +6,7 @@ TIMESTAMP_FORMAT='%a %b %d %T %Y' log() { - echo "$(date +"${TIMESTAMP_FORMAT}") [tunnel-up] $*" + echo "$(date +"${TIMESTAMP_FORMAT}") [start-vpn] $*" } if [[ -n "$REVISION" ]]; then @@ -73,7 +73,7 @@ chmod -R 775 /usr/bin/deluged /usr/bin/deluge-web # if config file doesnt exist (wont exist until user changes a setting) then copy default config file if [[ ! -f /config/core.conf ]]; then log "[info] Deluge config file doesn't exist, copying default..." - cp /etc/config/core.conf /config/ + cp /etc/config/core.conf /config/deluge/ else log "[info] Deluge config file already exists, skipping copy" fi @@ -81,7 +81,7 @@ fi # if config file doesnt exist then copy stock config file if [[ ! -f /config/web.conf ]]; then log "[info] Deluge webui config file doesn't exist, copying default..." - cp /etc/config/web.conf /config/ + cp /etc/config/web.conf /config/deluge-web/ else log "[info] Deluge webui config file already exists, skipping copy" fi diff --git a/root/etc/ufw/disable.sh b/root/etc/ufw/disable.sh new file mode 100644 index 000000000..a64ac3a7f --- /dev/null +++ b/root/etc/ufw/disable.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +TIMESTAMP_FORMAT='%a %b %d %T %Y' +log() { + echo "$(date +"${TIMESTAMP_FORMAT}") [ufw-disable] $*" +} +# Source our persisted env variables from container startup +. /etc/deluge/environment-variables.sh + +ufw reset +ufw disable +ufw status \ No newline at end of file diff --git a/root/etc/ufw/enable.sh b/root/etc/ufw/enable.sh index 09cee36cd..8305b3c8c 100755 --- a/root/etc/ufw/enable.sh +++ b/root/etc/ufw/enable.sh @@ -4,7 +4,7 @@ set -e TIMESTAMP_FORMAT='%a %b %d %T %Y' log() { - echo "$(date +"${TIMESTAMP_FORMAT}") [tunnel-up] $*" + echo "$(date +"${TIMESTAMP_FORMAT}") [ufw-enable] $*" } # Source our persisted env variables from container startup . /etc/deluge/environment-variables.sh