Skip to content

Commit

Permalink
Adding SE_START_VNC to config VNC (#1804)
Browse files Browse the repository at this point in the history
[deploy]
  • Loading branch information
diemol authored Mar 6, 2023
1 parent 25cc3e5 commit 59cf4f7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 39 deletions.
3 changes: 1 addition & 2 deletions NodeBase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ ENV SE_SCREEN_HEIGHT 1020
ENV SE_SCREEN_DEPTH 24
ENV SE_SCREEN_DPI 96
ENV SE_START_XVFB true
# Temporal fix for https://github.com/SeleniumHQ/docker-selenium/issues/1610
ENV START_XVFB true
ENV SE_START_VNC true
ENV SE_START_NO_VNC true
ENV SE_NO_VNC_PORT 7900
ENV SE_VNC_PORT 5900
Expand Down
10 changes: 7 additions & 3 deletions NodeBase/start-novnc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
# IMPORTANT: Change this file only in directory NodeBase!

if [ "${START_XVFB:-$SE_START_XVFB}" = true ] ; then
if [ "${START_NO_VNC:-$SE_START_NO_VNC}" = true ] ; then
/opt/bin/noVNC/utils/novnc_proxy --listen ${NO_VNC_PORT:-$SE_NO_VNC_PORT} --vnc localhost:${VNC_PORT:-$SE_VNC_PORT}
if [ "${START_VNC:-$SE_START_VNC}" = true ] ; then
if [ "${START_NO_VNC:-$SE_START_NO_VNC}" = true ] ; then
/opt/bin/noVNC/utils/novnc_proxy --listen ${NO_VNC_PORT:-$SE_NO_VNC_PORT} --vnc localhost:${VNC_PORT:-$SE_VNC_PORT}
else
echo "noVNC won't start because SE_START_NO_VNC is false."
fi
else
echo "noVNC won't start because SE_START_NO_VNC is false."
echo "noVNC won't start because VNC is configured to not start."
fi
else
echo "noVNC won't start because Xvfb is configured to not start."
Expand Down
71 changes: 37 additions & 34 deletions NodeBase/start-vnc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,45 @@
# IMPORTANT: Change this file only in directory NodeBase!

if [ "${START_XVFB:-$SE_START_XVFB}" = true ] ; then
# Centering wallpaper
for i in $(seq 1 10)
do
sleep 0.5
echo "Centering wallpaper"
/usr/bin/fbsetbg -c /usr/share/images/fluxbox/ubuntu-light.png
if [ $? -eq 0 ]; then
break
fi
done

VNC_NO_PASSWORD=${VNC_NO_PASSWORD:-$SE_VNC_NO_PASSWORD}
if [ ! -z $VNC_NO_PASSWORD ]; then
echo "Starting VNC server without password authentication"
X11VNC_OPTS=
else
X11VNC_OPTS=-usepw
fi

VNC_VIEW_ONLY=${VNC_VIEW_ONLY:-$SE_VNC_VIEW_ONLY}
if [ ! -z $VNC_VIEW_ONLY ]; then
echo "Starting VNC server with viewonly option"
X11VNC_OPTS="${X11VNC_OPTS} -viewonly"
fi
if [ "${START_VNC:-$SE_START_VNC}" = true ] ; then
# Centering wallpaper
for i in $(seq 1 10)
do
sleep 0.5
echo "Centering wallpaper"
/usr/bin/fbsetbg -c /usr/share/images/fluxbox/ubuntu-light.png
if [ $? -eq 0 ]; then
break
fi
done
VNC_NO_PASSWORD=${VNC_NO_PASSWORD:-$SE_VNC_NO_PASSWORD}
if [ ! -z $VNC_NO_PASSWORD ]; then
echo "Starting VNC server without password authentication"
X11VNC_OPTS=
else
X11VNC_OPTS=-usepw
fi

for i in $(seq 1 10)
do
sleep 1
xdpyinfo -display ${DISPLAY} >/dev/null 2>&1
if [ $? -eq 0 ]; then
break
VNC_VIEW_ONLY=${VNC_VIEW_ONLY:-$SE_VNC_VIEW_ONLY}
if [ ! -z $VNC_VIEW_ONLY ]; then
echo "Starting VNC server with viewonly option"
X11VNC_OPTS="${X11VNC_OPTS} -viewonly"
fi
echo "Waiting for Xvfb..."
done

x11vnc ${X11VNC_OPTS} -forever -shared -rfbport ${VNC_PORT:-$SE_VNC_PORT} -rfbportv6 ${VNC_PORT:-$SE_VNC_PORT} -display ${DISPLAY}
for i in $(seq 1 10)
do
sleep 1
xdpyinfo -display ${DISPLAY} >/dev/null 2>&1
if [ $? -eq 0 ]; then
break
fi
echo "Waiting for Xvfb..."
done

x11vnc ${X11VNC_OPTS} -forever -shared -rfbport ${VNC_PORT:-$SE_VNC_PORT} -rfbportv6 ${VNC_PORT:-$SE_VNC_PORT} -display ${DISPLAY}
else
echo "VNC won't start because SE_START_VNC is false."
fi
else
echo "Vnc won't start because Xvfb is configured to not start."
echo "VNC won't start because Xvfb is configured to not start."
fi

0 comments on commit 59cf4f7

Please sign in to comment.