Skip to content

Commit 5a28238

Browse files
authored
Using xvfb-run to expose display via tcp (#1110)
This will allow another container to attach itself to the exposed display, and potentially record the stream.
1 parent 8158f32 commit 5a28238

File tree

7 files changed

+14
-55
lines changed

7 files changed

+14
-55
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
NAME := $(or $(NAME),$(NAME),selenium)
22
CURRENT_DATE := $(shell date '+%Y%m%d')
33
BUILD_DATE := $(or $(BUILD_DATE),$(BUILD_DATE),$(CURRENT_DATE))
4-
VERSION := $(or $(VERSION),$(VERSION),4.0.0-alpha-6)
4+
VERSION := $(or $(VERSION),$(VERSION),4.0.0-alpha-7)
55
TAG_VERSION := $(VERSION)-$(BUILD_DATE)
66
NAMESPACE := $(or $(NAMESPACE),$(NAMESPACE),$(NAME))
77
AUTHORS := $(or $(AUTHORS),$(AUTHORS),SeleniumHQ)

NodeBase/Dockerfile.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ RUN sudo chmod -R 777 ${HOME} \
117117
#==============================
118118
# Scripts to run fluxbox and x11vnc
119119
#==============================
120-
COPY start-fluxbox.sh \
121-
start-vnc.sh \
120+
COPY start-vnc.sh \
122121
/opt/bin/
123122

124123
#============================
@@ -129,6 +128,7 @@ ENV SCREEN_HEIGHT 1020
129128
ENV SCREEN_DEPTH 24
130129
ENV SCREEN_DPI 96
131130
ENV DISPLAY :99.0
131+
ENV DISPLAY_NUM 99
132132
ENV START_XVFB true
133133

134134
#========================

NodeBase/selenium.conf

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,6 @@ stderr_logfile_backups=5
2121
stdout_capture_maxbytes=50MB
2222
stderr_capture_maxbytes=50MB
2323

24-
[program:fluxbox]
25-
priority=5
26-
command=/opt/bin/start-fluxbox.sh
27-
autostart=true
28-
autorestart=unexpected
29-
startsecs=0
30-
startretries=0
31-
32-
;Logs
33-
redirect_stderr=false
34-
stdout_logfile=/var/log/supervisor/fluxbox-stdout.log
35-
stderr_logfile=/var/log/supervisor/fluxbox-stderr.log
36-
stdout_logfile_maxbytes=50MB
37-
stderr_logfile_maxbytes=50MB
38-
stdout_logfile_backups=5
39-
stderr_logfile_backups=5
40-
stdout_capture_maxbytes=50MB
41-
stderr_capture_maxbytes=50MB
42-
4324
[program:vnc]
4425
priority=10
4526
command=/opt/bin/start-vnc.sh

NodeBase/start-fluxbox.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

NodeBase/start-vnc.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# IMPORTANT: Change this file only in directory NodeDebug!
3+
# IMPORTANT: Change this file only in directory NodeBase!
44

55
if [ "${START_XVFB}" = true ] ; then
66
if [ ! -z $VNC_NO_PASSWORD ]; then
@@ -20,8 +20,7 @@ if [ "${START_XVFB}" = true ] ; then
2020
echo "Waiting for Xvfb..."
2121
done
2222

23-
# -noxrecord fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859213 in x11vnc 0.9.13-2
24-
x11vnc ${X11VNC_OPTS} -forever -shared -rfbport 5900 -display ${DISPLAY} -noxrecord
23+
x11vnc ${X11VNC_OPTS} -forever -shared -rfbport 5900 -rfbportv6 5900 -display ${DISPLAY}
2524
else
2625
echo "Vnc won't start because Xvfb is configured to not start."
2726
fi

NodeBase/start-xvfb.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ if [ "${START_XVFB}" = true ] ; then
55

66
rm -f /tmp/.X*lock
77

8-
/usr/bin/Xvfb ${DISPLAY} -screen 0 ${GEOMETRY} -dpi ${SCREEN_DPI} -ac +extension RANDR
8+
# Command reference
9+
# http://manpages.ubuntu.com/manpages/bionic/man1/xvfb-run.1.html
10+
# http://manpages.ubuntu.com/manpages/bionic/man1/Xvfb.1.html
11+
# http://manpages.ubuntu.com/manpages/bionic/man1/Xserver.1.html
12+
/usr/bin/xvfb-run --server-num=${DISPLAY_NUM} \
13+
--listen-tcp \
14+
--server-args="-screen 0 ${GEOMETRY} -dpi ${SCREEN_DPI} -listen tcp -noreset -ac +extension RANDR" \
15+
/usr/bin/fluxbox -display ${DISPLAY}
916
else
10-
echo "Xvfb won't start. Chrome/Firefox can only run in headless mode. Remember to set the 'headless' flag in your test."
17+
echo "Xvfb and Fluxbox won't start. Chrome/Firefox/Opera can only run in headless mode. Remember to set the 'headless' flag in your test."
1118
fi

Standalone/selenium.conf

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,6 @@ stderr_logfile_backups=5
2121
stdout_capture_maxbytes=50MB
2222
stderr_capture_maxbytes=50MB
2323

24-
[program:fluxbox]
25-
priority=5
26-
command=/opt/bin/start-fluxbox.sh
27-
autostart=true
28-
autorestart=unexpected
29-
startsecs=0
30-
startretries=0
31-
32-
;Logs
33-
redirect_stderr=false
34-
stdout_logfile=/var/log/supervisor/fluxbox-stdout.log
35-
stderr_logfile=/var/log/supervisor/fluxbox-stderr.log
36-
stdout_logfile_maxbytes=50MB
37-
stderr_logfile_maxbytes=50MB
38-
stdout_logfile_backups=5
39-
stderr_logfile_backups=5
40-
stdout_capture_maxbytes=50MB
41-
stderr_capture_maxbytes=50MB
42-
4324
[program:vnc]
4425
priority=10
4526
command=/opt/bin/start-vnc.sh

0 commit comments

Comments
 (0)