From 5486b3aaf669dcec9947d162316e30848227c973 Mon Sep 17 00:00:00 2001 From: DaanSelen <80752476+DaanSelen@users.noreply.github.com> Date: Tue, 30 Dec 2025 19:19:20 +0100 Subject: [PATCH] fix: Docker autostart issue due to invalid resolvectl (#1053) * Update funding information in FUNDING.yml * Update README.md * refac: refactor the logic with which the Docker container links its files to the volume * fix: 1032 docker autostart issue --------- Co-authored-by: Donald Zou Co-authored-by: DaanSelen --- .dockerignore | 4 +++- .github/FUNDING.yml | 4 ++-- README.md | 2 +- docker/compose.yaml | 1 + docker/entrypoint.sh | 31 +++++++++++++++++++++++-------- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.dockerignore b/.dockerignore index e2c608c2..cee71607 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,6 @@ .github *.md tests/ -docs/ \ No newline at end of file +docs/ +src/db +src/wg-dashboard.ini diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 9576c567..eaaa0b51 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,4 +1,4 @@ # These are supported funding model platforms -github: [donaldzou] -patreon: DonaldDonnyZou +github: [WGDashboard] +open_collective: wgdashboard diff --git a/README.md b/README.md index b9d2bfa3..3e4a4933 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ You can support via

- +

diff --git a/docker/compose.yaml b/docker/compose.yaml index d8f2eac9..445c3102 100644 --- a/docker/compose.yaml +++ b/docker/compose.yaml @@ -13,6 +13,7 @@ services: # By default its all disabled, but uncomment the following lines to apply these. (uncommenting is removing the # character) # Refer to the documentation on https://wgdashboard.dev/ for more info on what everything means. #environment: + #- wg_autostart=wg0 #- tz= # <--- Set container timezone, default: Europe/Amsterdam. #- public_ip= # <--- Set public IP to ensure the correct one is chosen, defaulting to the IP give by ifconfig.me. #- wgd_port= # <--- Set the port WGDashboard will use for its web-server. diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 7a024505..398d040b 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -108,17 +108,31 @@ ensure_installation() { mkdir -p /data/db fi - if [ ! -d "${WGDASH}/src/db" ]; then - ln -s /data/db "${WGDASH}/src/db" - fi - if [ ! -f "${config_file}" ]; then echo "Creating wg-dashboard.ini file" touch "${config_file}" fi - if [ ! -f "${WGDASH}/src/wg-dashboard.ini" ]; then - ln -s "${config_file}" "${WGDASH}/src/wg-dashboard.ini" + if [[ ! -L "${WGDASH}/src/db" ]] && [[ -d "${WGDASH}/src/db" ]]; then + echo "Removing ${WGDASH}/src/db since its not a symbolic link." + rm -rfv "${WGDASH}/src/db" + fi + + if [[ -L "${WGDASH}/src/db" ]]; then + echo "${WGDASH}/src/db is a symbolic link." + else + ln -sv /data/db "${WGDASH}/src/db" + fi + + if [[ ! -L "${WGDASH}/src/wg-dashboard.ini" ]] && [[ -f "${WGDASH}/src/wg-dashboard.ini" ]]; then + echo "Removing ${WGDASH}/src/wg-dashboard.ini since its not a symbolic link." + rm -fv "${WGDASH}/src/wg-dashboard.ini" + fi + + if [[ -L "${WGDASH}/src/wg-dashboard.ini" ]]; then + echo "${WGDASH}/src/wg-dashboard.ini is a symbolic link." + else + ln -sv "${config_file}" "${WGDASH}/src/wg-dashboard.ini" fi # Setup WireGuard if needed @@ -207,6 +221,9 @@ set_envvars() { start_and_monitor() { printf "\n---------------------- STARTING CORE -----------------------\n" + # Regenerate the resolvconf + /usr/sbin/resolvconf -u + # Due to some instances complaining about this, making sure its there every time. mkdir -p /dev/net mknod /dev/net/tun c 10 200 @@ -220,8 +237,6 @@ start_and_monitor() { ${WGDASH}/src/venv/bin/gunicorn --config ${WGDASH}/src/gunicorn.conf.py - /usr/sbin/resolvconf -u - if [ $? -ne 0 ]; then echo "Loading WGDashboard failed... Look above for details." fi