Skip to content

Commit 966a78a

Browse files
authored
Docker: Resolve default component port via env var (#2689)
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 714678d commit 966a78a

20 files changed

+45
-134
lines changed

Base/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ARG GRPC_VERSION=1.70.0
1313
ARG NETTY_VERSION=4.1.118.Final
1414
ARG CS_VERSION=2.1.18
1515
ARG POSTGRESQL_VERSION=42.7.5
16-
ARG ENVSUBST_VERSION=1.4.2-patch.124
16+
ARG ENVSUBST_VERSION=1.4.3
1717

1818
#Arguments to define the user running Selenium
1919
ARG SEL_USER=seluser
@@ -161,7 +161,7 @@ COPY --chown="${SEL_UID}:${SEL_GID}" certs/tls.crt certs/tls.key certs/server.jk
161161
# Add envsubst binary
162162
#===================================================
163163
RUN ARCH=$(if [ "$(dpkg --print-architecture)" = "amd64" ]; then echo "x86_64"; else echo "$(dpkg --print-architecture)"; fi) \
164-
&& curl -fsSL https://github.com/NDViet/envsubst/releases/download/v${ENVSUBST_VERSION}/envsubst-$(uname -s)-${ARCH} -o envsubst \
164+
&& curl -fsSL https://github.com/a8m/envsubst/releases/download/v${ENVSUBST_VERSION}/envsubst-$(uname -s)-${ARCH} -o envsubst \
165165
&& chmod +x envsubst \
166166
&& mv envsubst /usr/local/bin \
167167
&& ln -sf /usr/local/bin/envsubst /usr/bin/envsubst

Distributor/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@ ENV SE_SESSION_REQUEST_TIMEOUT="300" \
2323
SE_SESSION_RETRY_INTERVAL="15" \
2424
# In seconds, maps to "--healthcheck-interval"
2525
SE_HEALTHCHECK_INTERVAL="120" \
26+
SE_EVENT_BUS_PUBLISH_PORT="4442" \
27+
SE_EVENT_BUS_SUBSCRIBE_PORT="4443" \
28+
SE_SESSIONS_MAP_PORT="5556" \
29+
SE_SESSION_QUEUE_PORT="5559" \
30+
SE_DISTRIBUTOR_PORT="5553" \
2631
SE_OTEL_SERVICE_NAME="selenium-distributor"

ENV_VARIABLES.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
| SE_NODE_GRID_URL | | Node config, public URL of the Grid as a whole (typically the address of the Hub or the Router) | --grid-url |
2727
| SE_HUB_HOST | | Hub config, host address the Hub should listen on | --host |
2828
| SE_ROUTER_HOST | | Router config, host address the Router should listen on | --host |
29-
| SE_HUB_PORT | | Hub config, port the Hub should listen on (default 4444) | --port |
30-
| SE_ROUTER_PORT | | Router config, port the Router should listen on (default 4444) | --port |
29+
| SE_HUB_PORT | 4444 | Hub config, port the Hub should listen on (default 4444) | --port |
30+
| SE_ROUTER_PORT | 4444 | Router config, port the Router should listen on (default 4444) | --port |
3131
| SE_NODE_GRID_GRAPHQL_URL | | Video recording config, GraphQL URL to query test metadata for dynamic file name | |
3232
| SE_VIDEO_FILE_NAME_TRIM_REGEX | [:alnum:]-_ | Bash regex to trim the file name if it is too long | |
3333
| SE_VIDEO_FILE_NAME_SUFFIX | | Append a suffix session id along with test metadata | |
@@ -39,7 +39,7 @@
3939
| SE_RCLONE_ | | | |
4040
| SE_OPTS | | | |
4141
| SE_EVENT_BUS_HOST | | | |
42-
| SE_EVENT_BUS_PORT | | | |
42+
| SE_EVENT_BUS_PORT | 5557 | | |
4343
| SE_LOG_LEVEL | INFO | | |
4444
| SE_HTTP_LOGS | false | | |
4545
| SE_STRUCTURED_LOGS | false | | |
@@ -92,17 +92,15 @@
9292
| SE_HEALTHCHECK_INTERVAL | 120 | | |
9393
| SE_RELAX_CHECKS | true | | |
9494
| SE_SESSION_QUEUE_HOST | | | |
95-
| SE_SESSION_QUEUE_PORT | | | |
95+
| SE_SESSION_QUEUE_PORT | 5559 | | |
9696
| SE_VIDEO_FOLDER | | | |
9797
| SE_LOG_LISTEN_GRAPHQL | | | |
9898
| SE_NODE_PRESTOP_WAIT_STRATEGY | | | |
99-
| SE_SESSIONS_HOST | | | |
100-
| SE_SESSIONS_PORT | | | |
10199
| SE_SESSIONS_MAP_EXTERNAL_DATASTORE | false | | |
102100
| SE_SESSIONS_MAP_HOST | | | |
103-
| SE_SESSIONS_MAP_PORT | | | |
101+
| SE_SESSIONS_MAP_PORT | 5556 | | |
104102
| SE_DISTRIBUTOR_HOST | | | |
105-
| SE_DISTRIBUTOR_PORT | | | |
103+
| SE_DISTRIBUTOR_PORT | 5553 | | |
106104
| SE_GRID_URL | | | |
107105
| SE_NODE_DOCKER_CONFIG_FILENAME | | | |
108106
| SE_NODE_GRACEFUL_SHUTDOWN | | | |

EventBus/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-eventbus.sh \
2222

2323
COPY selenium-grid-eventbus.conf /etc/supervisor/conf.d/
2424

25-
ENV SE_OTEL_SERVICE_NAME="selenium-event-bus"
25+
ENV SE_OTEL_SERVICE_NAME="selenium-event-bus" \
26+
SE_EVENT_BUS_PUBLISH_PORT="4442" \
27+
SE_EVENT_BUS_SUBSCRIBE_PORT="4443" \
28+
SE_EVENT_BUS_PORT="5557"

Hub/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ENV SE_SESSION_REQUEST_TIMEOUT="300" \
2222
SE_HEALTHCHECK_INTERVAL="120" \
2323
# Boolean value, maps "--relax-checks"
2424
SE_RELAX_CHECKS="true" \
25+
SE_HUB_PORT="4444" \
2526
SE_OTEL_SERVICE_NAME="selenium-hub"
2627

2728
COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-hub.sh \

NodeDocker/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ COPY --chown="${SEL_UID}:${SEL_GID}" config.toml /opt/selenium/
2929

3030
COPY selenium-grid-docker.conf /etc/supervisor/conf.d/
3131

32-
ENV SE_OTEL_SERVICE_NAME="selenium-node-docker"
32+
ENV SE_OTEL_SERVICE_NAME="selenium-node-docker" \
33+
SE_EVENT_BUS_PUBLISH_PORT="4442" \
34+
SE_EVENT_BUS_SUBSCRIBE_PORT="4443"

Router/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ USER ${SEL_UID}
1414
ENV SE_SESSION_REQUEST_TIMEOUT="300" \
1515
# In seconds, maps to "--session-retry-interval"
1616
SE_SESSION_RETRY_INTERVAL="15" \
17+
SE_DISTRIBUTOR_PORT="5553" \
18+
SE_SESSIONS_MAP_PORT="5556" \
19+
SE_SESSION_QUEUE_PORT="5559" \
20+
SE_ROUTER_PORT="4444" \
1721
SE_OTEL_SERVICE_NAME="selenium-router"
1822

1923
EXPOSE 4444

SessionQueue/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ USER ${SEL_UID}
1414
ENV SE_SESSION_REQUEST_TIMEOUT="300" \
1515
# In seconds, maps to "--session-retry-interval"
1616
SE_SESSION_RETRY_INTERVAL="15" \
17+
SE_SESSION_QUEUE_PORT="5559" \
1718
SE_OTEL_SERVICE_NAME="selenium-session-queue"
1819

1920
EXPOSE 5559

Sessions/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ EXPOSE 5556
2222

2323
ENV SE_OTEL_SERVICE_NAME="selenium-session-map" \
2424
GENERATE_CONFIG="true" \
25+
SE_EVENT_BUS_PUBLISH_PORT="4442" \
26+
SE_EVENT_BUS_SUBSCRIBE_PORT="4443" \
27+
SE_SESSIONS_MAP_PORT="5556" \
2528
SE_SESSIONS_MAP_EXTERNAL_DATASTORE="false"

Sessions/start-selenium-grid-sessions.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ if [ ! -z "$SE_OPTS" ]; then
4141
echo "Appending Selenium options: ${SE_OPTS}"
4242
fi
4343

44-
if [ ! -z "$SE_SESSIONS_HOST" ]; then
45-
echo "Using SE_SESSIONS_HOST: ${SE_SESSIONS_HOST}"
46-
HOST_CONFIG="--host ${SE_SESSIONS_HOST}"
44+
if [ ! -z "${SE_SESSIONS_MAP_HOST}" ]; then
45+
echo "Using SE_SESSIONS_MAP_HOST: ${SE_SESSIONS_MAP_HOST}"
46+
HOST_CONFIG="--host ${SE_SESSIONS_MAP_HOST}"
4747
fi
4848

49-
if [ ! -z "$SE_SESSIONS_PORT" ]; then
50-
echo "Using SE_SESSIONS_PORT: ${SE_SESSIONS_PORT}"
51-
PORT_CONFIG="--port ${SE_SESSIONS_PORT}"
49+
if [ ! -z "${SE_SESSIONS_MAP_PORT}" ]; then
50+
echo "Using SE_SESSIONS_MAP_PORT: ${SE_SESSIONS_MAP_PORT}"
51+
PORT_CONFIG="--port ${SE_SESSIONS_MAP_PORT}"
5252
fi
5353

5454
if [ ! -z "$SE_LOG_LEVEL" ]; then

0 commit comments

Comments
 (0)