seleniumhq-community / docker-seleniarm

Multi-Arch (arm64/armhf/amd64) Docker images for the Selenium Grid Server
https://hub.docker.com/u/seleniarm
Other
249 stars 26 forks source link

[🐛 Bug]: selenium/node-chrome:latest error message: "Only local connections are allowed." #17

Closed sudo-naim closed 1 year ago

sudo-naim commented 1 year ago

What happened?

After docker-compose the yaml file published in this repo docker-compose-v3-full-grid.yml, I try to execute a test but whenever I do the browser doesn't start and i get an error. Dependencies from my project:

            dependency 'net.bytebuddy:byte-buddy:1.10.1'
            dependency 'org.seleniumhq.selenium:selenium-java:4.4.0'
            dependency 'org.seleniumhq.selenium:selenium-api:4.4.0'
            dependency 'org.seleniumhq.selenium:selenium-remote-driver:4.4.0'
            dependency 'org.seleniumhq.selenium:selenium-support:4.4.0'
            dependency 'org.seleniumhq.selenium:selenium-chrome-driver:4.4.0'
            dependency 'org.seleniumhq.selenium:selenium-firefox-driver:3.141.59'
            dependency 'org.seleniumhq.selenium:selenium-edge-driver:3.141.59'
            dependency 'org.seleniumhq.selenium:selenium-safari-driver:3.141.59'
            dependency 'io.github.bonigarcia:webdrivermanager:5.2.3'
            dependency 'io.netty:netty-all:4.1.78.Final' 
            dependency 'io.netty:netty-buffer:4.1.78.Final'
            dependency 'io.netty:netty-codec-http:4.1.78.Final' 
            dependency 'io.netty:netty-transport-native-epoll:4.1.78.Final'
            dependency 'io.netty:netty-transport-native-kqueue:4.1.78.Final'
            dependency 'io.netty:netty-codec-socks:4.1.78.Final'
            dependency 'io.netty:netty-handler:4.1.78.Final' 
            dependency 'io.netty:netty-handler-proxy:4.1.78.Final' 
            dependency 'com.beust:jcommander:1.82' 
            dependency 'org.testng:testng:7.4.0'
            dependency 'io.qameta.allure:allure-testng:2.14.0'

ChromeOptions:

    public static ChromeOptions createChromeOptions() {
        ChromeOptions chromeOptions = new ChromeOptions();

        chromeOptions.addArguments("--disable-extensions");
        chromeOptions.addArguments("--disable-web-security");
        chromeOptions.addArguments("--ignore-certificate-errors-spki-list");
        chromeOptions.addArguments("--silent-debugger-extension-api");
        chromeOptions.addArguments("--desktop-window-1080p");
        chromeOptions.addArguments("--no-sandbox");
        chromeOptions.addArguments("--allow-no-sandbox-job");
        chromeOptions.addArguments("--disable-dev-shm-usage");
        chromeOptions.addArguments("--loading-predictor-allow-local-request-for-testing");
        chromeOptions.addArguments("--allow-insecure-localhost");

        return chromeOptions;
    }

Command used to start Selenium Grid with Docker

docker-compose -f docker-compose.yaml up  -d

# 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.4.0-20220831
    container_name: selenium-event-bus
    ports:
      - "4442:4442"
      - "4443:4443"
      - "5557:5557"

  selenium-sessions:
    image: selenium/sessions:4.4.0-20220831
    container_name: selenium-sessions
    ports:
      - "5556:5556"
    depends_on:
      - 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.4.0-20220831
    container_name: selenium-session-queue
    ports:
      - "5559:5559"
    depends_on:
      - selenium-event-bus
    environment:
      - SE_EVENT_BUS_HOST=selenium-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  selenium-distributor:
    image: selenium/distributor:4.4.0-20220831
    container_name: selenium-distributor
    ports:
      - "5553:5553"
    depends_on:
      - selenium-event-bus
      - selenium-sessions
      - 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.4.0-20220831
    container_name: selenium-router
    ports:
      - "4444:4444"
    depends_on:
      - selenium-distributor
      - selenium-sessions
      - 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:latest
    shm_size: 2gb
    depends_on:
      - 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.4.0-20220831
    shm_size: 2gb
    depends_on:
      - 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.4.0-20220831
    shm_size: 2gb
    depends_on:
      - selenium-event-bus
    environment:
      - SE_EVENT_BUS_HOST=selenium-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

### Relevant log output

