diff --git a/CHANGELOG.md b/CHANGELOG.md index b75fa76f..6d2f637e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,27 @@ Note sha256 digests are generated after pushing the image to the registry theref Note image ids also change after scm-source.json has being updated which triggers a cyclic problem so value TBD will be set here and updated in the [release][] page by navigating into any release tag. +## v2.46.0-01 (2015-07-16) + + Launch as grid only, firefox node only, chrome node only. (Leo Gallucci) + + Start services via env vars VIDEO=false GRID=true CHROME=true FIREFOX=true + + Image tag details: + + Selenium: v2.46.0 (87c69e2) + + Chrome stable: 43.0.2357.134 + + Chrome beta: 44.0.2403.81 + + Chrome unstable: 45.0.2454.6 + + Firefox versions in this image: + 39.0 38.0.6 37.0.2 36.0.4 + 35.0.1 34.0.5 33.0.3 32.0.3 31.0 30.0 + 29.0.1 28.0 27.0.1 26.0 25.0.1 24.0 + + chromedriver: 2.16.333243 (0bfa1d3575fc1044244f21ddb82bf870944ef961) + + Java: 1.8.0_45 HotSpot(TM) 64-Bit 1.8.0_45-b14 + + Timezone: Europe/Berlin + + Built with: Docker version 1.7.1, build 786b29d + + FROM ubuntu:trusty-20150630 + + Python: 2.7.6 + + Digest: sha256:TBD + + Image ID: TBD + ## v2.46.0-00 (2015-07-15) + Make selenium maxInstances & maxSession configurable. (Leo Gallucci) + MAJOR: turned docker-selenium into 1 hub N nodes localhost setup. @@ -24,6 +45,7 @@ Note image ids also change after scm-source.json has being updated which trigger + Java: 1.8.0_45 HotSpot(TM) 64-Bit 1.8.0_45-b14 + Timezone: Europe/Berlin + Built with: Docker version 1.7.1, build 786b29d + + FROM ubuntu:trusty-20150630 + Python: 2.7.6 + Digest: sha256:94c0e3992501db24a5a07cba516d8e7e32ac419ea7accae915275eb58dd389d5 + Image ID: a8bc01890482646e82188ecd84b799fb2e7a1588f7627779b16735ed55d4f40c @@ -45,6 +67,7 @@ Note image ids also change after scm-source.json has being updated which trigger + Java: 1.8.0_45 HotSpot(TM) 64-Bit 1.8.0_45-b14 + Timezone: Europe/Berlin + Built with: Docker version 1.7.0, build 0baf609 + + FROM ubuntu:wily-20150708 + Python: 2.7.10 + Digest: sha256:1cd291d278d888cf566e0c7ca95377407b568ca3fb05aedb11f9781277e1ecb7 + Image ID: 27b1674c981927123538e809d33cb7c9644da4c0f2cca85a655792d2cf57d698 @@ -60,6 +83,7 @@ Note image ids also change after scm-source.json has being updated which trigger + Java: 1.8.0_45 HotSpot(TM) 64-Bit 1.8.0_45-b14 + Timezone: Europe/Berlin + Built with: Docker version 1.7.0, build 0baf609 + + FROM ubuntu:vivid-20150611 + Python: 2.7.9 + Digest: sha256:311e42f1253868dd10208e4153b2a9419dadf8e6ce4ef31cbf200604ac9e22b8 + Image ID: 9a8d735a5e1ed22728426fb5cdd696215f382c74487f9616cfa3b67f31e735dc @@ -79,6 +103,7 @@ Note image ids also change after scm-source.json has being updated which trigger + Java: 1.8.0_45 HotSpot(TM) 64-Bit 1.8.0_45-b14 + Timezone: Europe/Berlin + Built with: Docker version 1.7.0, build 0baf609 + + FROM ubuntu:vivid-20150611 + Python: 2.7.9 + Digest: sha256:8d67d3d15dfd449e94433de46c352ff135f38678ebd6e217b613e7f1770d5490 + Image ID: 247b69cbd53ef323b117362fd8bb7510276c5e9a702d15e8573223b0467538fb diff --git a/Dockerfile b/Dockerfile index b4327a58..55fe60e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -593,109 +593,105 @@ RUN cd ${NORMAL_USER_HOME}/firefox-src \ ;done \ && chown -R ${NORMAL_USER}:${NORMAL_GROUP} ${SEL_HOME} -ENV FIREFOX_VERSIONS "${FIREFOX_VERSIONS1}, ${FIREFOX_VERSIONS2}, ${FIREFOX_VERSIONS3}" - -#=================================== -# Firefox version to use during run -#=================================== -# For firefox please pick one of $FIREFOX_VERSIONS, default latest -ENV FIREFOX_VERSION ${FIREFOX_LATEST_VERSION} - #================= # Supervisor conf #================= ADD supervisor/etc/supervisor/supervisord.conf /etc/supervisor/ ADD **/etc/supervisor/conf.d/* /etc/supervisor/conf.d/ -#================== -# User & ssh stuff -#================== +#====== +# User +#====== USER ${NORMAL_USER} -ENV USER ${NORMAL_USER} -ENV HOME ${NORMAL_USER_HOME} -ENV VNC_STORE_PWD_FILE ${HOME}/.vnc/passwd - -#======================================================================== -# Some configuration options that can be customized at container runtime -#======================================================================== -ENV BIN_UTILS /bin-utils -ENV PATH ${PATH}:${BIN_UTILS} -# JVM uses only 1/4 of system memory by default -ENV MEM_JAVA_PERCENT 80 -# Max amount of time to wait for other processes dependencies -ENV WAIT_TIMEOUT 5s -ENV SCREEN_WIDTH 1900 -ENV SCREEN_HEIGHT 1480 -ENV SCREEN_MAIN_DEPTH 24 -ENV SCREEN_DEPTH ${SCREEN_MAIN_DEPTH}+32 -ENV DISP_N 10 -ENV DISPLAY :${DISP_N} -ENV XEPHYR_DISPLAY :${DISP_N} -ENV SCREEN_NUM 0 -# ENV XEPHYR_SCREEN_SIZE "${SCREEN_WIDTH}""x""${SCREEN_HEIGHT}""" -# Even though you can change them below, don't worry too much about container -# internal ports since you can map them to the host via `docker run -p` -ENV SELENIUM_PORT 24444 -ENV SELENIUM_HUB_PORT ${SELENIUM_PORT} -# You may want to connect to another hub -ENV SELENIUM_HUB_HOST 127.0.0.1 -ENV SELENIUM_NODE_HOST 127.0.0.1 -ENV SELENIUM_NODE_CH_PORT 25550 -ENV SELENIUM_NODE_FF_PORT 25551 -# Selenium additional params: -ENV SELENIUM_HUB_PARAMS "" -ENV SELENIUM_NODE_PARAMS "" -# Selenium capabilities descriptive (to avoid opera/ie warnings) -# docs at https://code.google.com/p/selenium/wiki/Grid2 -ENV MAX_INSTANCES 1 -ENV MAX_SESSIONS 1 -ENV SEL_RELEASE_TIMEOUT_SECS 9000 -ENV SEL_BROWSER_TIMEOUT_SECS 6000 -ENV SEL_CLEANUPCYCLE_MS 70000 -ENV SEL_NODEPOLLING_MS 60000 -# Vnc -ENV VNC_PORT 25900 -ENV NOVNC_PORT 26080 -# You can set the VNC password or leave null so a random password is generated: -# ENV VNC_PASSWORD topsecret -ENV SSHD_PORT 22222 -# Supervisor (process management) http server -ENV SUPERVISOR_HTTP_PORT 29001 -ENV SUPERVISOR_HTTP_USERNAME supervisorweb -ENV SUPERVISOR_HTTP_PASSWORD somehttpbasicauthpwd -ENV SUPERVISOR_REQUIRED_SRV_LIST "vnc|novnc|sshd|selenium-hub|selenium-node-chrome|selenium-node-firefox|xmanager|xterm|xvfb" -# Supervisor loglevel and also general docker log level -# can be: debug, warn, trace, info -ENV LOG_LEVEL info -ENV LOGFILE_MAXBYTES 10MB -ENV LOGFILE_BACKUPS 5 -# Logs are now managed by supervisord.conf, see -# ${LOGS_DIR}/*.log -ENV LOGS_DIR /var/log/sele -# ENV VIDEO_FORMAT xxxx -# Encoding movie type "flv", "swf5", "swf7", "mpeg" (PyMedia required) -# or "vnc" more info at http://www.unixuser.org/~euske/vnc2swf/pyvnc2swf.html -ENV VNC2SWF_ENCODING swf5 -# Specifies the framerate in fps. (default=12.0). Reducing the frame rate -# sometimes helps reducing the movie size. -ENV VNC2SWF_FRAMERATE 25 -# ffmpeg encoding options -ENV FFMPEG_FRAME_RATE 25 -# ENV FFMPEG_CODEC_ARGS "-vcodec libx264 -vpre lossless_ultrafast -threads 0" -ENV FFMPEG_CODEC_ARGS "" -# Video recording on container create -ENV VIDEO false -# Video file and extension, e.g. swf, mp4 -ENV VIDEO_FILE_EXTENSION "mkv" -ENV VIDEO_FILE_NAME "test" -ENV VIDEOS_DIR "${NORMAL_USER_HOME}/videos" -ENV VIDEO_LOG_FILE "${LOGS_DIR}/video-rec-stdout.log" -ENV VIDEO_PIDFILE "${RUN_DIR}/video.pid" -#=============================== -# Run docker from inside docker -# Usage: docker run -v /var/run/docker.sock:/var/run/docker.sock -# -v $(which docker):$(which docker) -ENV DOCKER_SOCK "/var/run/docker.sock" + +#====== +# Envs +#====== +ENV FIREFOX_VERSIONS="${FIREFOX_VERSIONS1}, ${FIREFOX_VERSIONS2}, ${FIREFOX_VERSIONS3}" \ + # Firefox version to use during run + # For firefox please pick one of $FIREFOX_VERSIONS, default latest + FIREFOX_VERSION=${FIREFOX_LATEST_VERSION} \ + # User and home + USER="${NORMAL_USER}" \ + HOME="${NORMAL_USER_HOME}" \ + # Vnc password file + VNC_STORE_PWD_FILE="${NORMAL_USER_HOME}/.vnc/passwd" \ + BIN_UTILS="/bin-utils" \ + # JVM uses only 1/4 of system memory by default + MEM_JAVA_PERCENT=80 \ + # Max amount of time to wait for other processes dependencies + WAIT_TIMEOUT="5s" \ + SCREEN_WIDTH=1900 \ + SCREEN_HEIGHT=1480 \ + SCREEN_MAIN_DEPTH=24 \ + SCREEN_SUB_DEPTH=32 \ + # Display number; see entry.sh for $DISPLAY + DISP_N=10 \ + SCREEN_NUM=0 \ + # ENV XEPHYR_SCREEN_SIZE "${SCREEN_WIDTH}""x""${SCREEN_HEIGHT}""" + # Even though you can change them below, don't worry too much about container + # internal ports since you can map them to the host via `docker run -p` + SELENIUM_HUB_PORT=24444 \ + # You may want to connect to another hub + SELENIUM_HUB_HOST="127.0.0.1" \ + SELENIUM_NODE_HOST="127.0.0.1" \ + SELENIUM_NODE_CH_PORT=25550 \ + SELENIUM_NODE_FF_PORT=25551 \ + # Selenium additional params: + SELENIUM_HUB_PARAMS="" \ + SELENIUM_NODE_PARAMS="" \ + # Selenium capabilities descriptive (to avoid opera/ie warnings) + # docs at https://code.google.com/p/selenium/wiki/Grid2 + MAX_INSTANCES=1 \ + MAX_SESSIONS=1 \ + SEL_RELEASE_TIMEOUT_SECS=9000 \ + SEL_BROWSER_TIMEOUT_SECS=6000 \ + SEL_CLEANUPCYCLE_MS=70000 \ + SEL_NODEPOLLING_MS=60000 \ + # Vnc + VNC_PORT=25900 \ + NOVNC_PORT=26080 \ + # You can set the VNC password or leave null so a random password is generated: + # ENV VNC_PASSWORD topsecret + SSHD_PORT=22222 \ + # Supervisor (process management) http server + SUPERVISOR_HTTP_PORT=29001 \ + SUPERVISOR_HTTP_USERNAME=supervisorweb \ + SUPERVISOR_HTTP_PASSWORD=somehttpbasicauthpwd \ + SUPERVISOR_REQUIRED_SRV_LIST="vnc|novnc|sshd|xmanager|xvfb" \ + # Supervisor loglevel and also general docker log level + # can be: debug, warn, trace, info + LOG_LEVEL=info \ + LOGFILE_MAXBYTES=10MB \ + LOGFILE_BACKUPS=5 \ + # Logs are now managed by supervisord.conf, see + # ${LOGS_DIR}/*.log + LOGS_DIR="/var/log/sele" \ + # ENV VIDEO_FORMAT xxxx + # Encoding movie type "flv", "swf5", "swf7", "mpeg" (PyMedia required) + # or "vnc" more info at http://www.unixuser.org/~euske/vnc2swf/pyvnc2swf.html + VNC2SWF_ENCODING=swf5 \ + # Specifies the framerate in fps. (default=12.0). Reducing the frame rate + # sometimes helps reducing the movie size. + VNC2SWF_FRAMERATE=25 \ + # ffmpeg encoding options + FFMPEG_FRAME_RATE=25 \ + # ENV FFMPEG_CODEC_ARGS "-vcodec libx264 -vpre lossless_ultrafast -threads 0" + FFMPEG_CODEC_ARGS="" \ + # Services to start by default; true/false + VIDEO=false \ + GRID=true \ + CHROME=true \ + FIREFOX=true \ + # Video file and extension, e.g. swf, mp4, mkv, flv + VIDEO_FILE_EXTENSION="mkv" \ + VIDEO_FILE_NAME="test" \ + VIDEOS_DIR="${NORMAL_USER_HOME}/videos" \ + #=============================== + # Run docker from inside docker + # Usage: docker run -v /var/run/docker.sock:/var/run/docker.sock + # -v $(which docker):$(which docker) + DOCKER_SOCK="/var/run/docker.sock" #================================ # Expose Container's Directories @@ -704,7 +700,7 @@ ENV DOCKER_SOCK "/var/run/docker.sock" # Only expose ssh port given the other services are not secured # forcing the user to open ssh tunnels or use docker run -p ports... -# EXPOSE ${SELENIUM_PORT} ${VNC_PORT} ${SSHD_PORT} ${TOMCAT_PORT} +# EXPOSE ${SELENIUM_HUB_PORT} ${VNC_PORT} ${SSHD_PORT} ${TOMCAT_PORT} EXPOSE ${SSHD_PORT} #================ @@ -737,7 +733,8 @@ RUN mkdir -p ${NORMAL_USER_HOME}/.vnc \ && sudo chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix \ # To avoid error "Missing privilege separation directory: /var/run/sshd" && sudo mkdir -p /var/run/sshd \ - && sudo chmod 744 /var/run/sshd + && sudo chmod 744 /var/run/sshd \ + && echo "" #===================================================== # Meta JSON file to hold commit info of current build @@ -753,5 +750,5 @@ RUN [ $(find ./ -mtime -1 -type f -name "scm-source.json" 2>/dev/null) ] \ # CMD or ENTRYPOINT #=================== # ENTRYPOINT ["entry.sh"] -CMD ["entry.sh"] # CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"] +CMD ["/bin-utils/entry.sh"] diff --git a/README.md b/README.md index a1ed353e..a32ddff4 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Note SeleniumHQ/docker-selenium project is more useful for building selenium gri In general: add `sudo` only if needed in your environment and `--privileged` if you really need it. sudo docker run --privileged -p 4444:24444 -p 5920:25900 \ - -e VNC_PASSWORD=hola elgalu/selenium:v2.46.0-00 + -e VNC_PASSWORD=hola elgalu/selenium:v2.46.0-01 ### Non-privileged ### Run @@ -31,7 +31,7 @@ If your setup is correct, privileged mode and sudo should not be necessary: -e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080 \ -e VNC_PASSWORD=hola \ -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" \ - elgalu/selenium:v2.46.0-00 + elgalu/selenium:v2.46.0-01 Make sure `docker run` finishes with **selenium all done and ready for testing** else you won't be able to start your tests. To perform this check programatically please use this command where `ch` is the name of the container: @@ -86,9 +86,36 @@ If the VNC password was randomly generated find out with docker exec ch grep "was generated for you:" /var/log/sele/vnc-stdout.log #=> a VNC password was generated for you: ooGhai0aesaesh +## Grid +## Hub + +You can lunch a grid only container via environment variables: + + docker run --rm --name=hub -p 4444:24444 -p 5930:25900 -p 2223:22222 \ + -p=6081:26080 -e CHROME=false -e FIREFOX=false \ + elgalu/selenium:v2.46.0-01 + +The important part above is `-e CHROME=false -e FIREFOX=false` which tells the docker image not run run default chorme and firefox nodes turning the container into a grid-only one. + +## Node + +You can lunch a node only container via environment variables: + + docker run --rm --name=node -p=5940:25900 -p=2224:22222 -p=6082:26080 \ + -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" -e VIDEO=true \ + -e SELENIUM_HUB_HOST=10.161.128.170 \ + -e SELENIUM_HUB_PORT=4444 \ + -e SELENIUM_NODE_HOST=10.161.128.170 \ + -p 25550:25550 -p 25551:25551 \ + -e GRID=false -e CHROME=true -e FIREFOX=true \ + -v $(pwd)/videos:/videos \ + elgalu/selenium:v2.46.0-01 + +The important part above is `-e GRID=false` which tells the container to be a node-only node, this this case with 2 browsers `-e CHROME=true -e FIREFOX=true` but could be just 1. + ## Security -Starting version [v2.46.0-00][] the file [scm-source.json](./scm-source.json) is included at the root directory of the generated image with information that helps to comply with auditing requirements to trace the creation of this docker image. +Starting version [v2.46.0-01][] the file [scm-source.json](./scm-source.json) is included at the root directory of the generated image with information that helps to comply with auditing requirements to trace the creation of this docker image. Note [scm-source.json](./scm-source.json) file will always be 1 commit outdated in the repo but will be correct inside the container. @@ -106,17 +133,17 @@ There are also additional steps you can take to ensure you're using the correct ### Option 1 - Use immutable image digests Given docker.io currently allows to push the same tag image twice this represent a security concern but since docker >= 1.6.2 is possible to fetch the digest sha256 instead of the tag so you can be sure you're using the exact same docker image every time: - # e.g. sha256 for tag v2.46.0-00 - export SHA=94c0e3992501db24a5a07cba516d8e7e32ac419ea7accae915275eb58dd389d5 + # e.g. sha256 for tag v2.46.0-01 + export SHA=TBD docker pull elgalu/selenium@sha256:${SHA} ### Option 2 - Check the Full Image Id Verify that image id is indeed correct - # e.g. full image id for tag v2.46.0-00 - export IMGID=a8bc01890482646e82188ecd84b799fb2e7a1588f7627779b16735ed55d4f40c - if docker inspect -f='{{.Id}}' elgalu/selenium:v2.46.0-00 |grep ${IMGID} &> /dev/null; then + # e.g. full image id for tag v2.46.0-01 + export IMGID=TBD + if docker inspect -f='{{.Id}}' elgalu/selenium:v2.46.0-01 |grep ${IMGID} &> /dev/null; then echo "Image ID tested ok" else echo "Image ID doesn't match" @@ -138,7 +165,7 @@ Host machine, terminal 2: docker run --rm --name=ch -p=4470:24444 \ -e SCREEN_WIDTH -e SCREEN_HEIGHT -e XE_DISP_NUM \ -v /tmp/.X11-unix/X${XE_DISP_NUM}:/tmp/.X11-unix/X${XE_DISP_NUM} \ - elgalu/selenium:v2.46.0-00 + elgalu/selenium:v2.46.0-01 Now when you run your tests instead of connecting. If docker run fails try `xhost +` @@ -160,7 +187,7 @@ ANYPORT=0 REMOTE_DOCKER_SRV=localhost CONTAINER=$(docker run -d -p=0.0.0.0:${ANYPORT}:22222 -p=0.0.0.0:${ANYPORT}:24444 \ -p=0.0.0.0:${ANYPORT}:25900 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola \ - -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:v2.46.0-00 + -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:v2.46.0-01 # -- Option 2.docker run- Running docker on remote docker server like in the cloud # Useful if the docker server is running in the cloud. Establish free local ports @@ -170,7 +197,7 @@ ssh ${REMOTE_DOCKER_SRV} #get into the remote docker provider somehow # it acts as a jump host so my public key is already on that server CONTAINER=$(docker run -d -p=0.0.0.0:${ANYPORT}:22222 -e SCREEN_HEIGHT=1110 \ -e VNC_PASSWORD=hola -e SSH_AUTH_KEYS="$(cat ~/.ssh/authorized_keys)" \ - elgalu/selenium:v2.46.0-00 + elgalu/selenium:v2.46.0-01 # -- Common: Wait for the container to start while ! docker exec ch grep 'all done and ready for testing' \ @@ -242,7 +269,7 @@ If you git clone this repo locally, i.e. cd into where the Dockerfile is, you ca If you prefer to download the final built image from docker you can pull it, personally I always prefer to build them manually except for the base images like Ubuntu 14.04.2: - docker pull elgalu/selenium:v2.46.0-00 + docker pull elgalu/selenium:v2.46.0-01 #### 2. Use this image @@ -312,4 +339,4 @@ Container leaves a few logs files to see what happened: /tmp/local-sel-headless.log /tmp/selenium-server-standalone.log -[v2.46.0-00]: https://github.com/elgalu/docker-selenium/releases/tag/v2.46.0-00 +[v2.46.0-01]: https://github.com/elgalu/docker-selenium/releases/tag/v2.46.0-01 diff --git a/READMELeo.md b/READMELeo.md index b0bc2a7f..97a4d052 100644 --- a/READMELeo.md +++ b/READMELeo.md @@ -1,7 +1,7 @@ ## Build - time (docker build -t="elgalu/selenium:v2.46.0-00" . ;echo $?;beep) - docker run --rm -ti --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -p=6080:26080 -p=29001:29001 -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" -e VNC_PASSWORD=hola -v /var/log/sele elgalu/selenium:v2.46.0-00 + time (docker build -t="elgalu/selenium:v2.46.0-01" . ;echo $?;beep) + docker run --rm -ti --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -p=6080:26080 -p=29001:29001 -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" -e VNC_PASSWORD=hola -v /var/log/sele elgalu/selenium:v2.46.0-01 See logs @@ -9,7 +9,7 @@ See logs Testing in ssh lgallucci@10.160.26.62 - docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -e SSH_AUTH_KEYS="$(cat ~/.ssh/authorized_keys)" -e VNC_PASSWORD=Hola3 os-registry.stups.zalan.do/tip/selenium:v2.46.0-00 + docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -e SSH_AUTH_KEYS="$(cat ~/.ssh/authorized_keys)" -e VNC_PASSWORD=Hola3 os-registry.stups.zalan.do/tip/selenium:v2.46.0-01 ## Transfer used browser source artifacts to keep them in the cloud @@ -32,18 +32,18 @@ List firefox versions via docker exe ## To update image id and digest - docker inspect -f='{{.Id}}' elgalu/selenium:v2.46.0-00 + docker inspect -f='{{.Id}}' elgalu/selenium:v2.46.0-01 docker images --digests ## Run with shared dir docker run --rm --name=ch -p=127.0.0.1:4460:24444 -p=127.0.0.1:5910:25900 \ - -v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.46.0-00 + -v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.46.0-01 docker run --rm --name=ch -p=4460:24444 -p=5910:25900 \ - -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) elgalu/selenium:v2.46.0-00 + -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) elgalu/selenium:v2.46.0-01 - docker run --rm --name=ff -p=127.0.0.1:4461:24444 -p=127.0.0.1:5911:25900 -v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.46.0-00 + docker run --rm --name=ff -p=127.0.0.1:4461:24444 -p=127.0.0.1:5911:25900 -v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.46.0-01 ## Run without shared dir and bind ports to all network interfaces @@ -66,11 +66,11 @@ List firefox versions via docker exe ## Run without dir and bind to all interfaces Note anything after the image will be taken as arguments for the cmd/entrypoint - docker run --rm --name=ch -p=0.0.0.0:8813:8484 -p=0.0.0.0:2222:2222 -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 -e SCREEN_WIDTH=1800 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:v2.46.0-00 + docker run --rm --name=ch -p=0.0.0.0:8813:8484 -p=0.0.0.0:2222:2222 -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 -e SCREEN_WIDTH=1800 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:v2.46.0-01 - docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola elgalu/selenium:v2.46.0-00 - docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola docker.io/elgalu/selenium:v2.46.0-00 - docker run --rm --name=ch -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 --add-host myserver.dev:172.17.42.1 elgalu/selenium:v2.46.0-00 + docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola elgalu/selenium:v2.46.0-01 + docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola docker.io/elgalu/selenium:v2.46.0-01 + docker run --rm --name=ch -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 --add-host myserver.dev:172.17.42.1 elgalu/selenium:v2.46.0-01 However adding a custom host IP to server-selenium.local (e.g. bsele ssh config) is more work: @@ -79,7 +79,7 @@ However adding a custom host IP to server-selenium.local (e.g. bsele ssh config) vncv localhost:5920 -Scaling=60% & - docker run --rm --name=ff -p=0.0.0.0:4471:24444 -p=0.0.0.0:5921:25900 elgalu/selenium:v2.46.0-00 + docker run --rm --name=ff -p=0.0.0.0:4471:24444 -p=0.0.0.0:5921:25900 elgalu/selenium:v2.46.0-01 Automatic builds not working for me right now, maybe there is an issue with docker registry v1 vs v2 https://registry.hub.docker.com/u/elgalu/docker-selenium/builds_history/31621/ @@ -87,24 +87,24 @@ https://registry.hub.docker.com/u/elgalu/docker-selenium/builds_history/31621/ ## Push version docker login - docker push docker.io/elgalu/selenium:v2.46.0-00 ;echo $?;beep - docker tag elgalu/selenium:v2.46.0-00 elgalu/selenium:latest + docker push docker.io/elgalu/selenium:v2.46.0-01 ;echo $?;beep + docker tag elgalu/selenium:v2.46.0-01 elgalu/selenium:latest docker push docker.io/elgalu/selenium:latest Not working maybe because it has automated builds enabled but then it fails in the cloud but works locally https://registry.hub.docker.com/u/elgalu/selenium/tags/manage/ - docker push elgalu/selenium:v2.46.0-00 - docker push elgalu/docker-selenium:v2.46.0-00 - docker push docker.io/elgalu/docker-selenium:v2.46.0-00 + docker push elgalu/selenium:v2.46.0-01 + docker push elgalu/docker-selenium:v2.46.0-01 + docker push docker.io/elgalu/docker-selenium:v2.46.0-01 ## Pulling - docker pull registry.hub.docker.com/elgalu/selenium:v2.46.0-00 + docker pull registry.hub.docker.com/elgalu/selenium:v2.46.0-01 ## Pull - docker run -d --name=max -p=0.0.0.0:4411:24444 -p=0.0.0.0:5911:25900 elgalu/selenium:v2.46.0-00 + docker run -d --name=max -p=0.0.0.0:4411:24444 -p=0.0.0.0:5911:25900 elgalu/selenium:v2.46.0-01 How to connect through vnc (need a vnc client) diff --git a/bin/entry.sh b/bin/entry.sh index 8d94daf9..9469517e 100755 --- a/bin/entry.sh +++ b/bin/entry.sh @@ -6,7 +6,13 @@ set -e #--------------------- # Fix/extend ENV vars #--------------------- +export PATH="${PATH}:${BIN_UTILS}" +export DISPLAY=":${DISP_N}" +export XEPHYR_DISPLAY=":${DISP_N}" +export VIDEO_LOG_FILE="${LOGS_DIR}/video-rec-stdout.log" +export VIDEO_PIDFILE="${RUN_DIR}/video.pid" # We recalculate screen dimensions because docker run supports changing them +export SCREEN_DEPTH="${SCREEN_MAIN_DEPTH}+${SCREEN_SUB_DEPTH}" export GEOMETRY="${SCREEN_WIDTH}""x""${SCREEN_HEIGHT}""x""${SCREEN_DEPTH}" # These values are only available when the container started export DOCKER_HOST_IP=$(netstat -nr | grep '^0\.0\.0\.0' | awk '{print $2}') @@ -23,6 +29,15 @@ export HOST_UID=$(stat -c "%u" ${VIDEOS_DIR}) # Video export VIDEO_PATH="${VIDEOS_DIR}/${VIDEO_FILE_NAME}.${VIDEO_FILE_EXTENSION}" export FFMPEG_FRAME_SIZE="${SCREEN_WIDTH}x${SCREEN_HEIGHT}" +# Extend required services depending on what the user needs +[ "${GRID}" = "true" ] && export \ + SUPERVISOR_REQUIRED_SRV_LIST="${SUPERVISOR_REQUIRED_SRV_LIST}|selenium-hub" +[ "${CHROME}" = "true" ] && export \ + SUPERVISOR_REQUIRED_SRV_LIST="${SUPERVISOR_REQUIRED_SRV_LIST}|selenium-node-chrome" +[ "${FIREFOX}" = "true" ] && export \ + SUPERVISOR_REQUIRED_SRV_LIST="${SUPERVISOR_REQUIRED_SRV_LIST}|selenium-node-firefox" +[ "${VIDEO}" = "true" ] && export \ + SUPERVISOR_REQUIRED_SRV_LIST="${SUPERVISOR_REQUIRED_SRV_LIST}|video-rec" #-------------------------------- # Improve etc/hosts and fix dirs diff --git a/selenium-hub/bin/wait-selenium-hub.sh b/selenium-hub/bin/wait-selenium-hub.sh index 11c8f2ce..6767bac6 100755 --- a/selenium-hub/bin/wait-selenium-hub.sh +++ b/selenium-hub/bin/wait-selenium-hub.sh @@ -3,14 +3,17 @@ # Exit immediately if a command exits with a non-zero status set -e -echo "Waiting for Selenium Hub to be ready..." -# This is annoying but json endpoint /wd/hub/status returns different things -# - on grid/hub .status should be 13 -# - on node .state should be "success" -while ! curl -s "http://localhost:${SELENIUM_HUB_PORT}/wd/hub/status" \ - | jq '.status' | grep "13"; do - echo -n '.' - sleep 0.1 -done - -echo "Done wait-selenium-hub.sh" +if [ "${GRID}" = "true" ]; then + echo "Waiting for Selenium Hub to be ready..." + # This is annoying but json endpoint /wd/hub/status returns different things + # - on grid/hub .status should be 13 + # - on node .state should be "success" + while ! curl -s "http://localhost:${SELENIUM_HUB_PORT}/wd/hub/status" \ + | jq '.status' | grep "13"; do + echo -n '.' + sleep 0.1 + done + echo "Done wait-selenium-hub.sh" +else + echo "Won't start selenium node chrome due to GRID env var false" +fi diff --git a/selenium-hub/etc/supervisor/conf.d/selenium-hub.conf b/selenium-hub/etc/supervisor/conf.d/selenium-hub.conf index 205c3beb..325a9dac 100644 --- a/selenium-hub/etc/supervisor/conf.d/selenium-hub.conf +++ b/selenium-hub/etc/supervisor/conf.d/selenium-hub.conf @@ -16,7 +16,7 @@ command=%(ENV_BIN_UTILS)s/start-selenium-hub.sh ;If true, this program will start automatically when supervisord is started. ;default=true -autostart=true +autostart=%(ENV_GRID)s ;If false, the process will never be autorestarted. ;If true, the process will be unconditionally restarted when it exits, diff --git a/selenium-node-chrome/bin/wait-selenium-node-chrome.sh b/selenium-node-chrome/bin/wait-selenium-node-chrome.sh index 91346c45..6a309388 100755 --- a/selenium-node-chrome/bin/wait-selenium-node-chrome.sh +++ b/selenium-node-chrome/bin/wait-selenium-node-chrome.sh @@ -3,14 +3,17 @@ # Exit immediately if a command exits with a non-zero status set -e -echo "Waiting for Selenium Node Chrome to be ready..." -# This is annoying but json endpoint /wd/hub/status returns different things -# - on grid/hub .status should be 13 -# - on node .state should be "success" -while ! curl -s "http://localhost:${SELENIUM_NODE_CH_PORT}/wd/hub/status" \ - | jq '.state' | grep "success"; do - echo -n '.' - sleep 0.1 -done - -echo "Done wait-selenium-node-chrome.sh" +if [ "${CHROME}" = "true" ]; then + echo "Waiting for Selenium Node Chrome ${CHROME_FLAVOR} to be ready..." + # This is annoying but json endpoint /wd/hub/status returns different things + # - on grid/hub .status should be 13 + # - on node .state should be "success" + while ! curl -s "http://localhost:${SELENIUM_NODE_CH_PORT}/wd/hub/status" \ + | jq '.state' | grep "success"; do + echo -n '.' + sleep 0.1 + done + echo "Done wait-selenium-node-chrome-${CHROME_FLAVOR}.sh" +else + echo "Won't start selenium node chrome due to CHROME env var false" +fi diff --git a/selenium-node-chrome/etc/supervisor/conf.d/selenium-node-chrome.conf b/selenium-node-chrome/etc/supervisor/conf.d/selenium-node-chrome.conf index c9a07184..5c429ac4 100644 --- a/selenium-node-chrome/etc/supervisor/conf.d/selenium-node-chrome.conf +++ b/selenium-node-chrome/etc/supervisor/conf.d/selenium-node-chrome.conf @@ -16,7 +16,7 @@ command=%(ENV_BIN_UTILS)s/start-selenium-node-chrome.sh ;If true, this program will start automatically when supervisord is started. ;default=true -autostart=true +autostart=%(ENV_CHROME)s ;If false, the process will never be autorestarted. ;If true, the process will be unconditionally restarted when it exits, diff --git a/selenium-node-firefox/bin/wait-selenium-node-firefox.sh b/selenium-node-firefox/bin/wait-selenium-node-firefox.sh index a24c0f78..9c1ef8e6 100755 --- a/selenium-node-firefox/bin/wait-selenium-node-firefox.sh +++ b/selenium-node-firefox/bin/wait-selenium-node-firefox.sh @@ -3,8 +3,7 @@ # Exit immediately if a command exits with a non-zero status set -e -# export SELENIUM_NODE_FF_PORT=$((SELENIUM_NODE_FF_BASE_PORT-1)) -# for FIREFOX_VERSION in $(echo ${FIREFOX_VERSIONS} | tr "," "\n"); do +if [ "${FIREFOX}" = "true" ]; then echo "Waiting for Selenium Node Firefox ${FIREFOX_VERSION} to be ready..." # This is annoying but json endpoint /wd/hub/status returns different things # - on grid/hub .status should be 13 @@ -15,5 +14,6 @@ set -e sleep 0.1 done echo "Done wait-selenium-node-firefox-${FIREFOX_VERSION}" -# done -# echo "Done wait-selenium-node-firefox.sh" +else + echo "Won't start selenium node firefox due to FIREFOX env var false" +fi diff --git a/selenium-node-firefox/etc/supervisor/conf.d/selenium-node-firefox.conf b/selenium-node-firefox/etc/supervisor/conf.d/selenium-node-firefox.conf index 72e29a0b..227f378e 100644 --- a/selenium-node-firefox/etc/supervisor/conf.d/selenium-node-firefox.conf +++ b/selenium-node-firefox/etc/supervisor/conf.d/selenium-node-firefox.conf @@ -16,7 +16,7 @@ command=%(ENV_BIN_UTILS)s/start-selenium-node-firefox.sh ;If true, this program will start automatically when supervisord is started. ;default=true -autostart=true +autostart=%(ENV_FIREFOX)s ;If false, the process will never be autorestarted. ;If true, the process will be unconditionally restarted when it exits, diff --git a/video-rec/bin/wait-video-rec.sh b/video-rec/bin/wait-video-rec.sh index b2b92afe..d610abdd 100755 --- a/video-rec/bin/wait-video-rec.sh +++ b/video-rec/bin/wait-video-rec.sh @@ -3,18 +3,21 @@ # Exit immediately if a command exits with a non-zero status set -e -# -- Wait for vnc2swf to connect -- # -# echo "Waiting for vnc2swf video recording to start..." -# while ! grep "Connected:" ${VIDEO_LOG_FILE} >/dev/null; do -# echo -n '.' -# sleep 0.2; -# done +if [ "${VIDEO}" = "true" ]; then + # -- Wait for vnc2swf to connect -- # + # echo "Waiting for vnc2swf video recording to start..." + # while ! grep "Connected:" ${VIDEO_LOG_FILE} >/dev/null; do + # echo -n '.' + # sleep 0.2; + # done -# -- Wait for ffmpeg to connect -- # -echo "Waiting for ffmpeg video recording to start..." -while ! grep "Stream mapping:" ${VIDEO_LOG_FILE} >/dev/null; do - echo -n '.' - sleep 0.2; -done - -echo "Video ${VIDEO_PATH} started to be recorded! (wait-video-rec.sh)" + # -- Wait for ffmpeg to connect -- # + echo "Waiting for ffmpeg video recording to start..." + while ! grep "Stream mapping:" ${VIDEO_LOG_FILE} >/dev/null; do + echo -n '.' + sleep 0.2; + done + echo "Video ${VIDEO_PATH} started to be recorded! (wait-video-rec.sh)" +else + echo "Won't start video recording due to VIDEO env var false" +fi diff --git a/xterm/bin/start-xterm.sh b/xterm/bin/start-xterm.sh index d0fda98b..35d55f71 100755 --- a/xterm/bin/start-xterm.sh +++ b/xterm/bin/start-xterm.sh @@ -29,14 +29,22 @@ shutdown () { # http://www.gnu.org/software/coreutils/manual/coreutils.html#timeout-invocation # Wait for everyone to be done -timeout --foreground ${WAIT_TIMEOUT} wait-xvfb.sh || shutdown +timeout --foreground ${WAIT_TIMEOUT} wait-xvfb.sh || shutdown \ + "Failed while waiting for Xvfb to start!" #TODO: wait-xmanager.sh -timeout --foreground ${WAIT_TIMEOUT} wait-vnc.sh || shutdown -timeout --foreground ${WAIT_TIMEOUT} wait-novnc.sh || shutdown +timeout --foreground ${WAIT_TIMEOUT} wait-vnc.sh || shutdown \ + "Failed while waiting for VNC to start!" +timeout --foreground ${WAIT_TIMEOUT} wait-novnc.sh || shutdown \ + "Failed while waiting for noVNC to start!" #TODO: wait-sshd.sh -timeout --foreground ${WAIT_TIMEOUT} wait-selenium-hub.sh || shutdown -timeout --foreground ${WAIT_TIMEOUT} wait-selenium-node-chrome.sh || shutdown -timeout --foreground ${WAIT_TIMEOUT} wait-selenium-node-firefox.sh || shutdown +timeout --foreground ${WAIT_TIMEOUT} wait-selenium-hub.sh || shutdown \ + "Failed while waiting for selenium hub to start!" +timeout --foreground ${WAIT_TIMEOUT} wait-selenium-node-chrome.sh || shutdown \ + "Failed while waiting for selenium node chrome to start!" +timeout --foreground ${WAIT_TIMEOUT} wait-selenium-node-firefox.sh || shutdown \ + "Failed while waiting for selenium node firefox to start!" +timeout --foreground ${WAIT_TIMEOUT} wait-video-rec.sh || shutdown \ + "Failed while waiting for video recording to start!" # Help at http://supervisord.org/subprocess.html#process-states if supervisorctl -c /etc/supervisor/supervisord.conf status \ @@ -54,13 +62,6 @@ x-terminal-emulator -ls \ -title "x-terminal-emulator" \ & -# If video recording on start, then wait that -if [ "$VIDEO" = "true" ]; then - start-video-rec.sh || shutdown "Failed to start video recording!" - timeout --foreground ${WAIT_TIMEOUT} wait-video-rec.sh || shutdown \ - "Failed while waiting for video recording to start!" -fi - # Join them in 1 bash line to avoid supervisor split them in debug output echo "" \ && echo "Container docker internal IP: $CONTAINER_IP" \ diff --git a/xvfb/bin/start-xvfb.sh b/xvfb/bin/start-xvfb.sh index b70bcd81..a16654ab 100755 --- a/xvfb/bin/start-xvfb.sh +++ b/xvfb/bin/start-xvfb.sh @@ -14,6 +14,7 @@ else # Start the X server that can run on machines with no real display # using Xvfb instead of Xdummy + echo "Will start Xvfb with DISPLAY=${DISPLAY} screen=${SCREEN_NUM} geometry=${GEOMETRY}" Xvfb ${DISPLAY} -screen ${SCREEN_NUM} ${GEOMETRY} -ac -r -cc 4 -accessx \ -xinerama +extension Composite -extension RANDR fi