diff --git a/scripts/deluge/Caddyfile.templ b/scripts/deluge/Caddyfile.templ new file mode 100644 index 0000000..7da8288 --- /dev/null +++ b/scripts/deluge/Caddyfile.templ @@ -0,0 +1,5 @@ +https://torrent.$domain { + @blocked not remote_ip 10.0.0.0/24 10.0.89.0/24 + respond @blocked "Internal use only" 403 + reverse_proxy http://localhost:8085 +} diff --git a/scripts/deluge/docker-compose.yml.templ b/scripts/deluge/docker-compose.yml.templ new file mode 100644 index 0000000..08c7a14 --- /dev/null +++ b/scripts/deluge/docker-compose.yml.templ @@ -0,0 +1,17 @@ +version: "2" +services: + deluge: + image: lscr.io/linuxserver/deluge:latest + container_name: deluge + restart: unless-stopped + environment: + - UMASK_SET=022 + - TZ=$timezone + - PUID=1000 + - PGID=1000 + - DELUGE_LOGLEVEL=error + ports: + - 127.0.0.1:8085:8112 + volumes: + - /data/deluge/downloads:/downloads + - /data/deluge/config:/config diff --git a/scripts/deluge/script.sh b/scripts/deluge/script.sh new file mode 100644 index 0000000..39d5dbf --- /dev/null +++ b/scripts/deluge/script.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -euo pipefail + +source "$HL_LIB" + +_assert_vars HL_TIMEZONE HL_DOMAIN; + +_ch_001-make_dirs() { + mkdir -p ~/deluge /data/deluge; +} + +_ch_002-copy_compose() { + cp $(_fill docker-compose.yml.templ) ~/deluge/docker-compose.yml; +} + +_ch_003-update_caddy() { + cp $(_fill Caddyfile.templ) /etc/caddy/conf.d/deluge.Caddyfile; + chmod a+r /etc/caddy/conf.d/deluge.Caddyfile; + sudo systemctl reload caddy.service; +} + +_ch_004-install_wg_vpn() { + sudo apt-get install -y wireguard-tools + [ -f /data/deluge/wg-vpn.conf ] || _err "Please create /data/deluge/wg-vpn.conf with correct vpn config" + sudo chown root:root /data/deluge/wg-vpn.conf + sudo chmod 600 /data/deluge/wg-vpn.conf + sudo ln -sf /data/deluge/wg-vpn.conf /etc/wireguard/wg0.conf + sudo systemctl enable --now wg-quick@wg0 +} + +_ch_005-run_service() { + cd ~/deluge; + docker-compose up -d; +} + +_run_checkpoints