mirror of
https://github.com/donaldzou/WGDashboard
synced 2025-02-26 05:58:47 +00:00
Hotfix for stop entrapment and addition of workdir in Dockerfile
This commit is contained in:
parent
227bd088f7
commit
6f7b9815ca
@ -85,5 +85,6 @@ COPY entrypoint.sh /entrypoint.sh
|
|||||||
|
|
||||||
# Exposing the default WireGuard Dashboard port for web access.
|
# Exposing the default WireGuard Dashboard port for web access.
|
||||||
EXPOSE 10086
|
EXPOSE 10086
|
||||||
|
WORKDIR $WGDASH
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
@ -7,7 +7,7 @@ trap 'stop_service' SIGTERM
|
|||||||
|
|
||||||
stop_service() {
|
stop_service() {
|
||||||
echo "[WGDashboard] Stopping WGDashboard..."
|
echo "[WGDashboard] Stopping WGDashboard..."
|
||||||
./wgd.sh stop
|
bash ./wgd.sh stop
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,6 +18,12 @@ ensure_installation() {
|
|||||||
# When using a custom directory to store the files, this part moves over and makes sure the installation continues.
|
# When using a custom directory to store the files, this part moves over and makes sure the installation continues.
|
||||||
echo "Quick-installing..."
|
echo "Quick-installing..."
|
||||||
|
|
||||||
|
chmod +x "${WGDASH}"/src/wgd.sh
|
||||||
|
cd "${WGDASH}"/src || exit
|
||||||
|
|
||||||
|
echo "Removing clear command from wgd.sh for better Docker logging."
|
||||||
|
sed -i '/clear/d' ./wgd.sh
|
||||||
|
|
||||||
if [ ! -d "/data/db" ]; then
|
if [ ! -d "/data/db" ]; then
|
||||||
echo "Creating database dir"
|
echo "Creating database dir"
|
||||||
mkdir /data/db
|
mkdir /data/db
|
||||||
@ -45,9 +51,6 @@ ensure_installation() {
|
|||||||
echo "Moving PIP dependency from ephemerality to runtime environment: bcrypt"
|
echo "Moving PIP dependency from ephemerality to runtime environment: bcrypt"
|
||||||
mv /usr/lib/python3.12/site-packages/bcrypt* "${WGDASH}"/src/venv/lib/python3.12/site-packages
|
mv /usr/lib/python3.12/site-packages/bcrypt* "${WGDASH}"/src/venv/lib/python3.12/site-packages
|
||||||
|
|
||||||
|
|
||||||
chmod +x "${WGDASH}"/src/wgd.sh
|
|
||||||
cd "${WGDASH}"/src || exit
|
|
||||||
./wgd.sh install
|
./wgd.sh install
|
||||||
|
|
||||||
echo "Looks like the installation succeeded. Moving on."
|
echo "Looks like the installation succeeded. Moving on."
|
||||||
@ -129,10 +132,7 @@ start_core() {
|
|||||||
printf "\n---------------------- STARTING CORE -----------------------\n"
|
printf "\n---------------------- STARTING CORE -----------------------\n"
|
||||||
|
|
||||||
echo "Activating Python venv and executing the WireGuard Dashboard service."
|
echo "Activating Python venv and executing the WireGuard Dashboard service."
|
||||||
|
bash ./wgd.sh start
|
||||||
. "${WGDASH}"/src/venv/bin/activate
|
|
||||||
cd "${WGDASH}"/src || return
|
|
||||||
bash wgd.sh start
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_blocking() {
|
ensure_blocking() {
|
||||||
@ -143,17 +143,14 @@ ensure_blocking() {
|
|||||||
local logdir="${WGDASH}/src/log"
|
local logdir="${WGDASH}/src/log"
|
||||||
|
|
||||||
latestErrLog=$(find "$logdir" -name "error_*.log" -type f -print | sort -r | head -n 1)
|
latestErrLog=$(find "$logdir" -name "error_*.log" -type f -print | sort -r | head -n 1)
|
||||||
#latestAccLog=$(find "$logdir" -name "access_*.log" -type f -print | sort -r | head -n 1) # Removed access line due to console spam.
|
|
||||||
|
|
||||||
# Only tail the logs if they are found
|
# Only tail the logs if they are found
|
||||||
if [ -n "$latestErrLog" ] || [ -n "$latestAccLog" ]; then
|
if [ -n "$latestErrLog" ]; then
|
||||||
tail -f "$latestErrLog"
|
tail -f "$latestErrLog" &
|
||||||
|
wait $!
|
||||||
else
|
else
|
||||||
echo "No log files found to tail."
|
echo "No log files found to tail. Something went wrong, exiting..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Blocking command to keep the container running as a last resort.
|
|
||||||
sleep infinity
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute functions for the WireGuard Dashboard services, then set the environment variables
|
# Execute functions for the WireGuard Dashboard services, then set the environment variables
|
||||||
|
Loading…
Reference in New Issue
Block a user