Add Torrent auto-config
This commit is contained in:
6
services/torrents/config/97-gateway-setup
Normal file
6
services/torrents/config/97-gateway-setup
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
|
||||||
|
wgserver=$(grep Endpoint "${CONFIG_DIR}/wireguard/wg0.conf" | awk '{print $3}')
|
||||||
|
gateway=$(ip -o -4 route show to default | awk '{print $3}')
|
||||||
|
|
||||||
|
ip -4 route add ${wgserver%:*} via ${gateway} dev eth0
|
||||||
4
services/torrents/config/98-natpmp-install
Normal file
4
services/torrents/config/98-natpmp-install
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
|
||||||
|
apk add -u git
|
||||||
|
git clone https://github.com/yimingliu/py-natpmp.git
|
||||||
4
services/torrents/config/99-cron-start
Normal file
4
services/torrents/config/99-cron-start
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
|
||||||
|
chmod +x /bin/set_port.sh
|
||||||
|
(crontab -l ; echo "* * * * * /bin/set_port.sh") | sort - | uniq - | crontab -
|
||||||
3
services/torrents/config/set_port.sh
Normal file
3
services/torrents/config/set_port.sh
Normal 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
|
||||||
@@ -1,37 +1,6 @@
|
|||||||
name: Torrents
|
name: Torrents
|
||||||
|
|
||||||
services:
|
services:
|
||||||
transmission:
|
|
||||||
hostname: transmission
|
|
||||||
image: haugene/transmission-openvpn
|
|
||||||
environment:
|
|
||||||
PUID: ${NASCOMPOSE_UID?}
|
|
||||||
PGID: ${NASCOMPOSE_GID?}
|
|
||||||
OPENVPN_PROVIDER: ${NASCOMPOSE_TRANSMISSION_VPNPROVIDER?}
|
|
||||||
OPENVPN_CONFIG: ${NASCOMPOSE_TRANSMISSION_VPNREGION?}
|
|
||||||
OPENVPN_OPTS: --inactive 3600 --ping 10 --ping-exit 60
|
|
||||||
LOCAL_NETWORK: 192.168.0.0/16
|
|
||||||
cap_add:
|
|
||||||
- NET_ADMIN
|
|
||||||
networks:
|
|
||||||
- reverse-proxy
|
|
||||||
- torrents
|
|
||||||
dns:
|
|
||||||
# Work around DNS blocks in various regions
|
|
||||||
- 1.1.1.1
|
|
||||||
- 1.0.0.1
|
|
||||||
volumes:
|
|
||||||
- ${NASCOMPOSE_SERVICES?}/torrents/volumes/transmission_config/:/config/
|
|
||||||
- ${NASCOMPOSE_DATA?}/torrents/:/data/
|
|
||||||
secrets:
|
|
||||||
- source: transmission_vpn_creds
|
|
||||||
target: openvpn_creds
|
|
||||||
restart: unless-stopped
|
|
||||||
labels:
|
|
||||||
traefik.enable: true
|
|
||||||
traefik.http.services.transmission.loadbalancer.server.port: 9091
|
|
||||||
traefik.http.routers.transmission.middlewares: authelia@file
|
|
||||||
|
|
||||||
qbittorrent:
|
qbittorrent:
|
||||||
hostname: qbittorrent
|
hostname: qbittorrent
|
||||||
image: hotio/qbittorrent
|
image: hotio/qbittorrent
|
||||||
@@ -45,30 +14,56 @@ services:
|
|||||||
net.ipv4.conf.all.src_valid_mark: 1
|
net.ipv4.conf.all.src_valid_mark: 1
|
||||||
networks:
|
networks:
|
||||||
- reverse-proxy
|
- reverse-proxy
|
||||||
|
- torrents
|
||||||
devices:
|
devices:
|
||||||
- /dev/net/tun:/dev/net/tun
|
- /dev/net/tun:/dev/net/tun
|
||||||
volumes:
|
volumes:
|
||||||
- ${NASCOMPOSE_SERVICES?}/torrents/volumes/qbittorrent_config/:/config/
|
- ${NASCOMPOSE_SERVICES?}/torrents/volumes/qbittorrent_config/:/config/
|
||||||
- ${NASCOMPOSE_DATA?}/torrents/:/data/
|
- ${NASCOMPOSE_DATA?}/torrents/:/data/
|
||||||
|
- ${NASCOMPOSE_SERVICES?}/torrents/secrets/wg0.conf:/config/wireguard/wg0.conf:ro
|
||||||
|
- ${NASCOMPOSE_SERVICES?}/torrents/config/set_port.sh:/bin/set_port.sh:ro
|
||||||
|
- ${NASCOMPOSE_SERVICES?}/torrents/config/97-gateway-setup:/etc/cont-init.d/97-gateway-setup:ro
|
||||||
|
- ${NASCOMPOSE_SERVICES?}/torrents/config/98-natpmp-install:/etc/cont-init.d/98-natpmp-install:ro
|
||||||
|
- ${NASCOMPOSE_SERVICES?}/torrents/config/99-cron-start:/etc/cont-init.d/99-cron-start:ro
|
||||||
configs:
|
configs:
|
||||||
- source: qbittorrent_vpn_settings
|
- source: qbittorrent_vpn_settings
|
||||||
target: /config/wireguard/wg0.conf
|
target: /config/wireguard/wg0.conf
|
||||||
|
- source: qbittorrent_
|
||||||
|
target: /.conf
|
||||||
|
- source: qbittorrent_
|
||||||
|
target: /.conf
|
||||||
|
- source: qbittorrent_
|
||||||
|
target: /.conf
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
labels:
|
labels:
|
||||||
traefik.enable: true
|
traefik.enable: true
|
||||||
traefik.http.routers.qbittorrent.middlewares: authelia@file
|
traefik.http.routers.qbittorrent.middlewares: authelia@file
|
||||||
|
|
||||||
|
cross-seed:
|
||||||
|
hostname: cross-seed
|
||||||
|
image: crossseed/cross-seed
|
||||||
|
user: ${NASCOMPOSE_UID?}:${NASCOMPOSE_GID?}
|
||||||
|
networks:
|
||||||
|
- torrents
|
||||||
|
- indexer
|
||||||
|
volumes:
|
||||||
|
- ${NASCOMPOSE_SERVICES?}/torrents/volumes/cross-seed_config/:/config
|
||||||
|
- ${NASCOMPOSE_SERVICES?}/torrents/volumes/qbittorrent_config/data/BT_backup/:/torrents:ro
|
||||||
|
command: daemon
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
qbit-manage:
|
||||||
|
hostname: qbit-manage
|
||||||
|
image: bobokun/qbit_manage
|
||||||
|
networks:
|
||||||
|
- torrents
|
||||||
|
volumes:
|
||||||
|
- ${NASCOMPOSE_SERVICES?}/torrents/volumes/qbit-manage_config/:/config
|
||||||
|
- ${NASCOMPOSE_DATA?}/torrents/:/data/
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
torrents:
|
torrents:
|
||||||
name: torrents
|
name: torrents
|
||||||
|
|
||||||
reverse-proxy:
|
reverse-proxy:
|
||||||
external: true
|
external: true
|
||||||
|
|
||||||
configs:
|
|
||||||
qbittorrent_vpn_settings:
|
|
||||||
file: ${NASCOMPOSE_SERVICES?}/torrents/secrets/wg0.conf
|
|
||||||
|
|
||||||
secrets:
|
|
||||||
transmission_vpn_creds:
|
|
||||||
file: ${NASCOMPOSE_SERVICES?}/torrents/secrets/vpn_creds
|
|
||||||
|
|||||||
Reference in New Issue
Block a user