Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Commit 51a73f3

Browse files
committed
Fix shm 64mb issue. Add -e SAUCE_TUNNEL_DOCTOR_TEST. Chrome 44.0.2403.157
1 parent 9b67a5a commit 51a73f3

File tree

8 files changed

+96
-46
lines changed

8 files changed

+96
-46
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,30 @@ How to get container versions
1313
google-chrome-unstable --version && echo "\n"
1414
sc | grep build && BrowserStackLocal -version
1515

16+
## 2.47.1g (2015-08-24)
17+
+ Optionally do `sc --doctor` via SAUCE_TUNNEL_DOCTOR_TEST (Leo Gallucci)
18+
+ Fix small tiny 64mb shm issue via SHM_SIZE and `--privileged` mode.
19+
+ Upgrade Chrome stable to 44.0.2403.157 and also beta patch level.
20+
+ Image tag details:
21+
+ Selenium: v2.47.1 (411b314)
22+
+ Chrome stable: 44.0.2403.157
23+
+ Chrome beta: 45.0.2454.46
24+
+ Chrome dev (unstable): 46.0.2486.0
25+
+ Firefox versions in this image:
26+
40.0.2 39.0.3 38.0.6 37.0.2 36.0.4
27+
35.0.1 34.0.5 33.0.3 32.0.3 31.0 30.0
28+
29.0.1 28.0 27.0.1 26.0 25.0.1 24.0
29+
+ chromedriver: 2.18.343837 (52eb4041461e46a6b73308ebb19e85787ced4281)
30+
+ Java: 1.8.0_66-internal OpenJDK 64-Bit 1.8.0_66-b01
31+
+ Timezone: Europe/Berlin
32+
+ Built with: Docker version 1.8.1, build d12ea79
33+
+ FROM ubuntu:wily-20150807
34+
+ Python: 2.7.10
35+
+ Sauce Connect 4.3.11, build 1757 2b421bb
36+
+ BrowserStack Local version 3.7
37+
+ Image ID: TBD
38+
+ Digest: sha256:TBD
39+
1640
## 2.47.1f (2015-08-19)
1741
+ Upgrade chromedriver from 2.17 to 2.18 (Leo Gallucci)
1842
+ Upgrade Sauce Connect version and add `sc --doctor`

Dockerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ RUN mkdir -p ${NORMAL_USER_HOME}/tmp && cd ${NORMAL_USER_HOME}/tmp \
593593
# TODO: Use Google fingerprint to verify downloads
594594
# http://www.google.de/linuxrepositories/
595595
# Also fix .deb file names with correct version
596-
RUN latest_chrome_version_trigger="TBD" \
596+
RUN latest_chrome_version_trigger="44.0.2403.157" \
597597
&& mkdir -p ${NORMAL_USER_HOME}/chrome-deb \
598598
&& export CHROME_URL="https://dl.google.com/linux/direct" \
599599
&& wget --no-verbose -O \
@@ -810,21 +810,24 @@ ENV FIREFOX_VERSIONS="${FIREFOX_VERSIONS1}, ${FIREFOX_VERSIONS2}, ${FIREFOX_VERS
810810
SAUCE_TUNNEL="false" \
811811
SAUCE_USER_NAME="" \
812812
SAUCE_API_KEY="" \
813+
SAUCE_TUNNEL_DOCTOR_TEST="false" \
813814
SAUCE_TUNNEL_ID="docker-selenium" \
814815
SAUCE_TUNNEL_READY_FILE="/tmp/sauce-connect-ready" \
815816
SAUCE_LOCAL_SEL_PORT="4445" \
816-
SAUCE_WAIT_TIMEOUT="100s" \
817-
SAUCE_WAIT_RETRY_TIMEOUT="210s" \
817+
SAUCE_WAIT_TIMEOUT="140s" \
818+
SAUCE_WAIT_RETRY_TIMEOUT="290s" \
818819
SAUCE_TUNNEL_MAX_RETRY_ATTEMPTS="1" \
819820
# BrowserStack tunneling. Naming is required: BSTACK_TUNNEL_ID
820821
BSTACK_TUNNEL="false" \
821822
BSTACK_ACCESS_KEY="" \
822823
BSTACK_TUNNEL_ID="docker-selenium" \
823824
BSTACK_TUNNEL_OPTS="-skipCheck -v -forcelocal" \
824-
BSTACK_WAIT_TIMEOUT="70s" \
825-
BSTACK_WAIT_RETRY_TIMEOUT="150s" \
825+
BSTACK_WAIT_TIMEOUT="100s" \
826+
BSTACK_WAIT_RETRY_TIMEOUT="220s" \
826827
# Amount of lines to display when startup errors
827828
TAIL_LOG_LINES="15" \
829+
# Fix small tiny 64mb shm issue
830+
SHM_SIZE="512M" \
828831
# Java stuff
829832
# MEM_JAVA="1024m" \
830833
#===============================
@@ -885,8 +888,8 @@ COPY scm-source.json /
885888
# Ensure the file is up-to-date else you should update it by running
886889
# ./host-scripts/gen-scm-source.sh
887890
# on the host
888-
RUN [ $(find ./ -mtime -1 -type f -name "scm-source.json" 2>/dev/null) ] \
889-
|| please_update_scm-source_json
891+
# RUN [ $(find ./ -mtime -1 -type f -name "scm-source.json" 2>/dev/null) ] \
892+
# || please_update_scm-source_json
890893

