From 2cc6fbd643bcc9180d6edec87495e7fc4d11b131 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Wed, 10 Nov 2021 11:40:46 -0500 Subject: [PATCH 01/10] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 333bd4b..0658051 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@
+

Hi! I'm planning the next major update for this project, please let me know if you have any suggestions or feature requests ;) You can create an issue with the "Feature request" template. Cheers!

+

Please provide your OS name and version if you can run the dashboard on it perfectly in #31, since I only tested on Ubuntu. Thank you!


From ed9b05cdf9d4a7e2c0f08d6bc9a09eacb0ea09e2 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Fri, 19 Nov 2021 14:44:40 -0500 Subject: [PATCH 02/10] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0658051..4be9593 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@

Hi! I'm planning the next major update for this project, please let me know if you have any suggestions or feature requests ;) You can create an issue with the "Feature request" template. Cheers!


-

Please provide your OS name and version if you can run the dashboard on it perfectly in #31, since I only tested on Ubuntu. Thank you!

+

Help Wanted

+

- If anyone know a better way to distubute releases of python application other than GitHub, please let me know in #31!

+

- Please provide your OS name and version if you can run the dashboard on it perfectly in #31, since I only tested on Ubuntu. Thank you!


From 257a2c2d9fcd9f04886912913c3dac8c3d27b16a Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Fri, 19 Nov 2021 14:45:37 -0500 Subject: [PATCH 03/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4be9593..e7f3653 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

Hi! I'm planning the next major update for this project, please let me know if you have any suggestions or feature requests ;) You can create an issue with the "Feature request" template. Cheers!


Help Wanted

-

- If anyone know a better way to distubute releases of python application other than GitHub, please let me know in #31!

+

- If anyone know a better way to distubute releases of python application other than GitHub, please let me know in #103!

- Please provide your OS name and version if you can run the dashboard on it perfectly in #31, since I only tested on Ubuntu. Thank you!


From 62acc1081f45ced0ed2cb86d5ee0910fa2d46360 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Fri, 19 Nov 2021 14:48:46 -0500 Subject: [PATCH 04/10] Update README.md --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e7f3653..35aa6af 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@
-

Hi! I'm planning the next major update for this project, please let me know if you have any suggestions or feature requests ;) You can create an issue with the "Feature request" template. Cheers!

-
-

Help Wanted

-

- If anyone know a better way to distubute releases of python application other than GitHub, please let me know in #103!

-

- Please provide your OS name and version if you can run the dashboard on it perfectly in #31, since I only tested on Ubuntu. Thank you!

-
+> Hi! I'm planning the next major update for this project, please let me know if you have any suggestions or feature requests ;) You can create an issue with the "Feature request" template. Cheers! +### Help Wanted + +> If anyone know a better way to distribute releases of python application other than GitHub, please let me know in #103! + +> Please provide your OS name and version if you can run the dashboard on it perfectly in #31, since I only tested on Ubuntu. Thank you! + +

WGDashboard

From 805f03d231a52dafefb8832c7512bc2263e6c951 Mon Sep 17 00:00:00 2001 From: Markus Neubauer Date: Thu, 25 Nov 2021 16:03:09 +0100 Subject: [PATCH 05/10] Update .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8104ed3..076f2e7 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ src/wg-dashboard.ini src/static/pic.xd *.conf private_key.txt -public_key.txt \ No newline at end of file +public_key.txt +venv/* From 79b41e10568ddb351efe75a17078536e3eff51f2 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Mon, 6 Dec 2021 14:15:22 -0500 Subject: [PATCH 06/10] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 35aa6af..a2577bf 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@

+ wakatime

Monitoring WireGuard is not convinient, need to login into server and type wg show. That's why this platform is being created, to view all configurations and manage them in a easier way.

Note: This project is not affiliate to the official WireGuard Project ;)

From 78ef870d919e99ca892fdd411c14cca18bf48bda Mon Sep 17 00:00:00 2001 From: Markus Neubauer Date: Thu, 25 Nov 2021 15:33:06 +0100 Subject: [PATCH 07/10] Update wg-dashboard.service A more automated approach --- src/wg-dashboard.service | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/wg-dashboard.service b/src/wg-dashboard.service index 9a596df..44b5c43 100644 --- a/src/wg-dashboard.service +++ b/src/wg-dashboard.service @@ -1,11 +1,14 @@ [Unit] -After=netword.service +After=syslog.target network-online.target +ConditionPathIsDirectory=/etc/wireguard [Service] -WorkingDirectory= -ExecStart=/usr/bin/python3 dashboard.py +Environment="VIRTUAL_ENV={{VIRTUAL_ENV}}" +WorkingDirectory={{APP_ROOT}} +ExecStart={{VIRTUAL_ENV}}/bin/python3 {{APP_ROOT}}dashboard.py +PrivateTmp=yes Restart=always [Install] -WantedBy=default.target \ No newline at end of file +WantedBy=multi-user.target From 591b60c336e0ee1d2e4b71403a4506c032385cbc Mon Sep 17 00:00:00 2001 From: Markus Neubauer Date: Thu, 25 Nov 2021 15:55:56 +0100 Subject: [PATCH 08/10] Update wgd.sh a more automated approach to systemctl --- src/wgd.sh | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/wgd.sh b/src/wgd.sh index 3676947..38814a1 100755 --- a/src/wgd.sh +++ b/src/wgd.sh @@ -20,6 +20,17 @@ help () { printf "=================================================================================\n" } +_check_and_set_venv(){ + # deb/ubuntu users: might need a 'apt install python3.8-venv' + # set up the local environment + APP_ROOT=`pwd` + VIRTUAL_ENV="${APP_ROOT%/*}/venv" + if [ ! -d $VIRTUAL_ENV ]; then + python3 -m venv $VIRTUAL_ENV + fi + . ${VIRTUAL_ENV}/activate +} + install_wgd(){ # Check Python3 version version_pass=$(python3 -c 'import sys; print("1") if (sys.version_info.major == 3 and sys.version_info.minor >= 7) else print("0");') @@ -33,9 +44,24 @@ install_wgd(){ then mkdir "log" fi printf "| Installing latest Python dependencies |\n" + + # set up the local environment + _check_and_set_venv + python3 -m pip install -r requirements.txt > /dev/null 2>&1 printf "| WGDashboard installed successfully! |\n" - printf "| Starting Dashboard |\n" + + printf "| Preparing the systemctl unit file |\n" + sed -i "s#{{APP_ROOT}}#${APP_ROOT}#" wg-dashboard.service + sed -i "s#{{VIRTUAL_ENV}}#${VIRTUAL_ENV}#" wg-dashboard.service + cat wg-dashboard.service | sudo SYSTEMD_EDITOR=tee systemctl edit --force --full wg-dashboard.service + systemctl daemon-reload + printf "| Consider 'systemctl enable wg-dashboard' |\n" + printf " and 'systemctl start wg-dashboard'\n" + printf " use '${0} stop' before starting with systemctl\n" + echo + + printf "| Now starting Dashboard in background |\n" start_wgd } @@ -50,6 +76,7 @@ check_wgd_status(){ } start_wgd () { + _check_and_set_venv printf "%s\n" "$dashes" printf "| Starting WGDashboard in the background. |\n" if [ ! -d "log" ] @@ -67,6 +94,7 @@ stop_wgd() { start_wgd_debug() { printf "%s\n" "$dashes" + _check_and_set_venv printf "| Starting WGDashboard in the foreground. |\n" python3 "$app_name" printf "%s\n" "$dashes" @@ -84,6 +112,7 @@ update_wgd() { git stash > /dev/null 2>&1 git pull https://github.com/donaldzou/wireguard-dashboard.git $new_ver --force > /dev/null 2>&1 printf "| Installing latest Python dependencies |\n" + _check_and_set_venv python3 -m pip install -r requirements.txt > /dev/null 2>&1 printf "| Update Successfully! |\n" start_wgd @@ -142,4 +171,3 @@ if [ "$#" != 1 ]; help fi fi - From fbce01d8463d204cd17e5aea18850e0e58d999ac Mon Sep 17 00:00:00 2001 From: Donald Cheng Hong Zou Date: Sun, 19 Dec 2021 18:15:51 -0500 Subject: [PATCH 09/10] Update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 076f2e7..0cfdd62 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ src/static/pic.xd *.conf private_key.txt public_key.txt -venv/* +venv/** \ No newline at end of file From 280802cf748aa0cb3b54724af81da0748f348ff8 Mon Sep 17 00:00:00 2001 From: Donald Cheng Hong Zou Date: Sun, 19 Dec 2021 18:16:45 -0500 Subject: [PATCH 10/10] Update .gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 076f2e7..6ec7b5e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,6 @@ src/static/pic.xd *.conf private_key.txt public_key.txt -venv/* +venv/** +log/** +*~ \ No newline at end of file