Closed kiam123 closed 6 years ago
ggr+nginx i do this
docker-compose.yml
version: '3'
services:
nginx:
image: nginx:stable-alpine
depends_on:
- ggr
ports:
- 4445:4445
restart: unless-stopped
volumes:
- ./etc/nginx/conf.d/ggr.conf:/etc/nginx/conf.d/ggr.conf:ro
ggr:
image: aerokube/ggr:latest-release
ports:
- 5555:5555
restart: unless-stopped
volumes:
- ./etc/grid-router:/etc/grid-router:ro
command: ["-listen", ":5555"]
ggr.conf
upstream ggr {
server xxx.xxx.xx.xx:5555 weight=10 max_fails=3 fail_timeout=10s;
}
server {
server_name www.ggr.com;
location / {
proxy_pass http://ggr;
}
}
test.xml
<qa:browsers xmlns:qa="urn:config.gridrouter.qatools.ru">
<browser name="chrome" defaultVersion="66.0">
<version number="66.0" platform="LINUX">
<region name="Taiwan">
<host name="xxx.xxx.xx.xx" port="4444" count="1"/>
</region>
</version>
</browser>
</qa:browsers>
I have two servers, the windows system does GGR and linux do selenoid, I have already got GGR, but the image error.
how to fix this problem
@kiam123 linking error happens because Selenoid fails to start. I think this is because you current directory does not contain browsers.json
.
@vania-pooh nice, fix the problem.
Now my server can check the status "curl http://localhost:4444/status"
, but the external computer can't connect to my server status "xxx.xxx.xx.xx:4444/status"
Most probably firewall does not allow to connect from external sources.
2018-07-28 22:54 GMT+03:00 kr lee notifications@github.com:
nice, i fix the problem. Now my computer can check the status "curl http://localhost:4444/status", but the external computer can't connect to my server status "xxx.xxx.xx.xx:4444/status"
[image: image] https://user-images.githubusercontent.com/14953180/43360165-fb9d43d2-92e2-11e8-83df-3fa338411548.png
[image: image] https://user-images.githubusercontent.com/14953180/43360116-574baab2-92e2-11e8-9441-2c4aa2bda344.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aerokube/selenoid-ui/issues/122#issuecomment-408631225, or mute the thread https://github.com/notifications/unsubscribe-auth/ABWNbSoKIyTX5_D_DM-itsyzzV1XZmMEks5uLMFcgaJpZM4VlDMb .
@aandryashin but i can connect selenoid-ui "my_server_ip:8080"
, can not connect selenoid status "my_server_ip:4444/status"
@aandryashin
@kiam123 both containers are running on the same host. 8080 is one of the standard HTTP ports in addition to 80 and 443, whereas 4444 used in Selenium is not so widely used. So I would check any firewall rules on your server or in your network.
version: '3'
services:
selenoid:
image: "aerokube/selenoid:1.7.1"
network_mode: bridge
ports:
- "8082:4444"
volumes:
- "$PWD:/etc/selenoid/" # assumed current dir contains browsers.json
- "/var/run/docker.sock:/var/run/docker.sock"
selenoid-ui:
image: "aerokube/selenoid-ui:1.6.1"
network_mode: bridge
depends_on:
- selenoid
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444"]
@vania-pooh
thank you, i change 8082:4444 fix this problem, i think is my school is block 4444 this port.
Now if i can use docker-compose set up container limit/memory/cpu? because use selenoid
software type $ ./selenoid start --args "-limit 10"
can set up 10 containers
@kiam123 take a look at the following Selenoid args:
-cpu value
Containers cpu limit as float e.g. 0.2 or 1.0
-mem value
Containers memory limit e.g. 128m or 1g
@vania-pooh What is missing from my GGR? Can not load banlancing
windows do Ggr, linux do selenoid
Ggr
ggr docker-compose.yml
file
version: '3'
services:
nginx:
image: nginx:stable-alpine
depends_on:
- ggr
ports:
- 4444:4444
restart: unless-stopped
volumes:
- ./etc/nginx/conf.d/ggr.conf:/etc/nginx/conf.d/ggr.conf:ro
ggr:
image: aerokube/ggr:latest-release
ports:
- 5555:5555
restart: unless-stopped
volumes:
- ./etc/grid-router:/etc/grid-router:ro
command: ["-listen", ":5555"]
ggr.conf
upstream ggr {
server my_selenoid_ip:5555 weight=10 max_fails=3 fail_timeout=10s;
}
server {
listen 4444 default_server;
listen [::]:4444 default_server;
location / {
proxy_pass http://ggr;
}
}
test.xml
<qa:browsers xmlns:qa="urn:config.gridrouter.qatools.ru">
<browser name="chrome" defaultVersion="66.0">
<version number="66.0" platform="LINUX">
<region name="Taiwan">
<host name="my_selenoid_ip" port="8082" count="5"/>
</region>
</version>
</browser>
</qa:browsers>
Selenoid
docker-compose.yml
version: '3'
services:
selenoid:
image: "aerokube/selenoid:1.7.1"
network_mode: bridge
ports:
- "8082:4444"
volumes:
- "$PWD:/etc/selenoid/" # assumed current dir contains browsers.json
- "/var/run/docker.sock:/var/run/docker.sock"
selenoid-ui:
image: "aerokube/selenoid-ui:1.6.1"
network_mode: bridge
depends_on:
- selenoid
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444"]
@kiam123 you are requesting Chrome 66.0
in your tests and does no have such browser name and version in quota XML file. You could try to remove platform
attribute and see whether it helps.
@vania-pooh I removed the platform = "LINUX"
attribute of test.xml
, but there is still a problem. I don't know if there is a problem with selenoid's browsers.json
, so I put it in.
windows do Ggr, linux do selenoid
↓↓↓↓↓↓↓↓↓ Ggr ↓↓↓↓↓↓↓↓↓
ggr docker-compose.yml
file
version: '3'
services:
nginx:
image: nginx:stable-alpine
depends_on:
- ggr
ports:
- 4444:4444
restart: unless-stopped
volumes:
- ./etc/nginx/conf.d/ggr.conf:/etc/nginx/conf.d/ggr.conf:ro
ggr:
image: aerokube/ggr:latest-release
ports:
- 5555:5555
restart: unless-stopped
volumes:
- ./etc/grid-router:/etc/grid-router:ro
command: ["-listen", ":5555"]
ggr.conf
upstream ggr {
server my_selenoid_ip:5555 weight=10 max_fails=3 fail_timeout=10s;
}
server {
listen 4444 default_server;
listen [::]:4444 default_server;
location / {
proxy_pass http://ggr;
}
}
test.xml
<qa:browsers xmlns:qa="urn:config.gridrouter.qatools.ru">
<browser name="chrome" defaultVersion="66.0">
<version number="66.0">
<region name="Taiwan">
<host name="my_selenoid_ip" port="8082" count="5"/>
</region>
</version>
</browser>
</qa:browsers>
users.htpasswd
test:$apr1$PIemlvQk$5VOYe2E/TCGfyMAwCGFfg1
↓↓↓↓↓↓↓↓↓ Selenoid ↓↓↓↓↓↓↓↓↓
docker-compose.yml
version: '3'
services:
selenoid:
image: "aerokube/selenoid:1.7.1"
network_mode: bridge
ports:
- "8082:4444"
volumes:
- "$PWD:/etc/selenoid/" # assumed current dir contains browsers.json
- "/var/run/docker.sock:/var/run/docker.sock"
selenoid-ui:
image: "aerokube/selenoid-ui:1.6.1"
network_mode: bridge
depends_on:
- selenoid
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444"]
browsers.json
{
"chrome": {
"default": "67.0",
"versions": {
"66.0": {
"image": "selenoid/vnc_chrome:66.0",
"port": "4444",
"path": "/"
},
"67.0": {
"image": "selenoid/vnc_chrome:67.0",
"port": "4444",
"path": "/"
}
}
},
"firefox": {
"default": "61.0",
"versions": {
"60.0": {
"image": "selenoid/vnc_firefox:60.0",
"port": "4444",
"path": "/wd/hub"
},
"61.0": {
"image": "selenoid/vnc_firefox:61.0",
"port": "4444",
"path": "/wd/hub"
}
}
},
"opera": {
"default": "54.0",
"versions": {
"53.0": {
"image": "selenoid/vnc_opera:53.0",
"port": "4444",
"path": "/"
},
"54.0": {
"image": "selenoid/vnc_opera:54.0",
"port": "4444",
"path": "/"
}
}
}
}
Java code
import java.net.MalformedURLException;
import java.net.URL;
import java.util.UUID;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class DemoTest {
private RemoteWebDriver driver;
@Before
public void openBrowser() throws Exception {
final DesiredCapabilities browser = DesiredCapabilities.chrome();
browser.setCapability("screenResolution", "1920x1080x24");
driver = new RemoteWebDriver(new URL("http://test:test-password@my_ggr_server_ip:4444/wd/hub"), browser);
}
@Test
public void browserTesting() throws Exception {
try {
Thread.sleep(3000);
driver.get("http://duckduckgo.com/");
WebElement input = driver.findElement(By.cssSelector("input#search_form_input_homepage"));
input.sendKeys(Keys.chord("selenium",Keys.ENTER));
Thread.sleep(10000);
} finally {
// takeScreenshot(driver);
}
}
public void takeScreenshot(WebDriver driver) {
byte[] screen = ((TakesScreenshot)new Augmenter().augment(driver)).getScreenshotAs(OutputType.BYTES);
UUID uuid = UUID.randomUUID();
// FileUtils.writeByteArrayToFile(new File(uuid.toString() + ".png"),screen);
}
@After
public void closeDrive() {
if(driver != null) {
driver.quit();
driver = null;
}
}
}
@kiam123 take a look at Selenoid logs using docker logs selenoid
. There should be an error message inside. Right now Ggr tries to create a session but for some reason Selenoid fails to do this. Did you pull respective Docker images?
@vania-pooh sry is my fault, I did not open selenoid.
sorry, I have a problem again. I have been looking for this problem myself https://github.com/docker/for-win/issues/1829
. I need to use COMPOSE_CONVERT_WINDOWS_PATHS=1 but I still can't solve it.
windows10 problem
version: '3'
services:
selenoid:
image: "aerokube/selenoid:1.7.1"
network_mode: bridge
ports:
- "8082:4444"
volumes:
- ".:/etc/selenoid/" # assumed current dir contains browsers.json
- "/var/run/docker.sock:/var/run/docker.sock"
selenoid-ui:
image: "aerokube/selenoid-ui:1.6.1"
network_mode: bridge
depends_on:
- selenoid
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444"]
@kiam123 in Windows mount should be - "//var/run/docker.sock:/var/run/docker.sock"
(with 2 slashes at the beginning).
@vania-pooh same the problem
version: '3'
services:
selenoid:
image: "aerokube/selenoid:1.7.1"
network_mode: bridge
ports:
- "8082:4444"
volumes:
- ".:/etc/selenoid/" # assumed current dir contains browsers.json
- "//var/run/docker.sock:/var/run/docker.sock"
selenoid-ui:
image: "aerokube/selenoid-ui:1.6.1"
network_mode: bridge
depends_on:
- selenoid
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444"]
my docker version
@vania-pooh i fix this problem, create .env
inside type COMPOSE_CONVERT_WINDOWS_PATHS=1
@kiam123 is this issue now resolved?
@vania-pooh The last problem I have is to set up multiple selenoid container, memory, cpu usage, but I am still trying to set it, because I am not familiar with docker, so I am still researching.
@vania-pooh You taught me cpu, memory, but didn't teach me how to set up multiple containers in docker-compose, use cm
to quickly set the number of containers, like ./cm selenoid start --args "-limit 50"
-cpu value
Containers cpu limit as float e.g. 0.2 or 1.0
-mem value
Containers memory limit e.g. 128m or 1g
@kiam123 e.g. ./cm selenoid start --args "-limit 50 -cpu 1.0 -mem 500m"
.
@vania-pooh can not use docker-compose.yml
do this command?
docker-compose.yml
version: '3'
services:
selenoid:
image: "aerokube/selenoid:1.7.1"
network_mode: bridge
ports:
- "8082:4444"
volumes:
- ".:/etc/selenoid/" # assumed current dir contains browsers.json
- "/var/run/docker.sock:/var/run/docker.sock"
selenoid-ui:
image: "aerokube/selenoid-ui:1.6.1"
network_mode: bridge
depends_on:
- selenoid
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444"]
@kiam123 you certainly can use Docker compose. Your docker-compose.yml
file seems to be correct. What is not working?
@vania-pooh i do not how insert args
to docker-compose.yml
--args "-limit 50 -cpu 1.0 -mem 500m"
like this?
version: '3'
services:
selenoid:
image: "aerokube/selenoid:1.7.1"
args:
-limit 50
network_mode: bridge
ports:
- "8082:4444"
volumes:
- ".:/etc/selenoid/" # assumed current dir contains browsers.json
- "/var/run/docker.sock:/var/run/docker.sock"
selenoid-ui:
image: "aerokube/selenoid-ui:1.6.1"
network_mode: bridge
depends_on:
- selenoid
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444"]
@kiam123 section is called command
in docker-compose
. https://docs.docker.com/compose/compose-file/#command
@vania-pooh I wrote two and I can't change it.
version: '3'
services:
selenoid:
image: "aerokube/selenoid:1.7.1"
network_mode: bridge
ports:
- "8082:4444"
volumes:
- ".:/etc/selenoid/" # assumed current dir contains browsers.json
- "/var/run/docker.sock:/var/run/docker.sock"
command: ["start", "--args", "-limit", "50"]
selenoid-ui:
image: "aerokube/selenoid-ui:1.6.1"
network_mode: bridge
depends_on:
- selenoid
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444" ]
version: '3'
services:
selenoid:
image: "aerokube/selenoid:1.7.1"
network_mode: bridge
ports:
- "8082:4444"
volumes:
- ".:/etc/selenoid/" # assumed current dir contains browsers.json
- "/var/run/docker.sock:/var/run/docker.sock"
selenoid-ui:
image: "aerokube/selenoid-ui:1.6.1"
network_mode: bridge
depends_on:
- selenoid
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444", "start", "--args", "-limit", "50"]
@kiam123 should be like this:
version: '3'
services:
selenoid:
image: "aerokube/selenoid:1.7.1"
network_mode: bridge
ports:
- "8082:4444"
volumes:
- ".:/etc/selenoid/" # assumed current dir contains browsers.json
- "/var/run/docker.sock:/var/run/docker.sock"
command: ["-limit", "50", "-cpu", "1.0", "-mem", "512m"]
selenoid-ui:
image: "aerokube/selenoid-ui:1.6.1"
network_mode: bridge
depends_on:
- selenoid
links:
- selenoid
ports:
- "8080:8080"
command: ["--selenoid-uri", "http://selenoid:4444" ]
@vania-pooh Thank you very much, because there are a lot of things that won’t bother you.This issue can close
selenoid+selenoid-ui i do this, but image error
browser.json
docker-compose.yml