Skip to content

Commit 0304487

Browse files
committed
Central entry_point.sh for the debug images
1 parent b6ada51 commit 0304487

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

NodeDebug/entry_point.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
source /opt/bin/functions.sh
4+
/opt/bin/generate_config > /home/seluser/selenium/config.json
5+
6+
export GEOMETRY="$SCREEN_WIDTH""x""$SCREEN_HEIGHT""x""$SCREEN_DEPTH"
7+
8+
if [ ! -e /home/seluser/selenium/config.json ]; then
9+
echo No Selenium Node configuration file, the node-base image is not intended to be run directly. 1>&2
10+
exit 1
11+
fi
12+
13+
if [ -z "$HUB_PORT_4444_TCP_ADDR" ]; then
14+
echo Not linked with a running Hub container 1>&2
15+
exit 1
16+
fi
17+
18+
function shutdown {
19+
kill -s SIGTERM $NODE_PID
20+
wait $NODE_PID
21+
}
22+
23+
if [ ! -z "$REMOTE_HOST" ]; then
24+
>&2 echo "REMOTE_HOST variable is *DEPRECATED* in these docker containers. Please use SE_OPTS=\"-host <host> -port <port>\" instead!"
25+
exit 1
26+
fi
27+
28+
if [ ! -z "$SE_OPTS" ]; then
29+
echo "appending selenium options: ${SE_OPTS}"
30+
fi
31+
32+
SERVERNUM=$(get_server_num)
33+
34+
rm -f /tmp/.X*lock
35+
36+
DISPLAY=$DISPLAY \
37+
xvfb-run -n $SERVERNUM --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
38+
java ${JAVA_OPTS} -jar /home/seluser/selenium/selenium-server-standalone.jar \
39+
-role node \
40+
-hub http://$HUB_PORT_4444_TCP_ADDR:$HUB_PORT_4444_TCP_PORT/grid/register \
41+
-nodeConfig /home/seluser/selenium/config.json \
42+
${SE_OPTS} &
43+
NODE_PID=$!
44+
45+
trap shutdown SIGTERM SIGINT
46+
for i in $(seq 1 10)
47+
do
48+
xdpyinfo -display $DISPLAY >/dev/null 2>&1
49+
if [ $? -eq 0 ]; then
50+
break
51+
fi
52+
echo Waiting xvfb...
53+
sleep 0.5
54+
done
55+
56+
fluxbox -display $DISPLAY &
57+
58+
x11vnc -forever -usepw -shared -rfbport 5900 -display $DISPLAY &
59+
60+
wait $NODE_PID

NodeDebug/generate.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ cat ./README.template.md \
2121
| sed "s/##FOLDER##/$1/" > $FOLDER/README.md
2222

2323
cp ./README-short.txt $FOLDER/README-short.txt
24+
cp ./entry_point.sh $FOLDER/entry_point.sh

0 commit comments

Comments
 (0)