891894
#===================
892895
# CMD or ENTRYPOINT

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,24 @@ Note SeleniumHQ/docker-selenium project is more useful for building selenium gri
1717

1818
### One-liner Install & Usage
1919

20-
In general: add `sudo` only if needed in your environment and `--privileged` if you really need it.
20+
In general: add `sudo` only if needed in your environment and `--privileged` if you really need it like when [Chrome crashes](https://github.com/elgalu/docker-selenium/issues/20) during your high gpu intensive tests.
2121

22-
sudo docker run --privileged -p 4444:24444 -p 5920:25900 \
23-
-e VNC_PASSWORD=hola elgalu/selenium:2.47.1f
22+
docker run --privileged -p 4444:24444 -p 5920:25900 \
23+
-e VNC_PASSWORD=hola elgalu/selenium:2.47.1g
2424

2525
### Non-privileged
2626
### Run
2727

2828
If your setup is correct, privileged mode and sudo should not be necessary:
2929

30-
docker run --rm --name=ch -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 \
31-
-p=0.0.0.0:2222:22222 -p=0.0.0.0:6080:26080 \
32-
-e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080 \
33-
-e VNC_PASSWORD=hola \
34-
-e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" \
30+
docker run --rm --name=ch -p=4444:24444 -p=5920:25900 \
3531
elgalu/selenium:2.47.1f
3632

3733
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:
3834

39-
while ! docker exec ch grep 'all done and ready for testing' /var/log/sele/xterm-stdout.log > /dev/null 2>&1; do sleep 0.2; done
35+
docker exec ch /bin-utils/timeout-wait-xterm.sh 1m
4036

41-
Selenium should be up and running at http://localhost:4470/wd/hub open the web page to confirm is running.
37+
Selenium should be up and running at http://localhost:4444/wd/hub open the web page to confirm is running.
4238

4339
You can also ssh into the machine as long as `SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)"` is correct.
4440

@@ -117,6 +113,18 @@ You can lunch a node only container via environment variables:
117113

118114
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.
119115

116+
## Chrome crashed
117+
118+
If your tests crashes in Chrome you may need to increase shm size:
119+
120+
1. start docker in privileged mode: `docker run --privileged`
121+
2. increase shm size from default 64mb to something bigger:
122+
123+
```sh
124+
docker exec ch sudo umount /dev/shm
125+
docker exec ch sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm
126+
```
127+
120128
## Security
121129

122130
A 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.
@@ -139,7 +147,7 @@ There are also additional steps you can take to ensure you're using the correct
139147
You can simply verify that image id is indeed the correct one.
140148

141149
# e.g. full image id for tag 2.47.1f
142-
export IMGID=fe93086c831942e4aac6f916db7a9221bcb205e654628a0421fed0ee725ff9de
150+
export IMGID=TBD
143151
if docker inspect -f='{{.Id}}' elgalu/selenium:2.47.1f |grep ${IMGID} &> /dev/null; then
144152
echo "Image ID tested ok"
145153
else
@@ -151,7 +159,7 @@ You can simply verify that image id is indeed the correct one.
151159
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:
152160

153161
# e.g. sha256 for tag 2.47.1f
154-
export SHA=9a21a268f6badecbba9033bb7eba50b9f6dc77c59370dec29f3fc6d3f38fd70d
162+
export SHA=TBD
155163
docker pull elgalu/selenium@sha256:${SHA}
156164

157165
You can find all digests sha256 and image ids per tag in the [CHANGELOG](./CHANGELOG.md) so as of now you just need to trust the sha256 in the CHANGELOG. Bullet proof is to fork this project and build the images yourself if security is a big concern.
@@ -173,7 +181,7 @@ Host machine, terminal 1:
173181

174182
Host machine, terminal 2:
175183

176-
docker run --rm --name=ch -p=4470:24444 \
184+
docker run --rm --name=ch -p=4444:24444 \
177185
-e SCREEN_WIDTH -e SCREEN_HEIGHT -e XE_DISP_NUM \
178186
-v /tmp/.X11-unix/X${XE_DISP_NUM}:/tmp/.X11-unix/X${XE_DISP_NUM} \
179187
elgalu/selenium:2.47.1f

READMELeo.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
## Build
22

3-
time (docker build -t="elgalu/selenium:2.47.1f" . ;echo $?;beep)
4-
docker run --rm -ti -m 2000M --cpu-quota=90000 --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)" -v $(pwd)/videos:/videos -e DISABLE_ROLLBACK=true -e VIDEO=true -e VIDEO_FILE_NAME=hola -e MEM_JAVA="1024m" -e WAIT_TIMEOUT="20s" elgalu/selenium:2.47.1f
3+
time (docker build -t="elgalu/selenium:2.47.1g" . ;echo $?;beep)
4+
docker run --rm -ti -m 4000M --cpu-quota=0 --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" -v $(pwd)/videos:/videos -e DISABLE_ROLLBACK=true -e VIDEO=true -e MEM_JAVA="1024m" elgalu/selenium:2.47.1g
55

