Skip to content

Commit

Permalink
Updated Dockerfile.txt and generate_config for Hub, NodeBase, NodeChr…
Browse files Browse the repository at this point in the history
…ome, NodeFirefox.
  • Loading branch information
Thomas Parikka committed Apr 13, 2017
1 parent 2b6bf9c commit da26d7c
Show file tree
Hide file tree
Showing 18 changed files with 103 additions and 61 deletions.
24 changes: 11 additions & 13 deletions Hub/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@ MAINTAINER Selenium <[email protected]>

EXPOSE 4444

ENV GRID_THROW_ON_CAPABILITY_NOT_PRESENT true
# In milliseconds
# As integer, maps to "maxSession"
ENV GRID_MAX_SESSION 5
# In milliseconds, maps to "newSessionWaitTimeout"
ENV GRID_NEW_SESSION_WAIT_TIMEOUT -1
# As a boolean, maps to "throwOnCapabilityNotPresent"
ENV GRID_THROW_ON_CAPABILITY_NOT_PRESENT true
# As an integer
ENV GRID_JETTY_MAX_THREADS -1
# In milliseconds
ENV GRID_NODE_POLLING 5000
# In milliseconds
# In milliseconds, maps to "cleanUpCycle"
ENV GRID_CLEAN_UP_CYCLE 5000
# In seconds
ENV GRID_TIMEOUT 30
# In seconds
# In seconds, maps to "browserTimeout"
ENV GRID_BROWSER_TIMEOUT 0
ENV GRID_MAX_SESSION 5
# In milliseconds
ENV GRID_UNREGISTER_IF_STILL_DOWN_AFTER 30000
# In seconds, maps to "timeout"
ENV GRID_TIMEOUT 30

COPY generate_config /opt/selenium/generate_config
COPY entry_point.sh /opt/bin/entry_point.sh
Expand All @@ -34,5 +33,4 @@ RUN chown -R seluser /opt/selenium

USER seluser

CMD ["/opt/bin/entry_point.sh"]

CMD ["/opt/bin/entry_point.sh"]
24 changes: 11 additions & 13 deletions Hub/Dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,20 @@ MAINTAINER Selenium <[email protected]>

EXPOSE 4444

ENV GRID_THROW_ON_CAPABILITY_NOT_PRESENT true
# In milliseconds
# As integer, maps to "maxSession"
ENV GRID_MAX_SESSION 5
# In milliseconds, maps to "newSessionWaitTimeout"
ENV GRID_NEW_SESSION_WAIT_TIMEOUT -1
# As a boolean, maps to "throwOnCapabilityNotPresent"
ENV GRID_THROW_ON_CAPABILITY_NOT_PRESENT true
# As an integer
ENV GRID_JETTY_MAX_THREADS -1
# In milliseconds
ENV GRID_NODE_POLLING 5000
# In milliseconds
# In milliseconds, maps to "cleanUpCycle"
ENV GRID_CLEAN_UP_CYCLE 5000
# In seconds
ENV GRID_TIMEOUT 30
# In seconds
# In seconds, maps to "browserTimeout"
ENV GRID_BROWSER_TIMEOUT 0
ENV GRID_MAX_SESSION 5
# In milliseconds
ENV GRID_UNREGISTER_IF_STILL_DOWN_AFTER 30000
# In seconds, maps to "timeout"
ENV GRID_TIMEOUT 30

COPY generate_config /opt/selenium/generate_config
COPY entry_point.sh /opt/bin/entry_point.sh
Expand All @@ -29,5 +28,4 @@ RUN chown -R seluser /opt/selenium

USER seluser

CMD ["/opt/bin/entry_point.sh"]

CMD ["/opt/bin/entry_point.sh"]
3 changes: 1 addition & 2 deletions Hub/entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
NODE_PID=$!

trap shutdown SIGTERM SIGINT
wait $NODE_PID

wait $NODE_PID
2 changes: 1 addition & 1 deletion Hub/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ echo "# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED." >> ./Dockerfile
echo "# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE" >> ./Dockerfile
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> ./Dockerfile
echo FROM selenium/base:$VERSION >> ./Dockerfile
cat ./Dockerfile.txt >> ./Dockerfile
cat ./Dockerfile.txt >> ./Dockerfile
14 changes: 5 additions & 9 deletions Hub/generate_config
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ echo "
{
\"host\": null,
\"port\": 4444,
\"prioritizer\": null,
\"maxSession\": $GRID_MAX_SESSION,
\"newSessionWaitTimeout\": $GRID_NEW_SESSION_WAIT_TIMEOUT,
\"capabilityMatcher\": \"org.openqa.grid.internal.utils.DefaultCapabilityMatcher\",
\"throwOnCapabilityNotPresent\": $GRID_THROW_ON_CAPABILITY_NOT_PRESENT,
\"newSessionWaitTimeout\": $GRID_NEW_SESSION_WAIT_TIMEOUT,
\"jettyMaxThreads\": $GRID_JETTY_MAX_THREADS,
\"nodePolling\": $GRID_NODE_POLLING,
\"cleanUpCycle\": $GRID_CLEAN_UP_CYCLE,
\"timeout\": $GRID_TIMEOUT,
\"browserTimeout\": $GRID_BROWSER_TIMEOUT,
\"maxSession\": $GRID_MAX_SESSION,
\"unregisterIfStillDownAfter\": $GRID_UNREGISTER_IF_STILL_DOWN_AFTER
}"


