ddavison / selenium-openshift-templates

OpenShift Templates for a scalable Selenium infrastructure
43 stars 64 forks source link

Selenium Hub keeps crashing #1

Closed minhlongdo closed 7 years ago

minhlongdo commented 8 years ago

Hi,

I appreciate that you are making you selenium template publicly available.

I was wondering if there are any special requirements to run to use template? The reason I am asking is because the pod is crashing with the following output:

1   /opt/bin/entry_point.sh: line 6: /opt/selenium/config.json: Permission denied
2   starting selenium hub with configuration:
3   cat: /opt/selenium/config.json: No such file or directory
4   14:26:57.404 INFO - Launching Selenium Grid hub
5   
6   -------------------------------
7   Running as a grid hub:
8   -------------------------------
9   
10  Usage: java -jar selenium-server.jar -role hub [options]
11  
12    -host:
13      <IP | hostname> : usually not needed and determined
14        automatically. For exotic network configuration, network with
15        VPN, specifying the host might be necessary.
16  
17    -port:
18      <xxxx> : the port the remote/hub will listen on. Default to 4444.
19  
20    -throwOnCapabilityNotPresent:
21      <true | false> default to true. If true, the hub will reject test
22        requests right away if no proxy is currently registered that can
23        host that capability.Set it to false to have the request queued
24        until a node supporting the capability is added to the grid.
25  
26    -newSessionWaitTimeout:
27      <XXXX>. Default to no timeout ( -1 ) the time in ms after which a
28        new test waiting for a node to become available will time
29        out.When that happens, the test will throw an exception before
30        starting a browser.
31  
32    -capabilityMatcher:
33      a class implementing the CapabilityMatcher interface. Defaults to
34        org.openqa.grid.internal.utils.DefaultCapabilityMatcher. Specify
35        the logic the hub will follow to define if a request can be
36        assigned to a node.Change this class if you want to have the
37        matching process use regular expression instead of exact match
38        for the version of the browser for instance. All the nodes of a
39        grid instance will use the same matcher, defined by the registry.
40  
41    -prioritizer:
42      a class implementing the Prioritizer interface. Default to null (
43        no priority = FIFO ).Specify a custom prioritizer if you need the
44        grid to process the tests from the CI, or the IE tests first for
45        instance.
46  
47    -servlets:
48      <com.mycompany.MyServlet,com.mycompany.MyServlet2> to register a
49        new servlet on the hub/node. The servlet will accessible under
50        the path  /grid/admin/MyServlet /grid/admin/MyServlet2
51  
52    -grid1Yml:
53      a YML file following grid1 format.
54  
55    -hubConfig:
56      a JSON file following grid2 format that defines the hub
57        properties.
58  
59    -browserTimeout:
60      The timeout in seconds a browser can hang
61  
62  This synopsis lists options available in hub role only. To get help
63    on the command line options available for other roles run the server
64    with -help name and the corresponding -role name value.
65  org.openqa.grid.common.exception.GridConfigurationException: Error with the JSON of the config : /opt/selenium/config.json is not a valid resource.
66      at org.openqa.grid.internal.utils.GridHubConfiguration.loadFromJSON(GridHubConfiguration.java:334)
67      at org.openqa.grid.internal.utils.GridHubConfiguration.build(GridHubConfiguration.java:144)
68      at org.openqa.grid.selenium.GridLauncher$2.launch(GridLauncher.java:72)
69      at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:127)
70  Caused by: java.lang.RuntimeException: /opt/selenium/config.json is not a valid resource.
71      at org.openqa.grid.common.JSONConfigurationUtils.loadJSON(JSONConfigurationUtils.java:54)
72      at org.openqa.grid.internal.utils.GridHubConfiguration.loadFromJSON(GridHubConfiguration.java:281)
73      ... 3 more

Any help you could provide is appreciated.

Thanks, Minh

ddavison commented 8 years ago

This is being caused because you are using OpenShift Origin.

These particular templates were created for OpenShift Enterprise. The problem is, the newest version of Origin enforces a policy of an arbitrary user ID that has sudo'ers rather than running as root.

basically when openshift runs the docker containers, it doesn't run as root, it runs as an arbitrary user created automatically.

Even though i'm a committer to Selenium, i don't have access to the docker-selenium repository, but I do have a pull request in: https://github.com/SeleniumHQ/docker-selenium/pull/185

This pull request here ^ actually fixes this issue you are getting. In the meantime, if you want, instead of image: selenium/hub use: image: ddavison/docker-selenium-ephemeral:latest and it will fix the issue. that's a container I pushed myself until that pull requests gets merged in. I need to poke the guys again.

ddavison commented 7 years ago

I've merged in https://github.com/SeleniumHQ/docker-selenium/pull/185 so this issue should no longer exist for the newer versions! 👍