mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 07:10:09 +01:00
Testing more changes for better handling of variables.
This commit is contained in:
parent
c0ef41a9bb
commit
a76e9ed98b
@ -1,14 +1,14 @@
|
|||||||
services:
|
services:
|
||||||
wireguard-dashboard:
|
wireguard-dashboard:
|
||||||
image: dselen:alpine
|
image: dselen/wgdashboard:alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
container_name: wgdashboard
|
container_name: wgdashboard
|
||||||
environment:
|
environment:
|
||||||
#- tz= # <--- Set container timezone, default: Europe/Amsterdam.
|
#- tz= # <--- Set container timezone, default: Europe/Amsterdam.
|
||||||
#- global_dns= # <--- Set global DNS address, default: 1.1.1.1.
|
- global_dns=9.9.9.9 # <--- Set global DNS address, default: 1.1.1.1.
|
||||||
- enable=wg0 # <--- Set the interfaces that will be enabled on startup, default: none. The option "off" is also allowed.
|
- enable=wg0 # <--- Set the interfaces that will be enabled on startup, default: none. The option "off" is also allowed.
|
||||||
- isolate=wg0 # <--- When set to true, it disallows peers to talk to eachother, setting to false, allows it, default: true.
|
- isolate=wg0 # <--- When set to true, it disallows peers to talk to eachother, setting to false, allows it, default: true.
|
||||||
#- public_ip= # <--- Set public IP to ensure the correct one is chosen, defaulting to the IP give by ifconfig.me.
|
- public_ip=212.124.66.17 # <--- Set public IP to ensure the correct one is chosen, defaulting to the IP give by ifconfig.me.
|
||||||
ports:
|
ports:
|
||||||
- 10086:10086/tcp
|
- 10086:10086/tcp
|
||||||
- 51820:51820/udp
|
- 51820:51820/udp
|
||||||
|
@ -22,10 +22,6 @@ ensure_installation() {
|
|||||||
cd "${WGDASH}"/src || exit
|
cd "${WGDASH}"/src || exit
|
||||||
./wgd.sh install
|
./wgd.sh install
|
||||||
|
|
||||||
echo "Generating some files..."
|
|
||||||
./wgd.sh start
|
|
||||||
./wgd.sh stop
|
|
||||||
|
|
||||||
echo "Looks like the installation succesfully moved over."
|
echo "Looks like the installation succesfully moved over."
|
||||||
else
|
else
|
||||||
echo "Looks like everything is present. Or the directory is not empty."
|
echo "Looks like everything is present. Or the directory is not empty."
|
||||||
@ -109,10 +105,6 @@ set_envvars() {
|
|||||||
|
|
||||||
sed -i "s/^remote_endpoint = .*/remote_endpoint = ${public_ip}/" /opt/wireguarddashboard/src/wg-dashboard.ini
|
sed -i "s/^remote_endpoint = .*/remote_endpoint = ${public_ip}/" /opt/wireguarddashboard/src/wg-dashboard.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#echo "Restarting service for good measure"
|
|
||||||
#cd "${WGDASH}"/src || exit
|
|
||||||
#./wgd.sh restart
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# === CORE SERVICES ===
|
# === CORE SERVICES ===
|
||||||
@ -121,8 +113,8 @@ start_core() {
|
|||||||
|
|
||||||
echo "Activating Python venv and executing the WireGuard Dashboard service."
|
echo "Activating Python venv and executing the WireGuard Dashboard service."
|
||||||
. "${WGDASH}"/src/venv/bin/activate
|
. "${WGDASH}"/src/venv/bin/activate
|
||||||
cd "${WGDASH}"/src || return # If changing the directory fails (permission or presence error), then bash will exist this function, causing the WireGuard Dashboard to not be succesfully launched.
|
cd "${WGDASH}"/src || return
|
||||||
bash wgd.sh start
|
bash wgd.sh start &>> /dev/null
|
||||||
|
|
||||||
# Isolated peers feature, first converting the existing configuration files and the given names to arrays.
|
# Isolated peers feature, first converting the existing configuration files and the given names to arrays.
|
||||||
local configurations=(/etc/wireguard/*)
|
local configurations=(/etc/wireguard/*)
|
||||||
@ -205,6 +197,10 @@ start_core() {
|
|||||||
ensure_blocking() {
|
ensure_blocking() {
|
||||||
printf "\n-------------- ENSURING CONTAINER CONTINUATION -------------\n"
|
printf "\n-------------- ENSURING CONTAINER CONTINUATION -------------\n"
|
||||||
|
|
||||||
|
. "${WGDASH}"/src/venv/bin/activate
|
||||||
|
cd "${WGDASH}"/src || return
|
||||||
|
bash wgd.sh restart
|
||||||
|
|
||||||
sleep 1s
|
sleep 1s
|
||||||
echo "Ensuring container continuation."
|
echo "Ensuring container continuation."
|
||||||
|
|
||||||
@ -223,6 +219,6 @@ ensure_blocking() {
|
|||||||
# Execute functions for the WireGuard Dashboard services, then set the environment variables
|
# Execute functions for the WireGuard Dashboard services, then set the environment variables
|
||||||
ensure_installation
|
ensure_installation
|
||||||
clean_up
|
clean_up
|
||||||
set_envvars
|
|
||||||
start_core
|
start_core
|
||||||
|
set_envvars
|
||||||
ensure_blocking
|
ensure_blocking
|
Loading…
Reference in New Issue
Block a user