Skip to content

Commit

Permalink
Using xvfb-run to expose display via tcp (#1110)
Browse files Browse the repository at this point in the history
This will allow another container to attach
itself to the exposed display, and potentially
record the stream.
  • Loading branch information
diemol authored Sep 17, 2020
1 parent 8158f32 commit 5a28238
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 55 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NAME := $(or $(NAME),$(NAME),selenium)
CURRENT_DATE := $(shell date '+%Y%m%d')
BUILD_DATE := $(or $(BUILD_DATE),$(BUILD_DATE),$(CURRENT_DATE))
VERSION := $(or $(VERSION),$(VERSION),4.0.0-alpha-6)
VERSION := $(or $(VERSION),$(VERSION),4.0.0-alpha-7)
TAG_VERSION := $(VERSION)-$(BUILD_DATE)
NAMESPACE := $(or $(NAMESPACE),$(NAMESPACE),$(NAME))
AUTHORS := $(or $(AUTHORS),$(AUTHORS),SeleniumHQ)
Expand Down
4 changes: 2 additions & 2 deletions NodeBase/Dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ RUN sudo chmod -R 777 ${HOME} \
#==============================
# Scripts to run fluxbox and x11vnc
#==============================
COPY start-fluxbox.sh \
start-vnc.sh \
COPY start-vnc.sh \
/opt/bin/

#============================
Expand All @@ -129,6 +128,7 @@ ENV SCREEN_HEIGHT 1020
ENV SCREEN_DEPTH 24
ENV SCREEN_DPI 96
ENV DISPLAY :99.0
ENV DISPLAY_NUM 99
ENV START_XVFB true

#========================
Expand Down
19 changes: 0 additions & 19 deletions NodeBase/selenium.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,6 @@ stderr_logfile_backups=5
stdout_capture_maxbytes=50MB
stderr_capture_maxbytes=50MB

[program:fluxbox]
priority=5
command=/opt/bin/start-fluxbox.sh
autostart=true
autorestart=unexpected
startsecs=0
startretries=0

;Logs
redirect_stderr=false
stdout_logfile=/var/log/supervisor/fluxbox-stdout.log
stderr_logfile=/var/log/supervisor/fluxbox-stderr.log
stdout_logfile_maxbytes=50MB
stderr_logfile_maxbytes=50MB
stdout_logfile_backups=5
stderr_logfile_backups=5
stdout_capture_maxbytes=50MB
stderr_capture_maxbytes=50MB

[program:vnc]
priority=10
command=/opt/bin/start-vnc.sh
Expand Down
9 changes: 0 additions & 9 deletions NodeBase/start-fluxbox.sh

This file was deleted.

5 changes: 2 additions & 3 deletions NodeBase/start-vnc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# IMPORTANT: Change this file only in directory NodeDebug!
# IMPORTANT: Change this file only in directory NodeBase!

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

# -noxrecord fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859213 in x11vnc 0.9.13-2
x11vnc ${X11VNC_OPTS} -forever -shared -rfbport 5900 -display ${DISPLAY} -noxrecord
x11vnc ${X11VNC_OPTS} -forever -shared -rfbport 5900 -rfbportv6 5900 -display ${DISPLAY}
else
echo "Vnc won't start because Xvfb is configured to not start."
fi
11 changes: 9 additions & 2 deletions NodeBase/start-xvfb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ if [ "${START_XVFB}" = true ] ; then

rm -f /tmp/.X*lock

/usr/bin/Xvfb ${DISPLAY} -screen 0 ${GEOMETRY} -dpi ${SCREEN_DPI} -ac +extension RANDR
# Command reference
# http://manpages.ubuntu.com/manpages/bionic/man1/xvfb-run.1.html
# http://manpages.ubuntu.com/manpages/bionic/man1/Xvfb.1.html
# http://manpages.ubuntu.com/manpages/bionic/man1/Xserver.1.html
/usr/bin/xvfb-run --server-num=${DISPLAY_NUM} \
--listen-tcp \
--server-args="-screen 0 ${GEOMETRY} -dpi ${SCREEN_DPI} -listen tcp -noreset -ac +extension RANDR" \
/usr/bin/fluxbox -display ${DISPLAY}
else
echo "Xvfb won't start. Chrome/Firefox can only run in headless mode. Remember to set the 'headless' flag in your test."
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."
fi
19 changes: 0 additions & 19 deletions Standalone/selenium.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,6 @@ stderr_logfile_backups=5
stdout_capture_maxbytes=50MB
stderr_capture_maxbytes=50MB

[program:fluxbox]
priority=5
command=/opt/bin/start-fluxbox.sh
autostart=true
autorestart=unexpected
startsecs=0
startretries=0

;Logs
redirect_stderr=false
stdout_logfile=/var/log/supervisor/fluxbox-stdout.log
stderr_logfile=/var/log/supervisor/fluxbox-stderr.log
stdout_logfile_maxbytes=50MB
stderr_logfile_maxbytes=50MB
stdout_logfile_backups=5
stderr_logfile_backups=5
stdout_capture_maxbytes=50MB
stderr_capture_maxbytes=50MB

[program:vnc]
priority=10
command=/opt/bin/start-vnc.sh
Expand Down

0 comments on commit 5a28238

Please sign in to comment.