avoid unnecessary nested content

This commit is contained in:
Colin Hebert
2023-11-20 09:17:35 +11:00
parent 7b34d3735d
commit 41d64d4b48
46 changed files with 0 additions and 8 deletions

View File

@@ -0,0 +1,8 @@
#!/command/with-contenv bash
echo "Installing Git..."
apk add -u git
echo "Installing py-natpmp"
rm -r /py-natpmp || echo "py-natpmp clean"
git clone https://github.com/yimingliu/py-natpmp.git /py-natpmp

View File

@@ -0,0 +1,23 @@
#!/command/with-contenv bash
echo "Obtaining Wireguard Server IP..."
wgserver=$(grep Endpoint "${CONFIG_DIR}/wireguard/wg0.conf" | awk '{print $3}')
echo "IP: ${wgserver%:*}"
echo "Obtaining default gateway..."
gateway=$(ip -o -4 route show to default | awk '{print $3}')
echo "Gateway: ${gateway}"
echo "Adding route to Wireguard Server via Default Gateway"
ip route add ${wgserver%:*}/32 via ${gateway} dev eth0
echo "Allow DNS resolution locally"
iptables -A INPUT -i eth0 -p udp -m udp --sport 53 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp -m udp --dport 53 -j ACCEPT
echo "Allow docker networks to connect"
docker_cirds=$(ip -o -4 route show proto kernel | awk '{print $1}')
for cidr in $docker_cirds; do
iptables -A INPUT -s "${cidr}" -d "${cidr}" -j ACCEPT
iptables -A OUTPUT -s "${cidr}" -d "${cidr}" -j ACCEPT
done

4
torrents/config/99-cron-start Executable file
View File

@@ -0,0 +1,4 @@
#!/command/with-contenv bash
(crontab -l ; echo "* * * * * run-parts /etc/periodic/1min") | sort - | uniq - | crontab -
crond

3
torrents/config/setPortForward Executable file
View File

@@ -0,0 +1,3 @@
#!/command/with-contenv bash
listen_port=$(python3 /py-natpmp/natpmp/natpmp_client.py -g 10.2.0.1 0 0 | sed -E 's/.*?public port ([0-9]+).*?/\1/')
curl -F "json={\"listen_port\": ${listen_port}}" http://localhost:8080/api/v2/app/setPreferences

4
torrents/config/updateMaMIP Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
[ -f /config/mam.cookies ] || exit 1
curl -c /config/mam.cookies -b /config/mam.cookies https://t.myanonamouse.net/json/dynamicSeedbox.php

View File

@@ -0,0 +1,99 @@
name: torrents${TORRENT_SUFFIX?TORRENT_SUFFIX variable required}
services:
qbittorrent:
# Set hostname to "SERVICE-main" if not suffix is provided. This avoids collisions with other instances using the service name as hostname (default on compose)
hostname: qbittorrent${TORRENT_SUFFIX:--main}
image: hotio/qbittorrent
environment:
PUID: ${NASCOMPOSE_UID?}
PGID: ${NASCOMPOSE_GID?}
VPN_ENABLED: true
VPN_LAN_NETWORK: 192.168.0.0/23
cap_add:
- NET_ADMIN
sysctls:
net.ipv4.conf.all.src_valid_mark: 1
networks:
- reverse-proxy
- torrents
dns:
- 1.1.1.1
- 1.0.0.1
devices:
- /dev/net/tun:/dev/net/tun
volumes:
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/volumes/qbittorrent_config/:/config/
- ${NASCOMPOSE_DATA?}/torrents${TORRENT_SUFFIX?}/:/data/torrents/
# Configuration
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/config/01-natpmp-install:/etc/cont-init.d/01-natpmp-install:ro
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/config/98-gateway-setup:/etc/cont-init.d/98-gateway-setup:ro
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/config/99-cron-start:/etc/cont-init.d/99-cron-start:ro
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/config/setPortForward:/etc/periodic/1min/setPortForward:ro
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/config/updateMaMIP:/etc/periodic/hourly/updateMaMIP:ro
# Secrets
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/secrets/wg0.conf:/config/wireguard/wg0.conf:ro
restart: unless-stopped
labels:
- traefik.enable=true
- traefik.http.routers.qbittorrent${TORRENT_SUFFIX?}.rule=Host(`qbittorrent${TORRENT_SUFFIX?}.${NASCOMPOSE_DOMAIN?}`)
- traefik.http.routers.qbittorrent${TORRENT_SUFFIX?}.middlewares=authelia@file
# API access for nzb360
- traefik.http.routers.qbittorrent${TORRENT_SUFFIX?}-api.rule=Host(`qbittorrent${TORRENT_SUFFIX?}-api.${NASCOMPOSE_DOMAIN?}`)
- traefik.http.routers.qbittorrent${TORRENT_SUFFIX?}-api.middlewares=authelia-basic@file
cross-seed:
# Set hostname to "SERVICE-main" if not suffix is provided. This avoids collisions with other instances using the service name as hostname (default on compose)
hostname: cross-seed${TORRENT_SUFFIX:--main}
image: crossseed/cross-seed
profiles: ["torrents${TORRENT_SUFFIX?}-xseed"]
user: ${NASCOMPOSE_UID?}:${NASCOMPOSE_GID?}
networks:
- torrents
# - indexer
dns:
- 1.1.1.1
- 1.0.0.1
volumes:
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/volumes/cross-seed_config/:/config/
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/volumes/qbittorrent_config/data/BT_backup/:/torrents/:ro
- ${NASCOMPOSE_DATA?}/:/data/
command: daemon
restart: unless-stopped
qbitmanage:
# Set hostname to "SERVICE-main" if not suffix is provided. This avoids collisions with other instances using the service name as hostname (default on compose)
hostname: qbitmanage${TORRENT_SUFFIX:--main}
image: bobokun/qbit_manage
user: ${NASCOMPOSE_UID?}:${NASCOMPOSE_GID?}
environment:
QBT_SCHEDULE: 30
QBT_WIDTH: 170
networks:
- torrents
volumes:
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/volumes/qbitmanage_config/:/config/
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/volumes/qbittorrent_config/data/BT_backup/:/torrents/:ro
- ${NASCOMPOSE_DATA?}/torrents${TORRENT_SUFFIX?}/:/data/torrents/
unpackerr:
# Set hostname to "SERVICE-main" if not suffix is provided. This avoids collisions with other instances using the service name as hostname (default on compose)
hostname: unpackerr{TORRENT_SUFFIX:--main}
image: golift/unpackerr
profiles: ["torrents${TORRENT_SUFFIX?}-unpackerr"]
user: ${NASCOMPOSE_UID?}:${NASCOMPOSE_GID?}
networks:
- torrents
volumes:
- ${NASCOMPOSE_SERVICES?}/torrents${TORRENT_SUFFIX?}/volumes/unpackerr_config/:/etc/unpackerr/
- ${NASCOMPOSE_DATA?}/torrents${TORRENT_SUFFIX?}/completed/:/data/torrents/completed/
restart: unless-stopped
networks:
torrents:
name: torrents${TORRENT_SUFFIX?}
reverse-proxy:
external: true
# indexer:
# external: true