Skip to content

Docker: Resolve default component port via env var #2689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ARG GRPC_VERSION=1.70.0
ARG NETTY_VERSION=4.1.118.Final
ARG CS_VERSION=2.1.18
ARG POSTGRESQL_VERSION=42.7.5
ARG ENVSUBST_VERSION=1.4.2-patch.124
ARG ENVSUBST_VERSION=1.4.3

#Arguments to define the user running Selenium
ARG SEL_USER=seluser
Expand Down Expand Up @@ -161,7 +161,7 @@ COPY --chown="${SEL_UID}:${SEL_GID}" certs/tls.crt certs/tls.key certs/server.jk
# Add envsubst binary
#===================================================
RUN ARCH=$(if [ "$(dpkg --print-architecture)" = "amd64" ]; then echo "x86_64"; else echo "$(dpkg --print-architecture)"; fi) \
&& curl -fsSL https://github.com/NDViet/envsubst/releases/download/v${ENVSUBST_VERSION}/envsubst-$(uname -s)-${ARCH} -o envsubst \
&& curl -fsSL https://github.com/a8m/envsubst/releases/download/v${ENVSUBST_VERSION}/envsubst-$(uname -s)-${ARCH} -o envsubst \
&& chmod +x envsubst \
&& mv envsubst /usr/local/bin \
&& ln -sf /usr/local/bin/envsubst /usr/bin/envsubst
Expand Down
5 changes: 5 additions & 0 deletions Distributor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ ENV SE_SESSION_REQUEST_TIMEOUT="300" \
SE_SESSION_RETRY_INTERVAL="15" \
# In seconds, maps to "--healthcheck-interval"
SE_HEALTHCHECK_INTERVAL="120" \
SE_EVENT_BUS_PUBLISH_PORT="4442" \
SE_EVENT_BUS_SUBSCRIBE_PORT="4443" \
SE_SESSIONS_MAP_PORT="5556" \
SE_SESSION_QUEUE_PORT="5559" \
SE_DISTRIBUTOR_PORT="5553" \
SE_OTEL_SERVICE_NAME="selenium-distributor"
14 changes: 6 additions & 8 deletions ENV_VARIABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
| 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 |
| SE_HUB_HOST | | Hub config, host address the Hub should listen on | --host |
| SE_ROUTER_HOST | | Router config, host address the Router should listen on | --host |
| SE_HUB_PORT | | Hub config, port the Hub should listen on (default 4444) | --port |
| SE_ROUTER_PORT | | Router config, port the Router should listen on (default 4444) | --port |
| SE_HUB_PORT | 4444 | Hub config, port the Hub should listen on (default 4444) | --port |
| SE_ROUTER_PORT | 4444 | Router config, port the Router should listen on (default 4444) | --port |
| SE_NODE_GRID_GRAPHQL_URL | | Video recording config, GraphQL URL to query test metadata for dynamic file name | |
| SE_VIDEO_FILE_NAME_TRIM_REGEX | [:alnum:]-_ | Bash regex to trim the file name if it is too long | |
| SE_VIDEO_FILE_NAME_SUFFIX | | Append a suffix session id along with test metadata | |
Expand All @@ -39,7 +39,7 @@
| SE_RCLONE_ | | | |
| SE_OPTS | | | |
| SE_EVENT_BUS_HOST | | | |
| SE_EVENT_BUS_PORT | | | |
| SE_EVENT_BUS_PORT | 5557 | | |
| SE_LOG_LEVEL | INFO | | |
| SE_HTTP_LOGS | false | | |
| SE_STRUCTURED_LOGS | false | | |
Expand Down Expand Up @@ -92,17 +92,15 @@
| SE_HEALTHCHECK_INTERVAL | 120 | | |
| SE_RELAX_CHECKS | true | | |
| SE_SESSION_QUEUE_HOST | | | |
| SE_SESSION_QUEUE_PORT | | | |
| SE_SESSION_QUEUE_PORT | 5559 | | |
| SE_VIDEO_FOLDER | | | |
| SE_LOG_LISTEN_GRAPHQL | | | |
| SE_NODE_PRESTOP_WAIT_STRATEGY | | | |
| SE_SESSIONS_HOST | | | |
| SE_SESSIONS_PORT | | | |
| SE_SESSIONS_MAP_EXTERNAL_DATASTORE | false | | |
| SE_SESSIONS_MAP_HOST | | | |
| SE_SESSIONS_MAP_PORT | | | |
| SE_SESSIONS_MAP_PORT | 5556 | | |
| SE_DISTRIBUTOR_HOST | | | |
| SE_DISTRIBUTOR_PORT | | | |
| SE_DISTRIBUTOR_PORT | 5553 | | |
| SE_GRID_URL | | | |
| SE_NODE_DOCKER_CONFIG_FILENAME | | | |
| SE_NODE_GRACEFUL_SHUTDOWN | | | |
Expand Down
5 changes: 4 additions & 1 deletion EventBus/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-eventbus.sh \

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