\"timeout\": $GRID_TIMEOUT,
\"prioritizer\": null,
}"
2 changes: 1 addition & 1 deletion NodeBase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ ENV DISPLAY :99.0

USER seluser

CMD ["/opt/bin/entry_point.sh"]
CMD ["/opt/bin/entry_point.sh"]
2 changes: 1 addition & 1 deletion NodeBase/Dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ ENV DISPLAY :99.0

USER seluser

CMD ["/opt/bin/entry_point.sh"]
CMD ["/opt/bin/entry_point.sh"]
2 changes: 1 addition & 1 deletion NodeBase/entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ xvfb-run -n $SERVERNUM --server-args="-screen 0 $GEOMETRY -ac +extension RANDR"
NODE_PID=$!

trap shutdown SIGTERM SIGINT
wait $NODE_PID
wait $NODE_PID
3 changes: 1 addition & 2 deletions NodeBase/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
# https://github.com/SeleniumHQ/docker-selenium/issues/184
function get_server_num() {
echo $(echo $DISPLAY | sed -r -e 's/([^:]+)?:([0-9]+)(\.[0-9]+)?/\2/')
}

}
2 changes: 1 addition & 1 deletion NodeBase/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ echo "# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED." >> ./Dockerfile
echo "# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE" >> ./Dockerfile
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> ./Dockerfile
echo FROM selenium/base:$VERSION >> ./Dockerfile
cat ./Dockerfile.txt >> ./Dockerfile
cat ./Dockerfile.txt >> ./Dockerfile
16 changes: 14 additions & 2 deletions NodeChrome/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,23 @@ RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.stor
#========================
# Selenium Configuration
#========================
# As integer, maps to "maxInstances"
ENV NODE_MAX_INSTANCES 1
# As integer, maps to "maxSession"
ENV NODE_MAX_SESSION 1
ENV NODE_REGISTER_CYCLE 5000
# As integer, maps to "port"
ENV NODE_PORT 5555
# In milliseconds, maps to "registerCycle"
ENV NODE_REGISTER_CYCLE 5000
# In milliseconds, maps to "nodePolling"
ENV NODE_POLLING 5000
# In milliseconds, maps to "unregisterIfStillDownAfter"
ENV NODE_UNREGISTER_IF_STILL_DOWN_AFTER 60000
# As integer, maps to "downPollingLimit"
ENV NODE_DOWN_POLLING_LIMIT 2
# As string, maps to "applicationName"
ENV NODE_APPLICATION_NAME ""

COPY generate_config /opt/selenium/generate_config
RUN chmod +x /opt/selenium/generate_config

Expand All @@ -61,4 +73,4 @@ RUN chown -R seluser:seluser /opt/selenium
# https://github.com/SeleniumHQ/docker-selenium/issues/87
RUN echo "DBUS_SESSION_BUS_ADDRESS=/dev/null" >> /etc/environment

USER seluser
USER seluser
16 changes: 14 additions & 2 deletions NodeChrome/Dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,23 @@ RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.stor
#========================
# Selenium Configuration
#========================
# As integer, maps to "maxInstances"
ENV NODE_MAX_INSTANCES 1
# As integer, maps to "maxSession"
ENV NODE_MAX_SESSION 1
ENV NODE_REGISTER_CYCLE 5000
# As integer, maps to "port"
ENV NODE_PORT 5555
# In milliseconds, maps to "registerCycle"
ENV NODE_REGISTER_CYCLE 5000
# In milliseconds, maps to "nodePolling"
ENV NODE_POLLING 5000
# In milliseconds, maps to "unregisterIfStillDownAfter"
ENV NODE_UNREGISTER_IF_STILL_DOWN_AFTER 60000
# As integer, maps to "downPollingLimit"
ENV NODE_DOWN_POLLING_LIMIT 2
# As string, maps to "applicationName"
ENV NODE_APPLICATION_NAME ""

COPY generate_config /opt/selenium/generate_config
RUN chmod +x /opt/selenium/generate_config

Expand All @@ -56,4 +68,4 @@ RUN chown -R seluser:seluser /opt/selenium
# https://github.com/SeleniumHQ/docker-selenium/issues/87
RUN echo "DBUS_SESSION_BUS_ADDRESS=/dev/null" >> /etc/environment

