Skip to content

Commit

Permalink
Change Chrome Node to run Selenium Node Directly
Browse files Browse the repository at this point in the history
Remove init script for running Selenium node in favor of running the jar
directly.

Part of #3
  • Loading branch information
mtscout6 committed Nov 18, 2014
1 parent e130d99 commit db20142
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 154 deletions.
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ nodebase: base
cd ./NodeBase && docker build -t $(NAME)/node-base:$(VERSION) .

chrome: nodebase
rm -rf chrome_image
mkdir -p chrome_image/build/chrome
cp build/Dockerfile chrome_image/Dockerfile
cp build/install.sh chrome_image/build/install.sh
cp $(COPYARGS) build/chrome chrome_image/build/
cd ./chrome_image && docker build -t $(NAME)/node-chrome:$(VERSION) .
cd ./NodeChrome && docker build -t $(NAME)/node-chrome:$(VERSION) .

firefox: nodebase
rm -rf firefox_image
Expand Down
57 changes: 12 additions & 45 deletions NodeBase/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
FROM elgalu/selenium-base:2.44.0
FROM selenium/base:2.44.0
MAINTAINER Selenium <[email protected]>

#=================
# Locale settings
#=================
ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
RUN locale-gen en_US.UTF-8 \
&& dpkg-reconfigure --frontend noninteractive locales \
&& apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install \
language-pack-en \
&& rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true

#===================
# Timezone settings
Expand All @@ -26,47 +17,23 @@ RUN echo "US/Pacific" | sudo tee /etc/timezone \
#==============
RUN apt-get update -qqy \
&& apt-get -qqy install \
x11vnc \
xvfb \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /home/seluser/.vnc \
&& x11vnc -storepasswd secret /home/seluser/.vnc/passwd \
&& chmod +r /home/seluser/.vnc/passwd

#=======
# Fonts
#=======
RUN apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install \
fonts-ipafont-gothic \
xfonts-100dpi \
xfonts-75dpi \
xfonts-cyrillic \
xfonts-scalable \
&& rm -rf /var/lib/apt/lists/*

#=========
# fluxbox
# A fast, lightweight and responsive window manager
#=========
RUN apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install \
fluxbox \
&& rm -rf /var/lib/apt/lists/*

#===================================================================================
# Scripts to run Xvfb, x11vnc, fluxbox, selenium hub, and selenium node as services
#===================================================================================
COPY ./etc /etc
RUN chmod +x /etc/my_init.d/*.sh \
&& chmod +x /etc/service/**/run
#==============================
# Scripts to run Selenium Node
#==============================
COPY entry_point.sh /opt/bin/entry_point.sh
RUN chmod +x /opt/bin/entry_point.sh

#============================
# Some configuration options
#============================
ENV SCREEN_WIDTH 1360
ENV SCREEN_HEIGHT 1020
ENV SCREEN_DEPTH 24
ENV DISPLAY :20.0
ENV DISPLAY :99.0

USER seluser

EXPOSE 5900
CMD /opt/bin/entry_point.sh
20 changes: 20 additions & 0 deletions NodeBase/entry_point.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
export GEOMETRY="$SCREEN_WIDTH""x""$SCREEN_HEIGHT""x""$SCREEN_DEPTH"

if [ ! -e /opt/selenium/config.json ]; then
echo No Selenium Node configuration file, the node-base image is not intended to be run directly. 1>&2
exit 1
fi

if [ -z "$HUB_PORT_4444_TCP_ADDR" ]; then
echo Not linked with a running Hub container 1>&2
exit 1
fi

# TODO: Look into http://www.seleniumhq.org/docs/05_selenium_rc.jsp#browser-side-logs

exec xvfb-run --server-args="$DISPLAY -screen 0 $GEOMETRY -ac +extension RANDR" \
java -jar /opt/selenium/selenium-server-standalone.jar \
-role node \
-hub http://hub:4444/grid/register \
-nodeConfig /opt/selenium/config.json
8 changes: 0 additions & 8 deletions NodeBase/etc/service/fluxbox/run

This file was deleted.

5 changes: 0 additions & 5 deletions NodeBase/etc/service/sel-node-emulator/run

This file was deleted.

20 changes: 0 additions & 20 deletions NodeBase/etc/service/sel-node/run

This file was deleted.

4 changes: 0 additions & 4 deletions NodeBase/etc/service/service-emulator/run

This file was deleted.

10 changes: 0 additions & 10 deletions NodeBase/etc/service/x11vnc/run

This file was deleted.

7 changes: 0 additions & 7 deletions NodeBase/etc/service/xvfb/run

This file was deleted.

41 changes: 41 additions & 0 deletions NodeChrome/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM selenium/node-base:2.44.0
MAINTAINER Selenium <[email protected]>

USER root

#===============
# Google Chrome
#===============
# TODO: IronPort (My Corporate Firewall) - Remove --no-check-certificate flag
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub --no-check-certificate | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update -qqy \
&& apt-get -qqy install \
google-chrome-stable \
&& rm /etc/apt/sources.list.d/google-chrome.list \
&& rm -rf /var/lib/apt/lists/*

#==================
# Chrome webdriver
#==================
ENV CHROME_DRIVER_VERSION 2.12
RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip \
&& rm -rf /opt/selenium/chromedriver \
&& unzip /tmp/chromedriver_linux64.zip -d /opt/selenium \
&& rm /tmp/chromedriver_linux64.zip \
&& mv /opt/selenium/chromedriver /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
&& chmod 755 /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
&& ln -fs /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver

#========================
# Selenium Configuration
#========================
COPY config.json /opt/selenium/config.json

#=================================
# Chrome Launch Script Modication
#=================================
COPY chrome_launcher.sh /opt/google/chrome/google-chrome
RUN chmod +x /opt/google/chrome/google-chrome

USER seluser
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions bin/vncview

This file was deleted.

43 changes: 0 additions & 43 deletions build/chrome/install.sh

This file was deleted.

0 comments on commit db20142

Please sign in to comment.