我正在尝试在 Hashicorp Nomad 中设置 Selenium Grid,但我不知道如何使网络正常工作。我想要的是拥有一个硒集线器和 8 个铬节点。我发现如果我将节点任务放入自己的组中,我只能对节点任务进行多次分配。
在本地运行它,我会像这样启动网格:
docker network create grid
docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4
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 /dev/shm:/dev/shm selenium/node-chrome:4
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 /dev/shm:/dev/shm selenium/node-chrome:4
...
我需要如何配置网络才能使其正常工作?
我现在的工作是这样的:
job "selenium" {
datacenters = ["dc1"]
type = "service"
group "selenium_hub" {
network {
}
task "selenium_hub" {
driver = "docker"
config {
image = "selenium/hub:4"
}
}
}
group "selenium_nodes" {
count = 8
network {
}
task "selenium_node" {
driver = "docker"
env {
SE_EVENT_BUS_HOST = "selenium-hub"
SE_EVENT_BUS_PUBLISH_PORT = "4442"
SE_EVENT_BUS_SUBSCRIBE_PORT = "4443"
}
config {
image = "selenium/node-chrome:4"
}
}
}
}