Selenium docker grids running in parallel on one host machine

263 views
Skip to first unread message

Jessica Marshall

unread,
Oct 12, 2017, 12:31:37 PM10/12/17
to Selenium Users
Background info: We are wanting to use docker as infrastructure for selenium grid.  The idea is that each test execution will spin up a docker grid, execute tests, and then tear down grid.  This would all be setup through Jenkins.  However, some jobs will be running in parallel, so that the grids will be running in parallel.  There is one linux host machine just for the docker containers, and a separate linux machine for Jenkins.  

Has any one had success in running multiple selenium docker grids in parallel on one host machine?

It looks like the default/typical way is to have the hub bound to the host container IP address and use port 4444.  However, if I want multiple grids running on one host, they cannot all use port 4444.  

Thoughts:
1. assign multiple IPs to the linux host & assign one to each hub/grid running.  
2. Have each grid pick a random port to run on (bound to linux host IP)

How to do either one programmatically seems rather difficult.

I would appreciate any feedback/recommendations/shared experiences

Thanks,
Jessica

⇜Krishnan Mahadevan⇝

unread,
Oct 12, 2017, 1:35:29 PM10/12/17
to Selenium Users
Spinning off multiple grids for multiple tests is kind of an overkill.

Instead why not consider working with an on-demand grid kind of a setup, wherein the Hub remains as a single instance, but the nodes are spun off on an on-demand basis.


Please see if that helps.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e765124a-7066-41d7-98cb-c8c806cdca4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jessica Marshall

unread,
Oct 12, 2017, 1:44:36 PM10/12/17
to Selenium Users
I may have made this unclear - but the 'tests' I'm referring to are regression suites that are executed through jenkins, are can be for different teams, different applications under test.  So the thought process was the job will decide how large of a grid the execution suite needs, and then spin up a grid to accommodate.  

Thank you for your feedback - you proposal is interesting and I will look into it further.  



On Thursday, October 12, 2017 at 1:35:29 PM UTC-4, Krishnan Mahadevan wrote:
Spinning off multiple grids for multiple tests is kind of an overkill.

Instead why not consider working with an on-demand grid kind of a setup, wherein the Hub remains as a single instance, but the nodes are spun off on an on-demand basis.


Please see if that helps.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Oct 12, 2017 at 8:34 PM, Jessica Marshall <mcga...@gmail.com> wrote:
Background info: We are wanting to use docker as infrastructure for selenium grid.  The idea is that each test execution will spin up a docker grid, execute tests, and then tear down grid.  This would all be setup through Jenkins.  However, some jobs will be running in parallel, so that the grids will be running in parallel.  There is one linux host machine just for the docker containers, and a separate linux machine for Jenkins.  

Has any one had success in running multiple selenium docker grids in parallel on one host machine?

It looks like the default/typical way is to have the hub bound to the host container IP address and use port 4444.  However, if I want multiple grids running on one host, they cannot all use port 4444.  

Thoughts:
1. assign multiple IPs to the linux host & assign one to each hub/grid running.  
2. Have each grid pick a random port to run on (bound to linux host IP)

How to do either one programmatically seems rather difficult.

I would appreciate any feedback/recommendations/shared experiences

Thanks,
Jessica

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

Diego Fernando Molina

unread,
Oct 13, 2017, 7:40:27 AM10/13/17
to Selenium Users
I have a different opinion on this, I think spinning independent grids for test suites is not always an overkill, it might be a good solution for a given scenario. I guess what Jessica wants is to have an independent environment for each team running their tests.

Now, about the docker images, it can be done. You could run several hubs in the same host and use different ports. Inside the container it is always using port 4444 (even though there is a PR to change that), and you can map that port 4444 to any port you want in the host. E.g:

One grid "selenium-hub_1" running on port 4444
$ docker run -d -p 4444:4444 --name selenium-hub_1 selenium/hub:3.6.0-bromine
$ docker run -d --link selenium-hub_1:hub selenium/node-chrome:3.6.0-bromine
$ docker run -d --link selenium-hub_1:hub selenium/node-firefox:3.6.0-bromine

and another one "selenium-hub_2" running on port 7777

$ docker run -d -p 7777:4444 --name selenium-hub_2 selenium/hub:3.6.0-bromine
$ docker run -d --link selenium-hub_2:hub selenium/node-chrome:3.6.0-bromine
$ docker run -d --link selenium-hub_2:hub selenium/node-firefox:3.6.0-bromine

Then just go to http://localhost:4444/grid/console and http://localhost:7777/grid/console to check both your grids. You can check more documentation in the github repo: https://github.com/SeleniumHQ/docker-selenium 

That is one way to solve it, but you can also check other tools, like the one Krishnan mentions.

Hope this helps, 

Diego

Jessica Marshall

unread,
Oct 13, 2017, 8:55:54 AM10/13/17
to Selenium Users
Diego - 

Thanks for pointing me in the right direction.  That could definitely work and what we could do is have each job in jenkins assigned a specific port, and the grid for that job will always be run on that port.  I think originally I was overthinking it and thought that we had to have a way to programatically assign an open port.  

I guess the challenge would be to see if we can make the port issue work with docker-compose.  As you have the ports assigned in the yml file and there is only one yml file.  I think you can use environmental variables to overwrite the default port, but can't pass them in through the docker-compose up command.  Otherwise if we want 30 node containers, we'll have to repeat that docker run command like 30 times.  Interesting challenge - I'll have to think more about it.  

Thanks,
Jessica

Prasad S

unread,
Oct 13, 2017, 9:06:28 PM10/13/17
to seleniu...@googlegroups.com
This sounds very interesting even while reading.

 I'm interested to know how you took it forward. If possible share details here. 

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d698defe-accf-4eca-997c-42516ee6df3f%40googlegroups.com.

Krishnan Mahadevan

unread,
Oct 14, 2017, 5:30:19 AM10/14/17
to seleniu...@googlegroups.com

Diego,

 

>>>> I have a different opinion on this, I think spinning independent grids for test suites is not always an overkill, it might be a good solution for a given scenario. I guess what Jessica wants is to have an independent environment for each team running their tests.

 

Yes. But the hub merely plays the role of a matcher+router. It’s the nodes that are responsible for actually honoring the tests. So this requirement can very well be achieved by a single hub, which is capable of juggling between different environment needs in the form of containers. Running multiple hubs doesn’t add a lot of value, but it adds a bit of complexity because the tests have to now start figuring out what would be the Hub port number as well, so that the tests can be routed to the appropriate hub.

 

That was my rationale behind opining that spinning off multiple hubs was perhaps an overkill for this scenario.

 

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

Reply all
Reply to author
Forward
0 new messages