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

Commit 3c74143

Browse files
authored
Refactoring env vars to add SE_ prefix (SeleniumHQ#1603)
In preparation for SeleniumHQ#1319, which makes it easier to collect the environment variables that matter to configure child containers.
1 parent 5d143a8 commit 3c74143

20 files changed

+107
-55
lines changed

Distributor/start-selenium-grid-distributor.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ if [ ! -z "$SE_DISTRIBUTOR_PORT" ]; then
5555
fi
5656

5757

58-
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server.jar distributor \
58+
java ${JAVA_OPTS:-$SE_JAVA_OPTS} -jar /opt/selenium/selenium-server.jar distributor \
5959
--sessions-host "${SE_SESSIONS_MAP_HOST}" --sessions-port "${SE_SESSIONS_MAP_PORT}" \
6060
--sessionqueue-host "${SE_SESSION_QUEUE_HOST}" --sessionqueue-port "${SE_SESSION_QUEUE_PORT}" \
6161
--publish-events tcp://"${SE_EVENT_BUS_HOST}":"${SE_EVENT_BUS_PUBLISH_PORT}" \

EventBus/start-selenium-grid-eventbus.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if [ ! -z "$SE_OPTS" ]; then
1919
echo "Appending Selenium options: ${SE_OPTS}"
2020
fi
2121

22-
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server.jar event-bus \
22+
java ${JAVA_OPTS:-$SE_JAVA_OPTS} -jar /opt/selenium/selenium-server.jar event-bus \
2323
--bind-host ${SE_BIND_HOST} \
2424
${HOST_CONFIG} \
2525
${PORT_CONFIG} \

Hub/start-selenium-grid-hub.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if [ ! -z "$SE_HUB_PORT" ]; then
1818
fi
1919

2020

21-
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server.jar hub \
21+
java ${JAVA_OPTS:-$SE_JAVA_OPTS} -jar /opt/selenium/selenium-server.jar hub \
2222
--session-request-timeout ${SE_SESSION_REQUEST_TIMEOUT} \
2323
--session-retry-interval ${SE_SESSION_RETRY_INTERVAL} \
2424
--relax-checks ${SE_RELAX_CHECKS} \

NodeBase/Dockerfile.txt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,24 @@ COPY selenium_grid_logo.png /usr/share/images/fluxbox/ubuntu-light.png
154154
#============================
155155
# Some configuration options
156156
#============================
157-
ENV SCREEN_WIDTH 1360
158-
ENV SCREEN_HEIGHT 1020
159-
ENV SCREEN_DEPTH 24
160-
ENV SCREEN_DPI 96
157+
ENV SE_SCREEN_WIDTH 1360
158+
ENV SE_SCREEN_HEIGHT 1020
159+
ENV SE_SCREEN_DEPTH 24
160+
ENV SE_SCREEN_DPI 96
161+
ENV SE_START_XVFB true
162+
ENV SE_START_NO_VNC true
163+
ENV SE_NO_VNC_PORT 7900
164+
ENV SE_VNC_PORT 5900
161165
ENV DISPLAY :99.0
162166
ENV DISPLAY_NUM 99
163-
ENV START_XVFB true
164-
ENV START_NO_VNC true
165167
# Path to the Configfile
166168
ENV CONFIG_FILE=/opt/selenium/config.toml
167169
ENV GENERATE_CONFIG true
168170
# Drain the Node after N sessions.
169171
# A value higher than zero enables the feature
170-
ENV DRAIN_AFTER_SESSION_COUNT 0
172+
ENV SE_DRAIN_AFTER_SESSION_COUNT 0
173+
174+
171175

172176
#========================
173177
# Selenium Configuration

NodeBase/generate_config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fi
4646
echo "session-timeout = \"${SE_NODE_SESSION_TIMEOUT}\"" >> "$FILENAME"
4747
echo "override-max-sessions = ${SE_NODE_OVERRIDE_MAX_SESSIONS}" >> "$FILENAME"
4848
echo "detect-drivers = false" >> "$FILENAME"
49-
echo "drain-after-session-count = ${DRAIN_AFTER_SESSION_COUNT}" >> "$FILENAME"
49+
echo "drain-after-session-count = ${DRAIN_AFTER_SESSION_COUNT:-$SE_DRAIN_AFTER_SESSION_COUNT}" >> "$FILENAME"
5050
echo "max-sessions = ${SE_NODE_MAX_SESSIONS}
5151
" >> "$FILENAME"
5252

NodeBase/start-novnc.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
#
33
# IMPORTANT: Change this file only in directory NodeBase!
44

5-
if [ "${START_XVFB}" = true ] ; then
6-
if [ "${START_NO_VNC}" = true ] ; then
7-
/opt/bin/noVNC/utils/launch.sh --listen ${NO_VNC_PORT:-7900} --vnc localhost:${VNC_PORT:-5900}
5+
if [ "${START_XVFB:-$SE_START_XVFB}" = true ] ; then
6+
if [ "${START_NO_VNC:-$SE_START_NO_VNC}" = true ] ; then
7+
/opt/bin/noVNC/utils/launch.sh --listen ${NO_VNC_PORT:-$SE_NO_VNC_PORT} --vnc localhost:${VNC_PORT:-$SE_VNC_PORT}
88
else
9-
echo "noVNC won't start because START_NO_VNC is false."
9+
echo "noVNC won't start because SE_START_NO_VNC is false."
1010
fi
1111
else
1212
echo "noVNC won't start because Xvfb is configured to not start."

NodeBase/start-selenium-node.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fi
3838
echo "Selenium Grid Node configuration: "
3939
cat "$CONFIG_FILE"
4040
echo "Starting Selenium Grid Node..."
41-
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server.jar node \
41+
java ${JAVA_OPTS:-$SE_JAVA_OPTS} -jar /opt/selenium/selenium-server.jar node \
4242
--bind-host ${SE_BIND_HOST} \
4343
--config "$CONFIG_FILE" \
4444
${SE_OPTS}

NodeBase/start-vnc.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# IMPORTANT: Change this file only in directory NodeBase!
44

5-
if [ "${START_XVFB}" = true ] ; then
5+
if [ "${START_XVFB:-$SE_START_XVFB}" = true ] ; then
66
# Centering wallpaper
77
for i in $(seq 1 10)
88
do
@@ -14,13 +14,15 @@ if [ "${START_XVFB}" = true ] ; then
1414
fi
1515
done
1616

17+
VNC_NO_PASSWORD=${VNC_NO_PASSWORD:-$SE_VNC_NO_PASSWORD}
1718
if [ ! -z $VNC_NO_PASSWORD ]; then
1819
echo "Starting VNC server without password authentication"
1920
X11VNC_OPTS=
2021
else
2122
X11VNC_OPTS=-usepw
2223
fi
2324

25+
VNC_VIEW_ONLY=${VNC_VIEW_ONLY:-$SE_VNC_VIEW_ONLY}
2426
if [ ! -z $VNC_VIEW_ONLY ]; then
2527
echo "Starting VNC server with viewonly option"
2628
X11VNC_OPTS="${X11VNC_OPTS} -viewonly"
@@ -36,7 +38,7 @@ if [ "${START_XVFB}" = true ] ; then
3638
echo "Waiting for Xvfb..."
3739
done
3840

39-
x11vnc ${X11VNC_OPTS} -forever -shared -rfbport ${VNC_PORT:-5900} -rfbportv6 ${VNC_PORT:-5900} -display ${DISPLAY}
41+
x11vnc ${X11VNC_OPTS} -forever -shared -rfbport ${VNC_PORT:-$SE_VNC_PORT} -rfbportv6 ${VNC_PORT:-$SE_VNC_PORT} -display ${DISPLAY}
4042
else
4143
echo "Vnc won't start because Xvfb is configured to not start."
4244
fi

NodeBase/start-xvfb.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/usr/bin/env bash
22

3-
if [ "${START_XVFB}" = true ] ; then
3+
SCREEN_WIDTH=${SCREEN_WIDTH:-$SE_SCREEN_WIDTH}
4+
SCREEN_HEIGHT=${SCREEN_HEIGHT:-$SE_SCREEN_HEIGHT}
5+
SCREEN_DEPTH=${SCREEN_DEPTH:-$SE_SCREEN_DEPTH}
6+
SCREEN_DPI=${SCREEN_DPI:-$SE_SCREEN_DPI}
7+
8+
if [ "${START_XVFB:-$SE_START_XVFB}" = true ] ; then
49
export GEOMETRY="${SCREEN_WIDTH}""x""${SCREEN_HEIGHT}""x""${SCREEN_DEPTH}"
510

611
rm -f /tmp/.X*lock

NodeDocker/start-selenium-grid-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if [ ! -z "$SE_NODE_GRID_URL" ]; then
2929
SE_GRID_URL="--grid-url ${SE_NODE_GRID_URL}"
3030
fi
3131

32-
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server.jar node \
32+
java ${JAVA_OPTS:-$SE_JAVA_OPTS} -jar /opt/selenium/selenium-server.jar node \
3333
--publish-events tcp://"${SE_EVENT_BUS_HOST}":${SE_EVENT_BUS_PUBLISH_PORT} \
3434
--subscribe-events tcp://"${SE_EVENT_BUS_HOST}":${SE_EVENT_BUS_SUBSCRIBE_PORT} \
3535
--bind-host ${SE_BIND_HOST} \

0 commit comments

Comments
 (0)