Compare commits

...

6 Commits

Author SHA1 Message Date
Daan Selen
306e17eb4d refac: some exit logic
Some checks are pending
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker Build and Push / docker_build (push) Waiting to run
Docker Build and Push / docker_scan (push) Blocked by required conditions
2025-12-14 20:56:18 +01:00
DaanSelen
d75c7ad418 feat: add better docker stopping response (#1025) 2025-12-14 17:32:46 +01:00
Donald Zou
82e10659b6 Update Wakatime badge link in README.md
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Docker Build and Push / docker_build (push) Has been cancelled
Docker Build and Push / docker_scan (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
2025-12-14 00:28:24 +08:00
Donald Zou
b6f25ac817 Include docker directory in workflow paths 2025-12-14 00:25:37 +08:00
Donald Zou
48481ab992 Implement path filter for Docker workflow triggers
Added a path filter to restrict Docker workflow triggers to changes in the 'src' directory.
2025-12-14 00:24:21 +08:00
Donald Zou
d56a3cb5d6 Merge pull request #1031 from WGDashboard/v4.3.2-dev
v4.3.1
2025-12-13 23:26:41 +08:00
3 changed files with 38 additions and 11 deletions

View File

@@ -7,6 +7,9 @@ on:
- 'main' - 'main'
tags: tags:
- '*' - '*'
paths:
- 'src/**'
- 'docker/**'
release: release:
types: [ published ] types: [ published ]

View File

@@ -20,7 +20,7 @@
<p align="center"> <p align="center">
<a href="https://github.com/WGDashboard/WGDashboard/releases/latest"><img src="https://img.shields.io/github/v/release/donaldzou/wireguard-dashboard?style=for-the-badge"></a> <a href="https://github.com/WGDashboard/WGDashboard/releases/latest"><img src="https://img.shields.io/github/v/release/donaldzou/wireguard-dashboard?style=for-the-badge"></a>
<a href="https://wakatime.com/badge/github/donaldzou/WGDashboard"><img src="https://wakatime.com/badge/github/donaldzou/WGDashboard.svg?style=for-the-badge" alt="wakatime"></a> <a href="https://wakatime.com/badge/github/donaldzou/WGDashboard"><img src="https://wakatime.com/badge/user/45f53c7c-9da9-4cb0-85d6-17bd38cc748b/project/5334ae20-e9a6-4c55-9fea-52d4eb9dfba6.svg?style=for-the-badge" alt="wakatime"></a>
<a href="https://hitscounter.dev"><img src="https://hitscounter.dev/api/hit?url=https%3A%2F%2Fgithub.com%2Fdonaldzou%2FWGDashboard&label=Visitor&icon=github&color=%230a58ca&style=for-the-badge"></a> <a href="https://hitscounter.dev"><img src="https://hitscounter.dev/api/hit?url=https%3A%2F%2Fgithub.com%2Fdonaldzou%2FWGDashboard&label=Visitor&icon=github&color=%230a58ca&style=for-the-badge"></a>
<img src="https://img.shields.io/docker/pulls/donaldzou/wgdashboard?logo=docker&label=Docker%20Image%20Pulls&labelColor=ffffff&style=for-the-badge"> <img src="https://img.shields.io/docker/pulls/donaldzou/wgdashboard?logo=docker&label=Docker%20Image%20Pulls&labelColor=ffffff&style=for-the-badge">
<img src="https://github.com/WGDashboard/WGDashboard/actions/workflows/docker.yml/badge.svg?style=for-the-badge"> <img src="https://github.com/WGDashboard/WGDashboard/actions/workflows/docker.yml/badge.svg?style=for-the-badge">

View File

@@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
config_file="/data/wg-dashboard.ini" config_file="/data/wg-dashboard.ini"
runtime_pid=""
trap 'stop_service' SIGTERM trap 'stop_service' SIGTERM
@@ -52,7 +53,31 @@ set_ini() {
stop_service() { stop_service() {
echo "[WGDashboard] Stopping WGDashboard..." echo "[WGDashboard] Stopping WGDashboard..."
/bin/bash ./wgd.sh stop
local max_rounds="10"
local round="0"
local runtime_pid=""
while true; do
round=$((round + 1))
if [[ -f ${WGDASH}/src/gunicorn.pid ]]; then
runtime_pid=$(cat ${WGDASH}/src/gunicorn.pid)
echo "Running as PID: ${runtime_pid}"
return 0
fi
if [[ $round -eq $max_rounds ]]; then
echo "Reached breaking point!"
return 1
fi
sleep 0.5s
done
kill $runtime_pid
exit 0 exit 0
} }
@@ -192,9 +217,10 @@ start_and_monitor() {
[[ ! -d ${WGDASH}/src/log ]] && mkdir ${WGDASH}/src/log [[ ! -d ${WGDASH}/src/log ]] && mkdir ${WGDASH}/src/log
[[ ! -d ${WGDASH}/src/download ]] && mkdir ${WGDASH}/src/download [[ ! -d ${WGDASH}/src/download ]] && mkdir ${WGDASH}/src/download
${WGDASH}/src/venv/bin/gunicorn --config ${WGDASH}/src/gunicorn.conf.py ${WGDASH}/src/venv/bin/gunicorn --config ${WGDASH}/src/gunicorn.conf.py
resolvconf -u /usr/sbin/resolvconf -u
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Loading WGDashboard failed... Look above for details." echo "Loading WGDashboard failed... Look above for details."
@@ -203,13 +229,14 @@ start_and_monitor() {
# Wait a second before continuing, to give the python program some time to get ready. # Wait a second before continuing, to give the python program some time to get ready.
echo -e "\nEnsuring container continuation." echo -e "\nEnsuring container continuation."
max_rounds="10" local max_rounds="10"
round="0" local round="0"
# Hang in there for 10s for Gunicorn to get ready # Hang in there for 10s for Gunicorn to get ready
while true; do while true; do
round=$((round + 1)) round=$((round + 1))
latest_error=$(ls -t ${WGDASH}/src/log/error_*.log 2> /dev/null | head -n 1)
local latest_error=$(ls -t ${WGDASH}/src/log/error_*.log 2> /dev/null | head -n 1)
if [[ $round -eq $max_rounds ]]; then if [[ $round -eq $max_rounds ]]; then
echo "Reached breaking point!" echo "Reached breaking point!"
@@ -235,13 +262,10 @@ start_and_monitor() {
else else
tail -f "$latest_error" & tail -f "$latest_error" &
wait $! tail_pid=$!
wait $tail_pid
fi fi
echo "The blocking command has been broken! Script will exit in 3 minutes... Investigate!"
sleep 180s
exit 1
} }
# Main execution flow # Main execution flow