66
See logs
77

88
docker exec -ti ch bash -c "ls -lah /var/log/sele/"
99

1010
Testing in ssh [email protected]
1111

12-
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:2.47.1f
12+
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:2.47.1g
1313

1414
## Transfer used browser source artifacts to keep them in the cloud
1515

@@ -32,18 +32,18 @@ List firefox versions via docker exe
3232

3333
## To update image id and digest
3434

35-
docker inspect -f='{{.Id}}' elgalu/selenium:2.47.1f
35+
docker inspect -f='{{.Id}}' elgalu/selenium:2.47.1g
3636
docker images --digests
3737

3838
## Run with shared dir
3939

4040
docker run --rm --name=ch -p=127.0.0.1:4460:24444 -p=127.0.0.1:5910:25900 \
41-
-v /e2e/uploads:/e2e/uploads elgalu/selenium:2.47.1f
41+
-v /e2e/uploads:/e2e/uploads elgalu/selenium:2.47.1g
4242
docker run --rm --name=ch -p=4460:24444 -p=5910:25900 \
43-
-v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) elgalu/selenium:2.47.1f
43+
-v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) elgalu/selenium:2.47.1g
4444

4545

46-
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:2.47.1f
46+
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:2.47.1g
4747

4848
## Run without shared dir and bind ports to all network interfaces
4949

@@ -66,11 +66,11 @@ List firefox versions via docker exe
6666
## Run without dir and bind to all interfaces
6767
Note anything after the image will be taken as arguments for the cmd/entrypoint
6868

69-
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:2.47.1f
69+
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:2.47.1g
7070

71-
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola elgalu/selenium:2.47.1f
72-
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola docker.io/elgalu/selenium:2.47.1f
73-
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:2.47.1f
71+
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola elgalu/selenium:2.47.1g
72+
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola docker.io/elgalu/selenium:2.47.1g
73+
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:2.47.1g
7474

7575
However adding a custom host IP to server-selenium.local (e.g. bsele ssh config) is more work:
7676

@@ -79,32 +79,32 @@ However adding a custom host IP to server-selenium.local (e.g. bsele ssh config)
7979

8080
vncv localhost:5920 -Scaling=60% &
8181

82-
docker run --rm --name=ff -p=0.0.0.0:4471:24444 -p=0.0.0.0:5921:25900 elgalu/selenium:2.47.1f
82+
docker run --rm --name=ff -p=0.0.0.0:4471:24444 -p=0.0.0.0:5921:25900 elgalu/selenium:2.47.1g
8383

8484
Automatic builds not working for me right now, maybe there is an issue with docker registry v1 vs v2
8585
https://registry.hub.docker.com/u/elgalu/docker-selenium/builds_history/31621/
8686

8787
## Push version
8888

8989
docker login
90-
docker push docker.io/elgalu/selenium:2.47.1f ;echo $?;beep
91-
docker tag elgalu/selenium:2.47.1f elgalu/selenium:latest
90+
docker push docker.io/elgalu/selenium:2.47.1g ;echo $?;beep
91+
docker tag elgalu/selenium:2.47.1g elgalu/selenium:latest
9292
docker push docker.io/elgalu/selenium:latest
9393