ENV SE_OTEL_SERVICE_NAME="selenium-event-bus"
ENV SE_OTEL_SERVICE_NAME="selenium-event-bus" \
SE_EVENT_BUS_PUBLISH_PORT="4442" \
SE_EVENT_BUS_SUBSCRIBE_PORT="4443" \
SE_EVENT_BUS_PORT="5557"
1 change: 1 addition & 0 deletions Hub/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ENV SE_SESSION_REQUEST_TIMEOUT="300" \
SE_HEALTHCHECK_INTERVAL="120" \
# Boolean value, maps "--relax-checks"
SE_RELAX_CHECKS="true" \
SE_HUB_PORT="4444" \
SE_OTEL_SERVICE_NAME="selenium-hub"

COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-hub.sh \
Expand Down
4 changes: 3 additions & 1 deletion NodeDocker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ COPY --chown="${SEL_UID}:${SEL_GID}" config.toml /opt/selenium/

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

ENV SE_OTEL_SERVICE_NAME="selenium-node-docker"
ENV SE_OTEL_SERVICE_NAME="selenium-node-docker" \
SE_EVENT_BUS_PUBLISH_PORT="4442" \
SE_EVENT_BUS_SUBSCRIBE_PORT="4443"
4 changes: 4 additions & 0 deletions Router/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ USER ${SEL_UID}
ENV SE_SESSION_REQUEST_TIMEOUT="300" \
# In seconds, maps to "--session-retry-interval"
SE_SESSION_RETRY_INTERVAL="15" \
SE_DISTRIBUTOR_PORT="5553" \
SE_SESSIONS_MAP_PORT="5556" \
SE_SESSION_QUEUE_PORT="5559" \
SE_ROUTER_PORT="4444" \
SE_OTEL_SERVICE_NAME="selenium-router"

EXPOSE 4444
Expand Down
1 change: 1 addition & 0 deletions SessionQueue/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ USER ${SEL_UID}
ENV SE_SESSION_REQUEST_TIMEOUT="300" \
# In seconds, maps to "--session-retry-interval"
SE_SESSION_RETRY_INTERVAL="15" \
SE_SESSION_QUEUE_PORT="5559" \
SE_OTEL_SERVICE_NAME="selenium-session-queue"

EXPOSE 5559
Expand Down
3 changes: 3 additions & 0 deletions Sessions/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ EXPOSE 5556

ENV SE_OTEL_SERVICE_NAME="selenium-session-map" \
GENERATE_CONFIG="true" \
SE_EVENT_BUS_PUBLISH_PORT="4442" \
SE_EVENT_BUS_SUBSCRIBE_PORT="4443" \
SE_SESSIONS_MAP_PORT="5556" \
SE_SESSIONS_MAP_EXTERNAL_DATASTORE="false"
12 changes: 6 additions & 6 deletions Sessions/start-selenium-grid-sessions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ if [ ! -z "$SE_OPTS" ]; then
echo "Appending Selenium options: ${SE_OPTS}"
fi

if [ ! -z "$SE_SESSIONS_HOST" ]; then
echo "Using SE_SESSIONS_HOST: ${SE_SESSIONS_HOST}"
HOST_CONFIG="--host ${SE_SESSIONS_HOST}"
if [ ! -z "${SE_SESSIONS_MAP_HOST}" ]; then
echo "Using SE_SESSIONS_MAP_HOST: ${SE_SESSIONS_MAP_HOST}"
HOST_CONFIG="--host ${SE_SESSIONS_MAP_HOST}"
fi

if [ ! -z "$SE_SESSIONS_PORT" ]; then
echo "Using SE_SESSIONS_PORT: ${SE_SESSIONS_PORT}"
PORT_CONFIG="--port ${SE_SESSIONS_PORT}"
if [ ! -z "${SE_SESSIONS_MAP_PORT}" ]; then
echo "Using SE_SESSIONS_MAP_PORT: ${SE_SESSIONS_MAP_PORT}"
PORT_CONFIG="--port ${SE_SESSIONS_MAP_PORT}"
fi

if [ ! -z "$SE_LOG_LEVEL" ]; then
Expand Down
4 changes: 2 additions & 2 deletions charts/selenium-grid/templates/session-map-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ spec:
fieldPath: status.hostIP
- name: SE_OTEL_SERVICE_NAME
value: '{{ template "seleniumGrid.sessionMap.fullname" . }}'
- name: SE_SESSIONS_HOST
- name: SE_SESSIONS_MAP_HOST
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: SE_SESSIONS_PORT
- name: SE_SESSIONS_MAP_PORT
value: {{ .Values.components.sessionMap.port | quote }}
{{- with .Values.components.extraEnvironmentVariables }}
{{- tpl (toYaml .) $ | nindent 12 }}
Expand Down
16 changes: 0 additions & 16 deletions docker-compose-v3-full-grid-dev.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# To execute this docker compose yml file use `docker compose -f docker-compose-v3-full-grid-dev.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-full-grid-dev.yml down`
version: "3"
services:
selenium-event-bus:
image: selenium/event-bus:4.29.0-20250222
Expand All @@ -24,8 +23,6 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

