Skip to content

Commit 6c102c3

Browse files
committed
Adding START_XVFB as a env var to start (or not) Xvfb, in case a user
wants to run Chrome and Firefox in headless mode and thinks that Xvfb uses too many resources. Fixes #429 and fixes #567.
1 parent 73c67d6 commit 6c102c3

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed

NodeBase/Dockerfile.txt

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ ENV SCREEN_WIDTH 1360
8989
ENV SCREEN_HEIGHT 1020
9090
ENV SCREEN_DEPTH 24
9191
ENV DISPLAY :99.0
92+
ENV START_XVFB true
9293

9394
#========================
9495
# Selenium Configuration

NodeBase/start-xvfb.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#!/usr/bin/env bash
22

3-
export GEOMETRY="${SCREEN_WIDTH}""x""${SCREEN_HEIGHT}""x""${SCREEN_DEPTH}"
3+
if [ "${START_XVFB}" = true ] ; then
4+
export GEOMETRY="${SCREEN_WIDTH}""x""${SCREEN_HEIGHT}""x""${SCREEN_DEPTH}"
45

5-
rm -f /tmp/.X*lock
6+
rm -f /tmp/.X*lock
67

7-
/usr/bin/Xvfb ${DISPLAY} -screen 0 ${GEOMETRY} -ac +extension RANDR
8+
/usr/bin/Xvfb ${DISPLAY} -screen 0 ${GEOMETRY} -ac +extension RANDR
9+
else
10+
echo "Xvfb won't start. Chrome/Firefox can only run in headless mode. Remember to set the 'headless' flag in your test."
11+
fi

NodeDebug/start-fluxbox.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
#
33
# IMPORTANT: Change this file only in directory NodeDebug!
44

5-
fluxbox -display ${DISPLAY}
5+
if [ "${START_XVFB}" = true ] ; then
6+
fluxbox -display ${DISPLAY}
7+
else
8+
echo "Fluxbox won't start because Xvfb is configured to not start."
9+
fi

NodeDebug/start-vnc.sh

+20-16
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@
22
#
33
# IMPORTANT: Change this file only in directory NodeDebug!
44

5-
if [ ! -z $VNC_NO_PASSWORD ]; then
6-
echo "Starting VNC server without password authentication"
7-
X11VNC_OPTS=
8-
else
9-
X11VNC_OPTS=-usepw
10-
fi
11-
12-
for i in $(seq 1 10)
13-
do
14-
sleep 1
15-
xdpyinfo -display ${DISPLAY} >/dev/null 2>&1
16-
if [ $? -eq 0 ]; then
17-
break
5+
if [ "${START_XVFB}" = true ] ; then
6+
if [ ! -z $VNC_NO_PASSWORD ]; then
7+
echo "Starting VNC server without password authentication"
8+
X11VNC_OPTS=
9+
else
10+
X11VNC_OPTS=-usepw
1811
fi
19-
echo "Waiting for Xvfb..."
20-
done
2112

22-
x11vnc ${X11VNC_OPTS} -forever -shared -rfbport 5900 -display ${DISPLAY}
13+
for i in $(seq 1 10)
14+
do
15+
sleep 1
16+
xdpyinfo -display ${DISPLAY} >/dev/null 2>&1
17+
if [ $? -eq 0 ]; then
18+
break
19+
fi
20+
echo "Waiting for Xvfb..."
21+
done
22+
23+
x11vnc ${X11VNC_OPTS} -forever -shared -rfbport 5900 -display ${DISPLAY}
24+
else
25+
echo "Vnc won't start because Xvfb is configured to not start."
26+
fi

0 commit comments

Comments
 (0)