rocky1410 commited on
Commit
f19f250
·
verified ·
1 Parent(s): 0db6200

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +6 -14
start.sh CHANGED
@@ -2,45 +2,37 @@
2
  set -euo pipefail
3
 
4
  export DISPLAY=${DISPLAY:-:0}
5
- # Reasonable default resolution; you can bump this
6
  SCREEN_W=${SCREEN_W:-1366}
7
  SCREEN_H=${SCREEN_H:-768}
8
  SCREEN_D=${SCREEN_D:-24}
9
-
10
- # HF sets $PORT automatically; websockify must listen on it
11
  PORT=${PORT:-7860}
12
 
13
  # Start a virtual X server
14
  Xvfb "$DISPLAY" -screen 0 "${SCREEN_W}x${SCREEN_H}x${SCREEN_D}" -ac +extension GLX +render -noreset &
15
- sleep 1
16
 
17
- # Start a user dbus for XFCE
18
  eval "$(dbus-launch --sh-syntax)"
19
 
20
- # Launch XFCE session (in background)
21
- # 'xfce4-session' is preferred; fallback to 'startxfce4' if needed
22
  if command -v xfce4-session >/dev/null 2>&1; then
23
  xfce4-session >/tmp/xfce.log 2>&1 &
24
  else
25
  startxfce4 >/tmp/xfce.log 2>&1 &
26
  fi
27
 
28
- # Expose the X display over VNC (no password; only reachable via your Space URL)
29
  x11vnc -display "$DISPLAY" -nopw -forever -shared -rfbport 5900 -rfbwait 120000 >/tmp/x11vnc.log 2>&1 &
30
 
31
- # Serve noVNC on $PORT and proxy to VNC :5900
32
- # noVNC static assets usually live here on Ubuntu
33
  NOVNC_WEB=/usr/share/novnc
34
  websockify --web="${NOVNC_WEB}" "${PORT}" localhost:5900 >/tmp/websockify.log 2>&1 &
35
 
36
- # Keep the container alive while tailing logs (and so HF health-check sees $PORT open)
37
  echo "------------------------------------------------------"
38
- echo "noVNC is live. Open your Space URL to access the desktop."
39
  echo "Zed will auto-launch inside the XFCE session."
40
  echo "Logs: /tmp/xfce.log /tmp/x11vnc.log /tmp/websockify.log"
41
  echo "------------------------------------------------------"
42
 
43
- # Wait forever (or until one of the background jobs exits)
44
  wait -n || true
45
- # Optional: tail logs if background jobs exit
46
  tail -f /tmp/xfce.log /tmp/x11vnc.log /tmp/websockify.log || true
 
2
  set -euo pipefail
3
 
4
  export DISPLAY=${DISPLAY:-:0}
 
5
  SCREEN_W=${SCREEN_W:-1366}
6
  SCREEN_H=${SCREEN_H:-768}
7
  SCREEN_D=${SCREEN_D:-24}
 
 
8
  PORT=${PORT:-7860}
9
 
10
  # Start a virtual X server
11
  Xvfb "$DISPLAY" -screen 0 "${SCREEN_W}x${SCREEN_H}x${SCREEN_D}" -ac +extension GLX +render -noreset &
12
+ sleep 2
13
 
14
+ # Start a dbus session
15
  eval "$(dbus-launch --sh-syntax)"
16
 
17
+ # Start XFCE desktop session
 
18
  if command -v xfce4-session >/dev/null 2>&1; then
19
  xfce4-session >/tmp/xfce.log 2>&1 &
20
  else
21
  startxfce4 >/tmp/xfce.log 2>&1 &
22
  fi
23
 
24
+ # Expose via VNC
25
  x11vnc -display "$DISPLAY" -nopw -forever -shared -rfbport 5900 -rfbwait 120000 >/tmp/x11vnc.log 2>&1 &
26
 
27
+ # Serve noVNC on $PORT
 
28
  NOVNC_WEB=/usr/share/novnc
29
  websockify --web="${NOVNC_WEB}" "${PORT}" localhost:5900 >/tmp/websockify.log 2>&1 &
30
 
 
31
  echo "------------------------------------------------------"
32
+ echo "noVNC is live on port ${PORT} (Hugging Face URL)."
33
  echo "Zed will auto-launch inside the XFCE session."
34
  echo "Logs: /tmp/xfce.log /tmp/x11vnc.log /tmp/websockify.log"
35
  echo "------------------------------------------------------"
36
 
 
37
  wait -n || true
 
38
  tail -f /tmp/xfce.log /tmp/x11vnc.log /tmp/websockify.log || true