USER seluser
USER seluser
2 changes: 1 addition & 1 deletion NodeChrome/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ echo "# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED." >> ./Dockerfile
echo "# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE" >> ./Dockerfile
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> ./Dockerfile
echo FROM selenium/node-base:$VERSION >> ./Dockerfile
cat ./Dockerfile.txt >> ./Dockerfile
cat ./Dockerfile.txt >> ./Dockerfile
6 changes: 4 additions & 2 deletions NodeChrome/generate_config
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ echo "
\"port\": $NODE_PORT,
\"register\": true,
\"registerCycle\": $NODE_REGISTER_CYCLE
}"

\"nodePolling\": $NODE_POLLING,
\"unregisterIfStillDownAfter\": $NODE_UNREGISTER_IF_STILL_DOWN_AFTER,
\"downPollingLimit\": $NODE_DOWN_POLLING_LIMIT
}"
8 changes: 4 additions & 4 deletions NodeChromeDebug/entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ SERVERNUM=$(get_server_num)
rm -f /tmp/.X*lock

env | cut -f 1 -d "=" | sort > asroot
sudo -E -u seluser -i env | cut -f 1 -d "=" | sort > asseluser
sudo -E -i -u seluser \
"$(for E in $(grep -vxFf asseluser asroot); do echo $E=$(eval echo \$$E); done)" \
sudo -E -u seluser -i env | cut -f 1 -d "=" | sort > asseluser
sudo -E -i -u seluser \
$(for E in $(grep -vxFf asseluser asroot); do echo $E=$(eval echo \$$E); done) \
DISPLAY=$DISPLAY \
xvfb-run -n $SERVERNUM --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
Expand All @@ -63,4 +63,4 @@ fluxbox -display $DISPLAY &

x11vnc -forever -usepw -shared -rfbport 5900 -display $DISPLAY &

wait $NODE_PID
wait $NODE_PID
14 changes: 13 additions & 1 deletion NodeFirefox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,23 @@ RUN wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geck
#========================
# Selenium Configuration
#========================
# As integer, maps to "maxInstances"
ENV NODE_MAX_INSTANCES 1
# As integer, maps to "maxSession"
ENV NODE_MAX_SESSION 1
ENV NODE_REGISTER_CYCLE 5000
# As integer, maps to "port"
ENV NODE_PORT 5555
# In milliseconds, maps to "registerCycle"
ENV NODE_REGISTER_CYCLE 5000
# In milliseconds, maps to "nodePolling"
ENV NODE_POLLING 5000
# In milliseconds, maps to "unregisterIfStillDownAfter"
ENV NODE_UNREGISTER_IF_STILL_DOWN_AFTER 60000
# As integer, maps to "downPollingLimit"
ENV NODE_DOWN_POLLING_LIMIT 2
# As string, maps to "applicationName"
ENV NODE_APPLICATION_NAME ""

COPY generate_config /opt/selenium/generate_config
RUN chmod +x /opt/selenium/generate_config \
&& chown -R seluser:seluser /opt/selenium
Expand Down
14 changes: 13 additions & 1 deletion NodeFirefox/Dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,23 @@ RUN wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geck
#========================
# Selenium Configuration
#========================
# As integer, maps to "maxInstances"
ENV NODE_MAX_INSTANCES 1
# As integer, maps to "maxSession"
ENV NODE_MAX_SESSION 1
ENV NODE_REGISTER_CYCLE 5000
# As integer, maps to "port"
ENV NODE_PORT 5555
# In milliseconds, maps to "registerCycle"
ENV NODE_REGISTER_CYCLE 5000
# In milliseconds, maps to "nodePolling"
ENV NODE_POLLING 5000
# In milliseconds, maps to "unregisterIfStillDownAfter"
ENV NODE_UNREGISTER_IF_STILL_DOWN_AFTER 60000
# As integer, maps to "downPollingLimit"
ENV NODE_DOWN_POLLING_LIMIT 2
# As string, maps to "applicationName"
ENV NODE_APPLICATION_NAME ""

COPY generate_config /opt/selenium/generate_config
RUN chmod +x /opt/selenium/generate_config \
&& chown -R seluser:seluser /opt/selenium
Expand Down
10 changes: 6 additions & 4 deletions NodeFirefox/generate_config
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ echo "
{
\"capabilities\": [
{
\"version\": \"$FIREFOX_VERSION\",
\"browserName\": \"firefox\",
\"version\": \"$CHROME_VERSION\",
\"browserName\": \"chrome\",
\"maxInstances\": $NODE_MAX_INSTANCES,
\"seleniumProtocol\": \"WebDriver\",
\"applicationName\": \"$NODE_APPLICATION_NAME\"
Expand All @@ -18,5 +18,7 @@ echo "
\"port\": $NODE_PORT,
\"register\": true,
\"registerCycle\": $NODE_REGISTER_CYCLE
}"

\"nodePolling\": $NODE_POLLING,
\"unregisterIfStillDownAfter\": $NODE_UNREGISTER_IF_STILL_DOWN_AFTER,
\"downPollingLimit\": $NODE_DOWN_POLLING_LIMIT
}"

0 comments on commit da26d7c

Please sign in to comment.