```shell
Starting ChromeDriver 105.0.5195.19 (b9c217c128c16f53d12f9a02933fcfdec1bf49af-refs/branch-heads/5195@{#176}) on port 42468
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1663773262.638][SEVERE]: bind() failed: Cannot assign requested address (99)
ChromeDriver was started successfully.
15:14:28.117 WARN [DriverServiceSessionFactory.apply] - Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.4.0', revision: 'e5c75ed026a'
System info: host: '82ba8ef3f860', ip: '172.20.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'
Driver info: driver.version: unknown
15:14:28.230 WARN [SeleniumSpanExporter$1.lambda$export$1] - Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.4.0', revision: 'e5c75ed026a'
System info: host: '82ba8ef3f860', ip: '172.20.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'
Driver info: driver.version: unknown
15:14:28.232 WARN [SeleniumSpanExporter$1.lambda$export$1] - org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.4.0', revision: 'e5c75ed026a'
System info: host: '82ba8ef3f860', ip: '172.20.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'
Driver info: driver.version: unknown
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:144)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
        at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:145)
        at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:68)
        at org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:145)
        at org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:362)
        at org.openqa.selenium.grid.node.NewNodeSession.execute(NewNodeSession.java:52)
        at org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
        at org.openqa.selenium.grid.security.RequiresSecretFilter.lambda$apply$0(RequiresSecretFilter.java:64)
        at org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:86)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
        at org.openqa.selenium.grid.node.Node.execute(Node.java:240)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
        at org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)
        at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
        at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
        at org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

15:14:28.241 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "7af7d675b7494d27952bfcae95835005","eventTime": 1663773268121801044,"eventName": "exception","attributes": {"driver.url": "http:\u002f\u002flocalhost:42468","exception.message": "Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.\n  (unknown error: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location \u002fusr\u002fbin\u002fgoogle-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\nBuild info: version: '4.4.0', revision: 'e5c75ed026a'\nSystem info: host: '82ba8ef3f860', ip: '172.20.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'\nDriver info: driver.version: unknown","exception.stacktrace": "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.\n  (unknown error: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location \u002fusr\u002fbin\u002fgoogle-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\nBuild info: version: '4.4.0', revision: 'e5c75ed026a'\nSystem info: host: '82ba8ef3f860', ip: '172.20.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'\nDriver info: driver.version: unknown\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:144)\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:145)\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:68)\n\tat org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:145)\n\tat org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:362)\n\tat org.openqa.selenium.grid.node.NewNodeSession.execute(NewNodeSession.java:52)\n\tat org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.grid.security.RequiresSecretFilter.lambda$apply$0(RequiresSecretFilter.java:64)\n\tat org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:86)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.grid.node.Node.execute(Node.java:240)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)\n\tat java.base\u002fjava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\n\tat java.base\u002fjava.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base\u002fjava.lang.Thread.run(Thread.java:829)\n","exception.type": "org.openqa.selenium.SessionNotCreatedException","logger": "org.openqa.selenium.grid.node.config.DriverServiceSessionFactory","session.capabilities": "{\"goog:chromeOptions\": {\"args\": [  \"--disable-extensions\",  \"--disable-web-security\",  \"--ignore-certificate-errors-spki-list\",  \"--silent-debugger-extension-api\",  \"--desktop-window-1080p\",  \"--no-sandbox\",  \"--allow-no-sandbox-job\",  \"--disable-dev-shm-usage\",  \"--loading-predictor-allow-local-request-for-testing\",  \"--allow-insecure-localhost\"  ],  \"extensions\": [    ]    },    \"se:noVncPort\": 7900,    \"browserName\": \"chrome\",    \"se:vncEnabled\": true    }\n"}}

15:14:28.248 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "7af7d675b7494d27952bfcae95835005","eventTime": 1663773268242742545,"eventName": "Unable to create session with the driver","attributes": {"current.session.count": 0,"logger": "org.openqa.selenium.grid.node.local.LocalNode","session.request.capabilities": "Capabilities {browserName: chrome, goog:chromeOptions: {args: [--disable-extensions, --disable-web-security, --ignore-certificate-errors..., --silent-debugger-extension..., --desktop-window-1080p, --no-sandbox, --allow-no-sandbox-job, --disable-dev-shm-usage, --loading-predictor-allow-l..., --allow-insecure-localhost], extensions: []}}","session.request.downstreamdialect": "[OSS, W3C]"}}

Operating System

macOs Moneterey | Apple M1 Pro

Docker Selenium version (tag)

4.4.0-20220831

jamesmortensen commented 1 year ago

Hi @Naim995 since you're on an Apple M1, the selenium containers won't run on your architecture. Instead, you'll need to use seleniarm containers.

Since this repo is a fork of SeleniumHQ/docker-selenium, a lot of the documentation still references "selenium" instead of "seleniarm". Moreover, I'm not yet building most of the "full grid" components for ARM64.

Are you able to use this instead? I replaced "selenium" with "seleniarm", and removed Edge since there are no arm64 Edge binaries for Linux.

docker-compose-seleniarm-v3.yml:

# To execute this docker-compose yml file use `docker-compose -f docker-compose-seleniarm-v3.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-seleniarm-v3.yml down`
version: "3"
services:
  chromium:
    image: seleniarm/node-chromium:4.4.0-20220903
    shm_size: 2gb
    depends_on:
      - seleniarm-hub
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  firefox:
    image: seleniarm/node-firefox:4.4.0-20220903
    shm_size: 2gb
    depends_on:
      - seleniarm-hub
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  seleniarm-hub:
    image: seleniarm/hub:4.4.0-20220903
    container_name: seleniarm-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"
sudo-naim commented 1 year ago

@jamesmortensen I am still failing to run selenium grid 4 using the docker seleniarm hub. The issue now has to do with the distributor, for some reason its failing and these are the logs:

Distributer container logs:

2022-09-26 12:46:59,082 INFO Included extra file "/etc/supervisor/conf.d/selenium-grid-distributor.conf" during parsing
2022-09-26 12:46:59,084 INFO supervisord started with pid 8
2022-09-26 12:47:00,085 INFO spawned: 'selenium-grid-distributor' with pid 11
Starting Selenium Grid Distributor...
2022-09-26 12:47:00,088 INFO success: selenium-grid-distributor entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
12:47:00.510 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
12:47:00.516 INFO [LoggingOptions.createTracer] - Using OpenTelemetry for tracing
12:47:00.576 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://seleniarm-event-bus:4442 and tcp://seleniarm-event-bus:4443
12:47:00.645 INFO [UnboundZmqEventBus.<init>] - Sockets created
12:47:00.747 INFO [UnboundZmqEventBus.<init>] - Event bus ready
12:47:01.479 INFO [DistributorServer.execute] - Started Selenium distributor 4.0.0-beta-1 (revision 0f2429af7a): http://172.19.0.7:5553
12:47:02.609 WARN [UnboundZmqEventBus.lambda$notifyListeners$10] - Caught exception from listener: org.openqa.selenium.events.EventListener@3164ff2d
org.openqa.selenium.json.JsonException: Unable to create instance of class org.openqa.selenium.grid.data.NodeStatus
Build info: version: '4.0.0-beta-1', revision: '0f2429af7a'
System info: host: '33c101d8b152', ip: '172.19.0.7', os.name: 'Linux', os.arch: 'aarch64', os.version: '5.10.124-linuxkit', java.version: '11.0.9.1'
Driver info: driver.version: unknown
        at org.openqa.selenium.json.StaticInitializerCoercer.lambda$apply$0(StaticInitializerCoercer.java:61)
        at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:145)
        at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:127)
        at org.openqa.selenium.json.Json.toType(Json.java:69)
        at org.openqa.selenium.json.Json.toType(Json.java:55)
        at org.openqa.selenium.json.Json.toType(Json.java:50)
        at org.openqa.selenium.events.Event.getData(Event.java:59)
        at org.openqa.selenium.events.EventListener.accept(EventListener.java:43)
        at org.openqa.selenium.events.EventListener.accept(EventListener.java:25)
        at org.openqa.selenium.events.zeromq.UnboundZmqEventBus.lambda$notifyListeners$10(UnboundZmqEventBus.java:252)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.openqa.selenium.json.StaticInitializerCoercer.lambda$apply$0(StaticInitializerCoercer.java:59)
        ... 14 more
Caused by: java.lang.IllegalArgumentException: Node id must be set
        at org.openqa.selenium.internal.Require.nonNull(Require.java:56)
        at org.openqa.selenium.grid.data.NodeStatus.<init>(NodeStatus.java:54)
        at org.openqa.selenium.grid.data.NodeStatus.fromJson(NodeStatus.java:113)
        ... 19 more

docker-compose.yaml :

version: "3"
services:

  seleniarm-event-bus:
    image: seleniarm/event-bus:4.0.0-beta-1-20210215
    container_name: seleniarm-event-bus
    ports:
      - "4442:4442"
      - "4443:4443"
      - "5557:5557"

  seleniarm-sessions:
    image: seleniarm/sessions:4.0.0-beta-1-20210215
    container_name: seleniarm-sessions
    ports:
      - "5556:5556"
    depends_on:
      - seleniarm-event-bus
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  seleniarm-session-queuer:
    image: seleniarm/session-queuer:4.0.0-beta-1-20210215
    container_name: seleniarm-session-queuer
    ports:
      - "5559:5559"
    depends_on:
      - seleniarm-event-bus
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  seleniarm-distributor:
    image: seleniarm/distributor:4.0.0-beta-1-20210215
    container_name: seleniarm-distributor
    ports:
      - "5553:5553"
    depends_on:
      - seleniarm-event-bus
      - seleniarm-sessions
      - seleniarm-session-queuer
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_SESSIONS_MAP_HOST=seleniarm-sessions
      - SE_SESSIONS_MAP_PORT=5556
      - SE_SESSION_QUEUER_HOST=seleniarm-session-queuer
      - SE_SESSION_QUEUER_PORT=5559

  seleniarm-router:
    image: seleniarm/router:4.0.0-beta-1-20210215
    container_name: seleniarm-router
    ports:
      - "4444:4444"
    depends_on:
      - seleniarm-distributor
      - seleniarm-sessions
      - seleniarm-session-queuer
    environment:
      - SE_DISTRIBUTOR_HOST=seleniarm-distributor
      - SE_DISTRIBUTOR_PORT=5553
      - SE_SESSIONS_MAP_HOST=seleniarm-sessions
      - SE_SESSIONS_MAP_PORT=5556
      - SE_SESSION_QUEUER_HOST=seleniarm-session-queuer
      - SE_SESSION_QUEUER_PORT=5559

  node-chromium:
    image: seleniarm/node-chromium:4.4.0-20220903
    shm_size: 2gb
    depends_on:
      - seleniarm-event-bus
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  firefox:
    image: seleniarm/node-firefox:4.4.0-20220903
    shm_size: 2gb
    depends_on:
      - seleniarm-event-bus
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
jamesmortensen commented 1 year ago

Hi @Naim995 I am not sure that mixing the various versions 4.0.0-beta and 4.4.0 will work together nicely. As a quick experiment, you can try changing the version of node-chromium and node-firefox to 4.0.0-beta-1-20210215.

The browsers will be older, but we will get a clearer picture of whether these components will all work together in the arm environment.

Depending on how that experiment goes, I may be able to build and publish the full grid images.

The challenge with building these components is it takes a really long time to build cross platform images because there is no armhf runner on CircleCI. One possibility is that I can build the full grid components only for arm64 and x86_64 so they don't increase the already 45 minute build process.

What prevents you from using the simpler grid set up with just the hub and the browsers, using the file docker-compose-seleniarm-v3.yml which I shared? What's the advantage you get from running the full grid? Just want to understand the use case.

sudo-naim commented 1 year ago

@jamesmortensen Thank you for helping me, after changing the version of the node-chromium and node firefox to 4.0.0-beta-1-20210215 it works fine.

As for your question, honestly i'm ignorant on the following topic: "What are the advantages of distributed mode in difference to the Hub and Node mode."

My use case is this( since you asked :D ) :

I just got employed by x company and they want me to upgrade from selenium grid 3 to selenium grid 4 with docker. My first thought was/is to try out the distributed mode and test the execution time between distributed mode and hub and node mode and identify the pros and cons on my own machine first (Macbook Pro M1).

Currently they/we have 600 mobile app and web regression tests. It is important that we can easily scale based on our needs, meaning configure new nodes with different device properties, different os, different screen sizes, different browsers and so on.

It is also important that we can run tests in parallel and the end goal would be to run them in kubernetes (so create the containers, run the tests and destroy them), so that we will not need to pay for static virtual machines.

I know this is not the place but i would appreciate your advice and knowledge in the advantages of distributed mode over hub and nodes mode ?

jamesmortensen commented 1 year ago

@Naim995 I've only ever used the hub and nodes together, never the distributor, session, or session-queue, so I'm not really sure either.

But if you're running the grid in the cloud, then I assume you will use an x86_64 environment?

I can look into adding those images to the build process so that you will have up to date browser nodes in the M1, but it may take awhile.

jamesmortensen commented 1 year ago

@Naim995 I built all of the images for arm64. Can you please try these unofficial images:

Replace "seleniarm" with "jamesmortensen1" and the version and build date with "4.4.0-20220927". For example:

Please let me know if the latest builds of the full grid components function correctly. If they do, then I will add them to the Seleniarm build and deploy process.

sudo-naim commented 1 year ago

@jamesmortensen They do work correctly. There is just one error which is logged in the node-chromium about the nvc, which i guess is not supported for arm yet. This is the full log (the nvc error is displayed after "Starting Selenium Grif Node..."):

2022-09-27 07:30:33,161 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
2022-09-27 07:30:33,173 INFO RPC interface 'supervisor' initialized
2022-09-27 07:30:33,173 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2022-09-27 07:30:33,173 INFO supervisord started with pid 8
2022-09-27 07:30:34,175 INFO spawned: 'xvfb' with pid 9
2022-09-27 07:30:34,176 INFO spawned: 'vnc' with pid 10
2022-09-27 07:30:34,177 INFO spawned: 'novnc' with pid 11
2022-09-27 07:30:34,178 INFO spawned: 'selenium-node' with pid 13
2022-09-27 07:30:34,219 INFO success: selenium-node entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
Generating Selenium Config
Configuring server...
Setting up SE_NODE_HOST...
Setting up SE_NODE_PORT...
Setting up SE_NODE_GRID_URL...
Selenium Grid Node configuration: 
[events]
publish = "tcp://jamesmortensen1-event-bus:4442"
subscribe = "tcp://jamesmortensen1-event-bus:4443"

[node]
session-timeout = "300"
override-max-sessions = false
detect-drivers = false
drain-after-session-count = 0
max-sessions = 1

[[node.driver-configuration]]
display-name = "chrome"
stereotype = '{"browserName": "chrome", "browserVersion": "105.0", "platformName": "Linux"}'
max-sessions = 1

Starting Selenium Grid Node...
2022-09-27 07:30:35,230 INFO success: xvfb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-09-27 07:30:35,230 INFO success: vnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-09-27 07:30:35,230 INFO success: novnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
07:30:35.266 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
2022-09-27 07:30:35,267 INFO exited: novnc (exit status 1; not expected)
2022-09-27 07:30:35,268 INFO spawned: 'novnc' with pid 108
07:30:35.271 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
2022-09-27 07:30:35,335 INFO exited: novnc (exit status 1; not expected)
07:30:35.415 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://jamesmortensen1-event-bus:4442 and tcp://jamesmortensen1-event-bus:4443
07:30:35.486 INFO [UnboundZmqEventBus.<init>] - Sockets created
07:30:36.494 INFO [UnboundZmqEventBus.<init>] - Event bus ready
2022-09-27 07:30:36,497 INFO spawned: 'novnc' with pid 147
2022-09-27 07:30:36,514 INFO exited: novnc (exit status 1; not expected)
07:30:36.571 INFO [NodeServer.createHandlers] - Reporting self as: http://172.21.0.4:5555
07:30:36.580 INFO [NodeOptions.getSessionFactories] - Detected 5 available processors
07:30:36.601 INFO [NodeOptions.report] - Adding chrome for {"browserVersion": "105.0","se:noVncPort": 7900,"browserName": "chrome","platformName": "LINUX","se:vncEnabled": true} 1 times
07:30:36.608 INFO [Node.<init>] - Binding additional locator mechanisms: name, relative, id
07:30:36.715 INFO [NodeServer$1.start] - Starting registration process for Node http://172.21.0.4:5555
07:30:36.717 INFO [NodeServer.execute] - Started Selenium node 4.4.0 (revision e5c75ed026a): http://172.21.0.4:5555
07:30:36.730 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
07:30:36.827 INFO [NodeServer.lambda$createHandlers$2] - Node has been added
2022-09-27 07:30:39,252 INFO spawned: 'novnc' with pid 169
2022-09-27 07:30:39,264 INFO exited: novnc (exit status 1; not expected)
2022-09-27 07:30:42,277 INFO spawned: 'novnc' with pid 177
2022-09-27 07:30:42,290 INFO exited: novnc (exit status 1; not expected)
2022-09-27 07:30:43,291 INFO gave up: novnc entered FATAL state, too many start retries too quickly
jamesmortensen commented 1 year ago

@Naim995 That's great to hear. I'll work on getting these officially in our build process over the weekend.

regarding VNC and noVNC, they are supported on ARM machines. You can generally connect to a node via port 5900 using a VNC client or via port 7900 in a web browser (noVNC). But I'd say this is another issue altogether and probably not something you'll be using if your goal is to scale up to 600 devices. As long as noVNC crashes don't interfere with other things, you should be fine.

sudo-naim commented 1 year ago

Thanks a ton @jamesmortensen !