From da26d7c737817129ac59777058e1dadc8bf17ee6 Mon Sep 17 00:00:00 2001 From: Thomas Parikka Date: Thu, 13 Apr 2017 11:06:58 -0500 Subject: [PATCH] Updated Dockerfile.txt and generate_config for Hub, NodeBase, NodeChrome, NodeFirefox. --- Hub/Dockerfile | 24 +++++++++++------------- Hub/Dockerfile.txt | 24 +++++++++++------------- Hub/entry_point.sh | 3 +-- Hub/generate.sh | 2 +- Hub/generate_config | 14 +++++--------- NodeBase/Dockerfile | 2 +- NodeBase/Dockerfile.txt | 2 +- NodeBase/entry_point.sh | 2 +- NodeBase/functions.sh | 3 +-- NodeBase/generate.sh | 2 +- NodeChrome/Dockerfile | 16 ++++++++++++++-- NodeChrome/Dockerfile.txt | 16 ++++++++++++++-- NodeChrome/generate.sh | 2 +- NodeChrome/generate_config | 6 ++++-- NodeChromeDebug/entry_point.sh | 8 ++++---- NodeFirefox/Dockerfile | 14 +++++++++++++- NodeFirefox/Dockerfile.txt | 14 +++++++++++++- NodeFirefox/generate_config | 10 ++++++---- 18 files changed, 103 insertions(+), 61 deletions(-) diff --git a/Hub/Dockerfile b/Hub/Dockerfile index de9440586..bf506182d 100644 --- a/Hub/Dockerfile +++ b/Hub/Dockerfile @@ -11,21 +11,20 @@ MAINTAINER Selenium 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 @@ -34,5 +33,4 @@ RUN chown -R seluser /opt/selenium USER seluser -CMD ["/opt/bin/entry_point.sh"] - +CMD ["/opt/bin/entry_point.sh"] \ No newline at end of file diff --git a/Hub/Dockerfile.txt b/Hub/Dockerfile.txt index da4ac1b2e..1101aa3ad 100644 --- a/Hub/Dockerfile.txt +++ b/Hub/Dockerfile.txt @@ -6,21 +6,20 @@ MAINTAINER Selenium 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 @@ -29,5 +28,4 @@ RUN chown -R seluser /opt/selenium USER seluser -CMD ["/opt/bin/entry_point.sh"] - +CMD ["/opt/bin/entry_point.sh"] \ No newline at end of file diff --git a/Hub/entry_point.sh b/Hub/entry_point.sh index 4c8472ce6..4c3016cd8 100755 --- a/Hub/entry_point.sh +++ b/Hub/entry_point.sh @@ -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 \ No newline at end of file diff --git a/Hub/generate.sh b/Hub/generate.sh index 6029aeeb9..1363f3f2d 100755 --- a/Hub/generate.sh +++ b/Hub/generate.sh @@ -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 \ No newline at end of file diff --git a/Hub/generate_config b/Hub/generate_config index 721c7a4b0..59b12ff96 100755 --- a/Hub/generate_config +++ b/Hub/generate_config @@ -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, +}" \ No newline at end of file diff --git a/NodeBase/Dockerfile b/NodeBase/Dockerfile index 819167c6f..889218e87 100644 --- a/NodeBase/Dockerfile +++ b/NodeBase/Dockerfile @@ -35,4 +35,4 @@ ENV DISPLAY :99.0 USER seluser -CMD ["/opt/bin/entry_point.sh"] +CMD ["/opt/bin/entry_point.sh"] \ No newline at end of file diff --git a/NodeBase/Dockerfile.txt b/NodeBase/Dockerfile.txt index 850083e29..0fb557ae9 100644 --- a/NodeBase/Dockerfile.txt +++ b/NodeBase/Dockerfile.txt @@ -30,4 +30,4 @@ ENV DISPLAY :99.0 USER seluser -CMD ["/opt/bin/entry_point.sh"] +CMD ["/opt/bin/entry_point.sh"] \ No newline at end of file diff --git a/NodeBase/entry_point.sh b/NodeBase/entry_point.sh index 89efc15ca..c85c17f0e 100644 --- a/NodeBase/entry_point.sh +++ b/NodeBase/entry_point.sh @@ -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 \ No newline at end of file diff --git a/NodeBase/functions.sh b/NodeBase/functions.sh index afcb3e54f..12b4ca4f2 100644 --- a/NodeBase/functions.sh +++ b/NodeBase/functions.sh @@ -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/') -} - +} \ No newline at end of file diff --git a/NodeBase/generate.sh b/NodeBase/generate.sh index 6029aeeb9..1363f3f2d 100755 --- a/NodeBase/generate.sh +++ b/NodeBase/generate.sh @@ -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 \ No newline at end of file diff --git a/NodeChrome/Dockerfile b/NodeChrome/Dockerfile index 151a3d084..235e380b2 100644 --- a/NodeChrome/Dockerfile +++ b/NodeChrome/Dockerfile @@ -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 @@ -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 \ No newline at end of file diff --git a/NodeChrome/Dockerfile.txt b/NodeChrome/Dockerfile.txt index 3f9effb63..ac823b0f2 100644 --- a/NodeChrome/Dockerfile.txt +++ b/NodeChrome/Dockerfile.txt @@ -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 @@ -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 \ No newline at end of file diff --git a/NodeChrome/generate.sh b/NodeChrome/generate.sh index 8877b18b4..be89211b8 100755 --- a/NodeChrome/generate.sh +++ b/NodeChrome/generate.sh @@ -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 \ No newline at end of file diff --git a/NodeChrome/generate_config b/NodeChrome/generate_config index e593be0fd..a9526c993 100755 --- a/NodeChrome/generate_config +++ b/NodeChrome/generate_config @@ -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 +}" \ No newline at end of file diff --git a/NodeChromeDebug/entry_point.sh b/NodeChromeDebug/entry_point.sh index 27fbe19e1..1cd18767b 100644 --- a/NodeChromeDebug/entry_point.sh +++ b/NodeChromeDebug/entry_point.sh @@ -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 \ @@ -63,4 +63,4 @@ fluxbox -display $DISPLAY & x11vnc -forever -usepw -shared -rfbport 5900 -display $DISPLAY & -wait $NODE_PID +wait $NODE_PID \ No newline at end of file diff --git a/NodeFirefox/Dockerfile b/NodeFirefox/Dockerfile index 41136b2ed..9b5a9ee9a 100644 --- a/NodeFirefox/Dockerfile +++ b/NodeFirefox/Dockerfile @@ -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 diff --git a/NodeFirefox/Dockerfile.txt b/NodeFirefox/Dockerfile.txt index e2fec3b0f..3ec29cdd2 100644 --- a/NodeFirefox/Dockerfile.txt +++ b/NodeFirefox/Dockerfile.txt @@ -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 diff --git a/NodeFirefox/generate_config b/NodeFirefox/generate_config index 62694563e..cdba12166 100755 --- a/NodeFirefox/generate_config +++ b/NodeFirefox/generate_config @@ -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\" @@ -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 +}" \ No newline at end of file