add support for vpn using wireguard

This commit is contained in:
Ammar Hussein 2025-01-16 21:36:14 -08:00
parent 94e777f311
commit be6f480fc9
6 changed files with 49 additions and 1 deletions

View File

@ -6,3 +6,7 @@ DOMAIN=qbit.example.com
#EXTRA_DOMAINS=', `www.qbit.example.com`'
LETS_ENCRYPT_ENV=production
COMPOSE_FILE="compose.yml"
# Be careful, uncommenting the line below runs the container in privileged mode
# COMPOSE_FILE="$COMPOSE_FILE:compose.vpn.yml"

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM linuxserver/qbittorrent:latest
RUN apk update && apk upgrade
RUN apk add \
wireguard-tools \
ip6tables \
vim

View File

@ -22,3 +22,10 @@
* `abra app deploy <app-name>`
For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech).
## VPN
* Save wireguard config file in a file named vpn.conf
* `abra app cp <app-name> vpn.conf app:/etc/wireguard/vpn.conf`
* `abra app cmd qbit.ammaratef45.ddns.net app setup_vpn` (this will also start the vpn)
* `start_vpn`, `stop_vpn`, `vpn_status`, and `container_ip` functions commands can be used to manage the vpn connection.

23
abra.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
setup_vpn() {
wgScript=`which wg-quick`
sed -i '/sysctl -q net.ipv4.conf.all.src_valid_mark=1/d' $wgScript
start_vpn
}
start_vpn() {
wg-quick up vpn
}
stop_vpn() {
wg-quick down vpn
}
vpn_status() {
wg
}
container_ip() {
curl ifconfig.me
}

7
compose.vpn.yml Normal file
View File

@ -0,0 +1,7 @@
---
version: "3.8"
services:
app:
cap_add:
- ALL

View File

@ -3,7 +3,7 @@ version: "3.8"
services:
app:
image: lscr.io/linuxserver/qbittorrent:5.0.2-r0-ls366
image: git.coopcloud.tech/ammaratef45/qbit-vpn:0.1.1
networks:
- proxy
deploy: