Closed sudo-naim closed 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"
@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
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.
@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 ?
@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.
@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.
@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
@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.
Thanks a ton @jamesmortensen !
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:
ChromeOptions:
Command used to start Selenium Grid with Docker
Operating System
macOs Moneterey | Apple M1 Pro
Docker Selenium version (tag)
4.4.0-20220831