Sync deployed SparkFlow reliability updates

This commit is contained in:
Rixuan Shao
2026-06-20 01:59:01 +08:00
parent 285db46cd9
commit b5e61a14ea
13 changed files with 3891 additions and 1042 deletions

View File

@@ -16,6 +16,22 @@ pkill -f "websockify --web=/usr/share/novnc ${LOGIN_DESKTOP_WEB_PORT}" >/dev/nul
rm -f "/tmp/.X99-lock"
rm -f "/tmp/.X11-unix/X99"
run_forever() {
local name="$1"
shift
local log_file="/app/logs/login_desktop/${name}.log"
: > "${log_file}"
while true; do
printf '[%s] starting %s\n' "$(date -Is)" "${name}" >> "${log_file}"
set +e
"$@" >> "${log_file}" 2>&1
local status=$?
set -e
printf '[%s] %s exited with status %s; restarting in 2s\n' "$(date -Is)" "${name}" "${status}" >> "${log_file}"
sleep 2
done
}
Xvfb "${DISPLAY}" -screen 0 1600x1000x24 -ac +extension RANDR > /app/logs/login_desktop/xvfb.log 2>&1 &
for _ in $(seq 1 30); do
if [ -S /tmp/.X11-unix/X99 ]; then
@@ -25,7 +41,7 @@ for _ in $(seq 1 30); do
done
fluxbox > /app/logs/login_desktop/fluxbox.log 2>&1 &
x11vnc -display "${DISPLAY}" -forever -shared -rfbport "${LOGIN_DESKTOP_VNC_PORT}" -nopw > /app/logs/login_desktop/x11vnc.log 2>&1 &
websockify --web=/usr/share/novnc "${LOGIN_DESKTOP_WEB_PORT}" "localhost:${LOGIN_DESKTOP_VNC_PORT}" > /app/logs/login_desktop/novnc.log 2>&1 &
run_forever x11vnc x11vnc -display "${DISPLAY}" -forever -shared -rfbport "${LOGIN_DESKTOP_VNC_PORT}" -localhost -nopw &
run_forever novnc websockify --web=/usr/share/novnc "${LOGIN_DESKTOP_WEB_PORT}" "127.0.0.1:${LOGIN_DESKTOP_VNC_PORT}" &
exec python /app/login_desktop_server.py