Skip to content

Commit b110e85

Browse files
committed
Docker: Resolve default component port via env var
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 714678d commit b110e85

17 files changed

+38
-129
lines changed

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 \

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

charts/selenium-grid/templates/session-map-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ spec:
4747
fieldPath: status.hostIP
4848
- name: SE_OTEL_SERVICE_NAME
4949
value: '{{ template "seleniumGrid.sessionMap.fullname" . }}'
50-
- name: SE_SESSIONS_HOST
50+
- name: SE_SESSIONS_MAP_HOST
5151
valueFrom:
5252
fieldRef:
5353
fieldPath: status.podIP
54-
- name: SE_SESSIONS_PORT
54+
- name: SE_SESSIONS_MAP_PORT
5555
value: {{ .Values.components.sessionMap.port | quote }}
5656
{{- with .Values.components.extraEnvironmentVariables }}
5757
{{- tpl (toYaml .) $ | nindent 12 }}

docker-compose-v3-full-grid-dev.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# To execute this docker compose yml file use `docker compose -f docker-compose-v3-full-grid-dev.yml up`
22
# Add the `-d` flag at the end for detached execution
33
# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-full-grid-dev.yml down`
4-
version: "3"
54
services:
65
selenium-event-bus:
76
image: selenium/event-bus:4.29.0-20250222
@@ -24,8 +23,6 @@ services:
2423
- selenium-event-bus
2524
environment:
2625
- SE_EVENT_BUS_HOST=selenium-event-bus
27-
- SE_EVENT_BUS_PUBLISH_PORT=4442
28-
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
2926

3027
selenium-session-queue:
3128
image: selenium/session-queue:4.29.0-20250222
@@ -48,12 +45,8 @@ services:
4845
- selenium-session-queue
4946
environment:
5047
- SE_EVENT_BUS_HOST=selenium-event-bus
51-
- SE_EVENT_BUS_PUBLISH_PORT=4442
52-
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
5348
- SE_SESSIONS_MAP_HOST=selenium-sessions
54-
- SE_SESSIONS_MAP_PORT=5556
5549
- SE_SESSION_QUEUE_HOST=selenium-session-queue
56-
- SE_SESSION_QUEUE_PORT=5559
5750

5851
selenium-router:
5952
image: selenium/router:4.29.0-20250222
@@ -68,11 +61,8 @@ services:
6861
- selenium-session-queue
6962
environment:
7063
- SE_DISTRIBUTOR_HOST=selenium-distributor
71-
- SE_DISTRIBUTOR_PORT=5553
7264
- SE_SESSIONS_MAP_HOST=selenium-sessions
73-
- SE_SESSIONS_MAP_PORT=5556
7465
- SE_SESSION_QUEUE_HOST=selenium-session-queue
75-
- SE_SESSION_QUEUE_PORT=5559
7666

7767
chrome:
7868
image: selenium/node-chrome:4.29.0-20250222
@@ -83,8 +73,6 @@ services:
8373
- selenium-event-bus
8474
environment:
8575
- SE_EVENT_BUS_HOST=selenium-event-bus
86-
- SE_EVENT_BUS_PUBLISH_PORT=4442
87-
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
8876

8977
edge:
9078
image: selenium/node-edge:4.29.0-20250222
@@ -95,8 +83,6 @@ services:
9583
- selenium-event-bus
9684
environment:
9785
- SE_EVENT_BUS_HOST=selenium-event-bus
98-
- SE_EVENT_BUS_PUBLISH_PORT=4442
99-
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
10086

10187
firefox:
10288
image: selenium/node-firefox:4.29.0-20250222
@@ -107,5 +93,3 @@ services:
10793
- selenium-event-bus
10894
environment:
10995
- SE_EVENT_BUS_HOST=selenium-event-bus
110-
- SE_EVENT_BUS_PUBLISH_PORT=4442
111-
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

0 commit comments

Comments
 (0)