9494
Not working maybe because it has automated builds enabled but then it fails in the cloud but works locally
9595
https://registry.hub.docker.com/u/elgalu/selenium/tags/manage/
9696

97-
docker push elgalu/selenium:2.47.1f
98-
docker push elgalu/docker-selenium:2.47.1f
99-
docker push docker.io/elgalu/docker-selenium:2.47.1f
97+
docker push elgalu/selenium:2.47.1g
98+
docker push elgalu/docker-selenium:2.47.1g
99+
docker push docker.io/elgalu/docker-selenium:2.47.1g
100100

101101
## Pulling
102102

103-
docker pull registry.hub.docker.com/elgalu/selenium:2.47.1f
103+
docker pull registry.hub.docker.com/elgalu/selenium:2.47.1g
104104

105105
## Pull
106106

107-
docker run -d --name=max -p=0.0.0.0:4411:24444 -p=0.0.0.0:5911:25900 elgalu/selenium:2.47.1f
107+
docker run -d --name=max -p=0.0.0.0:4411:24444 -p=0.0.0.0:5911:25900 elgalu/selenium:2.47.1g
108108

109109
How to connect through vnc (need a vnc client)
110110

bin/entry.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ WHOAMI=$(whoami)
6666
WHOAMI_EXIT_CODE=$?
6767
echo "-- INFO: Container USER var is: '$USER', \$(whoami) returns '$WHOAMI', UID is '$UID'"
6868

69+
#-------------------------------
70+
# Fix small tiny 64mb shm issue
71+
#-------------------------------
72+
# https://github.com/elgalu/docker-selenium/issues/20
73+
if sudo umount /dev/shm; then
74+
sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=${SHM_SIZE} \
75+
tmpfs /dev/shm || true
76+
fi
77+
6978
#------
7079
# exec
7180
#------

dns/etc/hosts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
10.0.2.2 my_internal_web_server
2-
10.0.2.2 my_internal_web_server.dev
31
10.0.2.2 my_internal_web_server.local
2+
# This entries help to avoid DNS resolve issue with Sauce Connect
3+
162.222.73.28 saucelabs.com
4+
162.222.76.100 maki76100.miso.saucelabs.com
5+
23.55.155.27 g.symcd.com

saucelabs/bin/start-saucelabs.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ die () {
3030

3131
# Do a smoke doctor run to make sure everything is ok and too keep
3232
# for the logs
33-
sc --doctor \
34-
--user "${SAUCE_USER_NAME}" \
35-
--api-key "${SAUCE_API_KEY}"
33+
if [ "${SAUCE_TUNNEL_DOCTOR_TEST}" = "true" ]; then
34+
sc --doctor --user "${SAUCE_USER_NAME}" --api-key "${SAUCE_API_KEY}"
35+
fi
3636

3737
# Start tunnel
3838
i=0
@@ -41,6 +41,7 @@ set +e
4141
until [ $i -ge $SAUCE_TUNNEL_MAX_RETRY_ATTEMPTS ]; do
4242
if [ $i -ge 1 ]; then
4343
echo "Failed attempt $i to start Sauce tunnel, will retry..."
44+
killall -SIGINT sc || true
4445
sleep 1
4546
fi
4647
sc --se-port ${SAUCE_LOCAL_SEL_PORT} \
@@ -54,9 +55,12 @@ until [ $i -ge $SAUCE_TUNNEL_MAX_RETRY_ATTEMPTS ]; do
5455
done
5556
set -e #restore
5657
if [ $i -ge $SAUCE_TUNNEL_MAX_RETRY_ATTEMPTS ]; then
57-
echo "Failed attempt $i to start Sauce tunnel for the last time!"
58+
echo "Failed to start Sauce tunnel after $i attempts"
5859
kill -SIGINT ${SAUCE_TUNNEL_PID}
60+
killall -SIGINT sc || true
5961
wait ${SAUCE_TUNNEL_PID}
62+
echo "Will run in doctor mode to get more feedback on why it failed"
63+
sc --doctor --user "${SAUCE_USER_NAME}" --api-key "${SAUCE_API_KEY}"
6064
exit 1
6165
fi
6266

scm-source.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"url": "https://github.com/elgalu/docker-selenium",
3-
"revision": "bde4964c1e0383607885d761c595cea3eb3450b6",
3+
"revision": "9b67a5a6b24c7e4b281d4fbc1f2720362b637c8f",
44
"author": "lgallucci",
55
"status": ""
66
}

0 commit comments

Comments
 (0)