Skip to content

Commit

Permalink
Docker: Resolve default event bus port 4442 and 4443 in env var (#2688)
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 authored Mar 2, 2025
1 parent 7276e54 commit 714678d
Show file tree
Hide file tree
Showing 19 changed files with 4 additions and 156 deletions.
2 changes: 1 addition & 1 deletion NodeChromium/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ USER root
# Install Chromium
ARG CHROMIUM_VERSION="latest"
ARG CHROMIUM_DEB_SITE="http://deb.debian.org/debian"
RUN echo "deb ${CHROMIUM_DEB_SITE}/ sid main" >> /etc/apt/sources.list \
RUN echo "deb ${CHROMIUM_DEB_SITE}/ stable main" >> /etc/apt/sources.list \
&& wget -qO- https://ftp-master.debian.org/keys/archive-key-12.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/debian-archive-keyring.gpg \
&& wget -qO- https://ftp-master.debian.org/keys/archive-key-12-security.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/debian-archive-security-keyring.gpg \
&& apt-get update -qqy \
Expand Down
73 changes: 3 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ $ docker run --rm -it -p 4444:4444 -p 7900:7900 --shm-size 2g selenium/standalon
# To execute this docker compose yml file use `docker compose -f docker-compose-v3-beta-channel.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-beta-channel.yml down`
version: "3"
services:
chrome:
image: selenium/node-chrome:beta
Expand All @@ -275,8 +274,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

edge:
image: selenium/node-edge:beta
Expand All @@ -285,8 +282,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

firefox:
image: selenium/node-firefox:beta
Expand All @@ -295,8 +290,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

selenium-hub:
image: selenium/hub:latest
Expand All @@ -312,7 +305,6 @@ services:
# To execute this docker compose yml file use `docker compose -f docker-compose-v3-dev-channel.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-dev-channel.yml down`
version: "3"
services:
chrome:
image: selenium/node-chrome:dev
Expand All @@ -321,8 +313,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

edge:
image: selenium/node-edge:dev
Expand All @@ -331,8 +321,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

firefox:
image: selenium/node-firefox:dev
Expand All @@ -341,8 +329,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

selenium-hub:
image: selenium/hub:latest
Expand Down Expand Up @@ -411,18 +397,12 @@ $ docker network create grid
$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="2g" \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-chrome:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="2g" \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-edge:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="2g" \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-firefox:4.29.0-20250222
```

Expand All @@ -433,18 +413,12 @@ $ docker network create grid
$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub `
--shm-size="2g" `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
selenium/node-chrome:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub `
--shm-size="2g" `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
selenium/node-edge:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub `
--shm-size="2g" `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
selenium/node-firefox:4.29.0-20250222
```

Expand Down Expand Up @@ -473,8 +447,6 @@ $ docker run -d -p 4442-4444:4442-4444 --name selenium-hub selenium/hub:4.29.0-2
$ docker run -d -p 5555:5555 \
--shm-size="2g" \
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_HOST=<ip-from-machine-2> \
selenium/node-chrome:4.29.0-20250222
```
Expand All @@ -485,8 +457,6 @@ $ docker run -d -p 5555:5555 \
$ docker run -d -p 5555:5555 `
--shm-size="2g" `
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
-e SE_NODE_HOST=<ip-from-machine-2> `
selenium/node-chrome:4.29.0-20250222
```
Expand All @@ -500,8 +470,6 @@ $ docker run -d -p 5555:5555 `
$ docker run -d -p 5555:5555 \
--shm-size="2g" \
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_HOST=<ip-from-machine-3> \
selenium/node-edge:4.29.0-20250222
```
Expand All @@ -512,8 +480,6 @@ $ docker run -d -p 5555:5555 \
$ docker run -d -p 5555:5555 `
--shm-size="2g" `
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
-e SE_NODE_HOST=<ip-from-machine-3> `
selenium/node-edge:4.29.0-20250222
```
Expand All @@ -526,8 +492,6 @@ $ docker run -d -p 5555:5555 `
$ docker run -d -p 5555:5555 \
--shm-size="2g" \
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_HOST=<ip-from-machine-4> \
selenium/node-firefox:4.29.0-20250222
```
Expand All @@ -538,8 +502,6 @@ $ docker run -d -p 5555:5555 \
$ docker run -d -p 5555:5555 `
--shm-size="2g" `
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
-e SE_NODE_HOST=<ip-from-machine-4> `
selenium/node-firefox:4.29.0-20250222
```
Expand All @@ -552,8 +514,6 @@ $ docker run -d -p 5555:5555 `
$ docker run -d -p 5556:5556 \
--shm-size="2g" \
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_HOST=<ip-from-machine-4> \
-e SE_NODE_PORT=5556 \
selenium/node-chrome:4.29.0-20250222
Expand All @@ -565,8 +525,6 @@ $ docker run -d -p 5556:5556 \
$ docker run -d -p 5556:5556 `
--shm-size="2g" `
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
-e SE_NODE_HOST=<ip-from-machine-4> `
-e SE_NODE_PORT=5556 `
selenium/node-chrome:4.29.0-20250222
Expand Down Expand Up @@ -691,7 +649,6 @@ Notes: To reach the GraphQL endpoint, the recorder container needs to know the H
Besides the video recording mentioned above, you can enable the upload functionality by setting the following environment variables:

```yaml
version: "3"
services:
chrome_video:
image: selenium/video:ffmpeg-7.1-20250222
Expand Down Expand Up @@ -843,8 +800,6 @@ virtual machines.
$ docker network create grid
$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-v ${PWD}/config.toml:/opt/selenium/config.toml \
-v ${PWD}/assets:/opt/selenium/assets \
-v /var/run/docker.sock:/var/run/docker.sock \
Expand All @@ -857,8 +812,6 @@ $ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
$ docker network create grid
$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
-v ${PWD}/config.toml:/opt/selenium/config.toml `
-v ${PWD}/assets:/opt/selenium/assets `
-v /var/run/docker.sock:/var/run/docker.sock `
Expand Down Expand Up @@ -911,8 +864,6 @@ $ docker run -d -p 4442-4444:4442-4444 --name selenium-hub selenium/hub:4.29.0-2
```bash
$ docker run -d -p 5555:5555 \
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-v ${PWD}/config.toml:/opt/selenium/config.toml \
-v ${PWD}/assets:/opt/selenium/assets \
-v /var/run/docker.sock:/var/run/docker.sock \
Expand All @@ -924,8 +875,6 @@ $ docker run -d -p 5555:5555 \
```bash
$ docker run -d -p 5555:5555 `
-e SE_EVENT_BUS_HOST=<ip-from-machine-1> `
-e SE_EVENT_BUS_PUBLISH_PORT=4442 `
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 `
-v ${PWD}/config.toml:/opt/selenium/config.toml `
-v ${PWD}/assets:/opt/selenium/assets `
-v /var/run/docker.sock:/var/run/docker.sock `
Expand Down Expand Up @@ -1117,8 +1066,6 @@ Here is an example with the default values of these environment variables:
```bash
$ docker run -d \
-e SE_EVENT_BUS_HOST=<event_bus_ip|event_bus_name> \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_STEREOTYPE="{\"browserName\":\"${SE_NODE_BROWSER_NAME}\", \"browserVersion\":\"${SE_NODE_BROWSER_VERSION}\", \"platformName\":\"${SE_NODE_PLATFORM_NAME}\"}" \
--shm-size="2g" selenium/node-chrome:4.29.0-20250222
```
Expand All @@ -1127,8 +1074,6 @@ In another case, if you want to retain the default Node stereotype and append ad
```bash
$ docker run -d \
-e SE_EVENT_BUS_HOST=<event_bus_ip|event_bus_name> \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_STEREOTYPE_EXTRA="{\"myApp:version\":\"beta\", \"myApp:publish:\":\"public\"}" \
--shm-size="2g" selenium/node-chrome:4.29.0-20250222
```
Expand Down Expand Up @@ -1159,7 +1104,7 @@ In addition, default Node stereotype includes capability `se:containerName` whic
In an advanced case, where you control to spawn up a Node container, let it register to Hub, and then trigger a test to be assigned exactly to run on that Node. By default, the value of command `$(hostname)` is added to capability name `container:hostname` in Node stereotype. Combine with above feature setting custom capabilities for matching specific Nodes. You can use the `hostname` of the Node container just spawned up and set it as a custom capability. For example, in Python binding:
```bash
$ docker run -d --name my-node-1 -e SE_EVENT_BUS_HOST=localhost -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
$ docker run -d --name my-node-1 -e SE_EVENT_BUS_HOST=localhost \
--shm-size="2g" selenium/node-chrome:4.29.0-20250222
$ docker exec -i my-node-1 hostname
a6971f95bbab
Expand Down Expand Up @@ -1271,8 +1216,8 @@ To avoid starting the server you can set the `SE_START_XVFB` environment variabl
(or any other value than `true`), for example:
``` bash
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub -e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 -e SE_START_XVFB=false --shm-size="2g" selenium/node-chrome:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
-e SE_START_XVFB=false --shm-size="2g" selenium/node-chrome:4.29.0-20250222
```
For more information, see this GitHub [issue](https://github.com/SeleniumHQ/docker-selenium/issues/567).
Expand Down Expand Up @@ -1558,18 +1503,12 @@ $ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub \
selenium/hub:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="2g" \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-chrome:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="2g" \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-edge:4.29.0-20250222
$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="2g" \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-firefox:4.29.0-20250222
```
Expand Down Expand Up @@ -1791,24 +1730,18 @@ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
-e SE_ENABLE_TRACING=true \
-e SE_OTEL_TRACES_EXPORTER=otlp \
-e SE_OTEL_EXPORTER_ENDPOINT=http://jaeger:4317 \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-chrome:4.29.0-20250222
docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="2g" \
-e SE_ENABLE_TRACING=true \
-e SE_OTEL_TRACES_EXPORTER=otlp \
-e SE_OTEL_EXPORTER_ENDPOINT=http://jaeger:4317 \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-edge:4.29.0-20250222
docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="2g" \
-e SE_ENABLE_TRACING=true \
-e SE_OTEL_TRACES_EXPORTER=otlp \
-e SE_OTEL_EXPORTER_ENDPOINT=http://jaeger:4317 \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-firefox:4.29.0-20250222
```
Expand Down
7 changes: 0 additions & 7 deletions docker-compose-v3-basicauth.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-basicauth.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-basicauth.yml down`
version: "3"
services:
chrome:
image: selenium/node-chrome:4.29.0-20250222
Expand All @@ -10,8 +9,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

edge:
image: selenium/node-edge:4.29.0-20250222
Expand All @@ -20,8 +17,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

firefox:
image: selenium/node-firefox:4.29.0-20250222
Expand All @@ -30,8 +25,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

selenium-hub:
image: selenium/hub:4.29.0-20250222
Expand Down
7 changes: 0 additions & 7 deletions docker-compose-v3-beta-channel.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-beta-channel.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-beta-channel.yml down`
version: "3"
services:
chrome:
image: selenium/node-chrome:beta
Expand All @@ -10,8 +9,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

edge:
image: selenium/node-edge:beta
Expand All @@ -20,8 +17,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

firefox:
image: selenium/node-firefox:beta
Expand All @@ -30,8 +25,6 @@ services:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

selenium-hub:
image: selenium/hub:latest
Expand Down
Loading

0 comments on commit 714678d

Please sign in to comment.