selenium-session-queue:
image: selenium/session-queue:4.29.0-20250222
Expand All @@ -48,12 +45,8 @@ services:
- selenium-session-queue
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_SESSIONS_MAP_HOST=selenium-sessions
- SE_SESSIONS_MAP_PORT=5556
- SE_SESSION_QUEUE_HOST=selenium-session-queue
- SE_SESSION_QUEUE_PORT=5559

selenium-router:
image: selenium/router:4.29.0-20250222
Expand All @@ -68,11 +61,8 @@ services:
- selenium-session-queue
environment:
- SE_DISTRIBUTOR_HOST=selenium-distributor
- SE_DISTRIBUTOR_PORT=5553
- SE_SESSIONS_MAP_HOST=selenium-sessions
- SE_SESSIONS_MAP_PORT=5556
- SE_SESSION_QUEUE_HOST=selenium-session-queue
- SE_SESSION_QUEUE_PORT=5559

chrome:
image: selenium/node-chrome:4.29.0-20250222
Expand All @@ -83,8 +73,6 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

edge:
image: selenium/node-edge:4.29.0-20250222
Expand All @@ -95,8 +83,6 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

firefox:
image: selenium/node-firefox:4.29.0-20250222
Expand All @@ -107,5 +93,3 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
16 changes: 0 additions & 16 deletions docker-compose-v3-full-grid-external-datastore.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# To execute this docker compose yml file use `docker compose -f docker-compose-v3-full-grid.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-full-grid.yml down`
version: "3"
services:
selenium-event-bus:
image: selenium/event-bus:4.29.0-20250222
Expand All @@ -20,8 +19,6 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_SESSIONS_MAP_EXTERNAL_DATASTORE=true
- SE_SESSIONS_MAP_EXTERNAL_IMPLEMENTATION=org.openqa.selenium.grid.sessionmap.jdbc.JdbcBackedSessionMap
- SE_SESSIONS_MAP_EXTERNAL_JDBC_URL=jdbc:postgresql://postgresql:5432/selenium_sessions
Expand Down Expand Up @@ -68,12 +65,8 @@ services:
- selenium-session-queue
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_SESSIONS_MAP_HOST=selenium-sessions
- SE_SESSIONS_MAP_PORT=5556
- SE_SESSION_QUEUE_HOST=selenium-session-queue
- SE_SESSION_QUEUE_PORT=5559

selenium-router:
image: selenium/router:4.29.0-20250222
Expand All @@ -86,11 +79,8 @@ services:
- selenium-session-queue
environment:
- SE_DISTRIBUTOR_HOST=selenium-distributor
- SE_DISTRIBUTOR_PORT=5553
- SE_SESSIONS_MAP_HOST=selenium-sessions
- SE_SESSIONS_MAP_PORT=5556
- SE_SESSION_QUEUE_HOST=selenium-session-queue
- SE_SESSION_QUEUE_PORT=5559

chrome:
image: selenium/node-chrome:4.29.0-20250222
Expand All @@ -99,8 +89,6 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

edge:
image: selenium/node-edge:4.29.0-20250222
Expand All @@ -109,8 +97,6 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

firefox:
image: selenium/node-firefox:4.29.0-20250222
Expand All @@ -119,5 +105,3 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
16 changes: 0 additions & 16 deletions docker-compose-v3-full-grid-nightly.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# To execute this docker compose yml file use `docker compose -f docker-compose-v3-full-grid-nightly.yml up --force-recreate`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-full-grid-nightly.yml down`
version: "3"
services:
selenium-event-bus:
image: selenium/event-bus:nightly
Expand All @@ -20,8 +19,6 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

selenium-session-queue:
image: selenium/session-queue:nightly
Expand All @@ -40,12 +37,8 @@ services:
- selenium-session-queue
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_SESSIONS_MAP_HOST=selenium-sessions
- SE_SESSIONS_MAP_PORT=5556
- SE_SESSION_QUEUE_HOST=selenium-session-queue
- SE_SESSION_QUEUE_PORT=5559

selenium-router:
image: selenium/router:nightly
Expand All @@ -58,11 +51,8 @@ services:
- selenium-session-queue
environment:
- SE_DISTRIBUTOR_HOST=selenium-distributor
- SE_DISTRIBUTOR_PORT=5553
- SE_SESSIONS_MAP_HOST=selenium-sessions
- SE_SESSIONS_MAP_PORT=5556
- SE_SESSION_QUEUE_HOST=selenium-session-queue
- SE_SESSION_QUEUE_PORT=5559

chrome:
image: selenium/node-chrome:nightly
Expand All @@ -71,8 +61,6 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

edge:
image: selenium/node-edge:nightly
Expand All @@ -81,8 +69,6 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

firefox:
image: selenium/node-firefox:nightly
Expand All @@ -91,8 +77,6 @@ services:
- selenium-event-bus
environment:
- SE_EVENT_BUS_HOST=selenium-event-bus
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

chrome_video:
image: selenium/video:nightly
Expand Down
Loading
Loading