From 0c1502f801be95f2f5684c3075bd476f3e2c1f40 Mon Sep 17 00:00:00 2001 From: Noxcis Date: Sun, 25 Aug 2024 03:01:21 -0500 Subject: [PATCH] Streamiline + Added Docker Install arg to wgd.sh --- Dockerfile | 4 - compose.yaml | 4 +- docker/alpine/entrypoint.sh | 38 ---- docker/alpine/wgd.sh | 441 ------------------------------------ src/entrypoint.sh | 13 +- src/wgd.sh | 55 ++++- 6 files changed, 57 insertions(+), 498 deletions(-) delete mode 100644 docker/alpine/entrypoint.sh delete mode 100644 docker/alpine/wgd.sh diff --git a/Dockerfile b/Dockerfile index 04f0c6c..ad73bb2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,10 +20,6 @@ WORKDIR /opt/wireguarddashboard/src COPY ./src /opt/wireguarddashboard/src/ COPY --from=builder /opt/wireguarddashboard/src/venv /opt/wireguarddashboard/src/venv COPY --from=builder /opt/wireguarddashboard/src/log /opt/wireguarddashboard/src/log/ -COPY ./docker/alpine/entrypoint.sh /opt/wireguarddashboard/src/ -COPY ./docker/alpine/wgd.sh /opt/wireguarddashboard/src/ - - RUN apk update && \ apk add --no-cache wireguard-tools sudo && \ diff --git a/compose.yaml b/compose.yaml index 7e55875..a75ef45 100644 --- a/compose.yaml +++ b/compose.yaml @@ -12,7 +12,7 @@ services: - wg_port=51820 volumes: - wgd_configs:/etc/wireguard - #- wgd_app:/opt/wireguarddashboard/src + - wgd_app:/opt/wireguarddashboard/src ports: - 10086:10086/tcp - 51820:51820/udp @@ -23,4 +23,4 @@ services: volumes: wgd_configs: - #wgd_app: \ No newline at end of file + wgd_app: \ No newline at end of file diff --git a/docker/alpine/entrypoint.sh b/docker/alpine/entrypoint.sh deleted file mode 100644 index cac6fa2..0000000 --- a/docker/alpine/entrypoint.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -echo "Starting the WireGuard Dashboard Docker container." - -clean_up() { - # Cleaning out previous data such as the .pid file and starting the WireGuard Dashboard. Making sure to use the python venv. - echo "Looking for remains of previous instances..." - if [ -f "/opt/wireguarddashboard/app/src/gunicorn.pid" ]; then - echo "Found old .pid file, removing." - rm /opt/wireguarddashboard/app/src/gunicorn.pid - else - echo "No remains found, continuing." - fi -} -ensure_blocking() { - sleep 1s - echo "Ensuring container continuation." - - # This function checks if the latest error log is created and tails it for docker logs uses. - if find "/opt/wireguarddashboard/src/log" -mindepth 1 -maxdepth 1 -type f | read -r; then - latestErrLog=$(find /opt/wireguarddashboard/src/log -name "error_*.log" | head -n 1) - latestAccLog=$(find /opt/wireguarddashboard/src/log -name "access_*.log" | head -n 1) - tail -f "${latestErrLog}" "${latestAccLog}" - fi - - # Blocking command in case of erroring. So the container does not quit. - sleep infinity -} - -{ date; clean_up; printf "\n\n"; } >> ./log/install.txt - - -chmod u+x /opt/wireguarddashboard/src/wgd.sh - - - -/opt/wireguarddashboard/src/wgd.sh install -/opt/wireguarddashboard/src/wgd.sh start -ensure_blocking diff --git a/docker/alpine/wgd.sh b/docker/alpine/wgd.sh deleted file mode 100644 index 7f5e681..0000000 --- a/docker/alpine/wgd.sh +++ /dev/null @@ -1,441 +0,0 @@ -#!/bin/bash - -# wgd.sh - Copyright(C) 2024 Donald Zou [https://github.com/donaldzou] -# Under Apache-2.0 License -#trap "kill $TOP_PID" -export TOP_PID=$$ - -app_name="dashboard.py" -app_official_name="WGDashboard" -venv_python="./venv/bin/python3" -venv_gunicorn="./venv/bin/gunicorn" -pythonExecutable="python3" - -heavy_checkmark=$(printf "\xE2\x9C\x94") -heavy_crossmark=$(printf "\xE2\x9C\x97") - -PID_FILE=./gunicorn.pid -environment=$(if [[ $ENVIRONMENT ]]; then echo $ENVIRONMENT; else echo 'develop'; fi) -if [[ $CONFIGURATION_PATH ]]; then - cb_work_dir=$CONFIGURATION_PATH/letsencrypt/work-dir - cb_config_dir=$CONFIGURATION_PATH/letsencrypt/config-dir -else - cb_work_dir=/etc/letsencrypt - cb_config_dir=/var/lib/letsencrypt -fi - -dashes='------------------------------------------------------------' -equals='============================================================' -helpMsg="[WGDashboard] Please check ./log/install.txt for more details. For further assistance, please open a ticket on https://github.com/donaldzou/WGDashboard/issues/new/choose, I'm more than happy to help :)" -help () { - printf "=================================================================================\n" - printf "+ by Donald Zou - https://github.com/donaldzou +\n" - printf "=================================================================================\n" - printf "| Usage: ./wgd.sh