zalando / zalenium

A flexible and scalable container based Selenium Grid with video recording, live preview, basic auth & dashboard.
https://opensource.zalando.com/zalenium/
Other
2.39k stars 574 forks source link

Remove the need for sudo when running in Kubernetes/OpenShift mode #212

Closed mojsha closed 6 years ago

mojsha commented 7 years ago

Going through your scripts, I could see that the sudo access is only needed when running in non-Kubernetes/OpenShift mode.

Can you remove the need for privileged access if it's executed in Kubernetes/OpenShift mode?

We would like to use Zalenium in a production setup with everything running in non-privileged mode.

diemol commented 7 years ago

Hi @mojsha,

I know we were talking about it in the Gitter channel, but I forgot where exactly you mean that we are using sudo.

If you were checking our scripts, could you please point us to the line where it should be changed. You can also send us a PR if you want :)

mojsha commented 7 years ago

It was a while ago but I think it was this: https://github.com/zalando/zalenium/blob/0dd1e33d8316ec95075b0d6ec061e06fbcffcd33/scripts/entry.sh#L93

pearj commented 6 years ago

I finally discovered a way to run OpenShift in Travis. This project does it via oc cluster up instead of inside minishift https://github.com/tnozicka/openshift-acme/blob/master/.travis.yml

Not sure if it helps, but it does mean we can have integration tests with OpenShift. I remember @elgalu trying it before.

mojsha commented 6 years ago

@diemol Ok, it looks like it's almost working now apart from the following issues:

mkdir: cannot create directory ‘logs’: Permission denied
--
  | Can't load log handler "java.util.logging.FileHandler"
  | java.nio.file.NoSuchFileException: /home/seluser/logs/zalenium0.log.lck
  | java.nio.file.NoSuchFileException: /home/seluser/logs/zalenium0.log.lck
  | at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
  | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
  | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
  | at sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:177)
  | at java.nio.channels.FileChannel.open(FileChannel.java:287)
  | at java.nio.channels.FileChannel.open(FileChannel.java:335)
  | at java.util.logging.FileHandler.openFiles(FileHandler.java:459)
  | at java.util.logging.FileHandler.<init>(FileHandler.java:263)
  | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  | at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  | at java.lang.Class.newInstance(Class.java:442)
  | at java.util.logging.LogManager$5.run(LogManager.java:966)
  | at java.security.AccessController.doPrivileged(Native Method)
  | at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
  | at java.util.logging.LogManager.initializeGlobalHandlers(LogManager.java:1578)
  | at java.util.logging.LogManager.access$1500(LogManager.java:145)
  | at java.util.logging.LogManager$RootLogger.accessCheckedHandlers(LogManager.java:1667)
  | at java.util.logging.Logger.getHandlers(Logger.java:1777)
  | at org.openqa.grid.selenium.GridLauncherV3.configureLogging(GridLauncherV3.java:212)
  | at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:92)

and

Enabling basic auth via startup script...
  | htpasswd: cannot create file /etc/nginx/.htpasswd
diemol commented 6 years ago

Hi @mojsha,

Please check again with the latest release https://github.com/zalando/zalenium/releases/tag/3.6.0d

mojsha commented 6 years ago

Now it's "working" in the sense that it now says the following:

` Enabling basic auth via startup script...

  | Adding password for user zalenium   | Starting Nginx reverse proxy...   | Starting Selenium Hub...

`

but I can access it without username/password and it will just execute my tests fine.

It doesn't look like the basic is actually enabled?

diemol commented 6 years ago

Hi @mojsha,

The auth part was broken, now it works again and it was just released, please check

https://github.com/zalando/zalenium/releases/tag/3.6.0f

mojsha commented 6 years ago

Back to the same old error:

`

--WARN 10:46:24:676019581 We don't have sudo

  | Kubernetes service account found.   | -- LOG 10:46:24:752868685 Running additional checks...   | Copying files for Dashboard...   | Enabling basic auth via startup script...   | htpasswd: cannot create file /home/seluser/.htpasswd   | Starting Nginx reverse proxy...   | Starting Selenium Hub...   | mkdir: cannot create directory ‘logs’: Permission denied   | Can't load log handler "java.util.logging.FileHandler"

`

diemol commented 6 years ago

Didn't really expect that. I will try with minishift and also try @pearj's suggestion for Travis. Will get back to you soon.

diemol commented 6 years ago

Hi @mojsha,

I tried to use minishift and I got kind of confused... is there a way that I can just specify the manifests and have the deployment created?

For example: if I want to try Zalenium in minikube, I just start minikube, pull the images, and run kubectl create -f kubernetes, where kubernetes is the folder where all the manifests are. And after that, I have Zalenium running in minikube.

Is it possible that you help us by providing something something like that so I can reproduce the issue locally?

mojsha commented 6 years ago

@diemol In order to get it running, the easiest is to use an OpenShift template, I just put mine up here: https://gist.github.com/mojsha/d0d57e29f2ed83643b2b85b0f4eadb62.

The only thing I've removed is our OpenShift cluster CA key.

diemol commented 6 years ago

Hi @mojsha,

I was able to reproduce it in minishift, so I changed something in the Dockerfile and it worked. I have this PR #308 to run tests in the other envs. Hopefully it works and then we could release.

diemol commented 6 years ago

We just released https://github.com/zalando/zalenium/releases/tag/3.7.1a It contains the changes from #308 @mojsha please check it with this new release, it should work :)

mojsha commented 6 years ago

The test is running successfully without specifying credentials, so I assume basic auth is not working? This is my command-argument line:

start --firefoxContainers 0 --chromeContainers 0 --seleniumImageName openshift/elgalu_selenium:3.7.1-p0 --sendAnonymousUsageInfo false --gridUser zalenium --gridPassword hk33TIVCjPUBcmuo

Is there something missing/incorrect?

On a positive note, I believe the sudo issue is sorted out now.

diemol commented 6 years ago

Hi @mojsha,

I tried again with the docker version, in minikube and the basic auth works. I also added a template to use with minishift based on the one you provide. But I removed the openshift/oauth-proxy:v1.0.0 image and other oauth stuff you had there. I also changed the target port in the container.

With the template I mention, basic auth for Zalenium works. So I am not really sure what the additional layer of oauth does to the deployment in your template.

Please double check, but for me, it seems that it works.

mojsha commented 6 years ago

@diemol Basically, as we work in an enterprise context we need to have a security model for the applications that we use. For Zalenium, you are providing basic auth for the Selenium endpoint, so I thought I would use it. So currently in my test code, I am just defining this:

                Proxy proxy = new Proxy();
        proxy.setHttpProxy("x.x.x.x:8080");
        proxy.setSslProxy("x.x.x.x.14:8080");
        proxy.setAutodetect(false);
        proxy.setProxyType(Proxy.ProxyType.MANUAL);
        capabilities.setCapability(CapabilityType.PROXY, proxy);
        capabilities.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
        capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
        capabilities.setCapability("recordVideo", true);

        driver = new RemoteWebDriver(
                new URL("https://zalenium-sample.endpoint/wd/hub"), capabilities
        );
        return capabilities;

and despite having basic auth enabled, it successfully executes the test, and records the video. I was under the impression that you would have to use the basic auth credentials as part of the URL.

The OAuth proxy is used to protect the Zalenium UI- I don't want to allow the entire world to watch the test results, so I have integrated our LDAP with the oauth-proxy, thereby applying a security model on the Zalenium UI. But this has no effect on the Selenium endpoint which is excluded from the OAuth proxy.

This is my execution log where you can see that it has not logged any username being used, and the test is executed correctly:

--WARN 11:32:49:827546183 We don't have sudo
Kubernetes service account found.
-- LOG 11:32:49:894180500 Running additional checks...
Copying files for Dashboard...
Enabling basic auth via startup script...
Adding password for user zalenium
Starting Nginx reverse proxy...
Starting Selenium Hub...
11:32:55.679 INFO - Selenium build info: version: '3.7.1', revision: '8a0099a'
11:32:55.687 INFO - Launching Selenium Grid hub
11:32:59.590 INFO - binding de.zalando.ep.zalenium.servlet.LivePreviewServlet to /grid/admin/LivePreviewServlet/*
11:32:59.592 INFO - binding de.zalando.ep.zalenium.servlet.ZaleniumConsoleServlet to /grid/admin/ZaleniumConsoleServlet/*
11:32:59.593 INFO - binding de.zalando.ep.zalenium.servlet.ZaleniumResourceServlet to /grid/admin/ZaleniumResourceServlet/*
11:32:59.593 INFO - binding de.zalando.ep.zalenium.dashboard.DashboardCleanupServlet to /grid/admin/DashboardCleanupServlet/*
........................2017-11-10 11:32:59 INFO  log:192 - Logging initialized @8076ms to org.seleniumhq.jetty9.util.log.Slf4jLog
11:33:00.302 INFO - Will listen on 4445
..2017-11-10 11:33:00 INFO  Server:372 - jetty-9.4.5.v20170502
.2017-11-10 11:33:01 INFO  session:364 - DefaultSessionIdManager workerName=node0
2017-11-10 11:33:01 INFO  session:369 - No SessionScavenger set, using defaults
2017-11-10 11:33:01 INFO  session:149 - Scavenging every 660000ms
.2017-11-10 11:33:01 INFO  ContextHandler:788 - Started o.s.j.s.ServletContextHandler@221af3c0{/,null,AVAILABLE}
2017-11-10 11:33:01 INFO  AbstractConnector:280 - Started ServerConnector@1dd92fe2{HTTP/1.1,[http/1.1]}{0.0.0.0:4445}
2017-11-10 11:33:01 INFO  Server:444 - Started @9604ms
11:33:01.490 INFO - Nodes should register to http://10.131.8.176:4445/grid/register/
11:33:01.490 INFO - Selenium Grid hub is up and running
Selenium Hub started!
Starting DockerSeleniumStarter node...
11:33:04.978 INFO - Selenium build info: version: '3.7.1', revision: '8a0099a'
11:33:04.980 INFO - Launching a Selenium Grid node
2017-11-10 11:33:09.680:INFO::main: Logging initialized @7098ms to org.seleniumhq.jetty9.util.log.StdErrLog
11:33:10.378 INFO - Driver class not found: com.opera.core.systems.OperaDriver
11:33:10.779 INFO - Driver provider class org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
 registration capabilities Capabilities {browserName: internet explorer, ensureCleanSession: true, platform: WINDOWS, version: } does not match the current platform LINUX
11:33:10.779 INFO - Driver provider class org.openqa.selenium.edge.EdgeDriver registration is skipped:
 registration capabilities Capabilities {browserName: MicrosoftEdge, platform: WINDOWS, version: } does not match the current platform LINUX
11:33:10.780 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
 registration capabilities Capabilities {browserName: safari, platform: MAC, version: } does not match the current platform LINUX
11:33:11.085 INFO - Using the passthrough mode handler
2017-11-10 11:33:11.378:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2017-11-10 11:33:11.777:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@48f2bd5b{/,null,STARTING} has uncovered http methods for path: /
2017-11-10 11:33:11.781:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@48f2bd5b{/,null,AVAILABLE}
2017-11-10 11:33:11.887:INFO:osjs.AbstractConnector:main: Started ServerConnector@45752059{HTTP/1.1,[http/1.1]}{0.0.0.0:30000}
2017-11-10 11:33:11.888:INFO:osjs.Server:main: Started @9305ms
11:33:11.888 INFO - Selenium Grid node is up and ready to register to the hub
11:33:12.190 INFO - Registering the node to the hub: http://localhost:4444/grid/register
11:33:14.180 INFO - Initialising Kubernetes support
11:33:20.976 INFO - Kubernetes support initialised.
    Pod name: zalenium-1-6rct3
    app label: zalenium
    zalenium service name: zalenium
    Kubernetes flavour: OpenShift
    Selenium Pod Resource Limits: {memory=Quantity(amount=1Gi, format=null, additionalProperties={}), cpu=Quantity(amount=200m, format=null, additionalProperties={})}
    Selenium Pod Resource Requests: {memory=Quantity(amount=500Mi, format=null, additionalProperties={}), cpu=Quantity(amount=100m, format=null, additionalProperties={})}
11:33:21.077 INFO - [DS] Capabilities grabbed from the docker-selenium image
11:33:21.175 INFO - Registered a node http://10.131.8.176:30000
11:33:21.176 INFO - About to clean up any left over selenium pods created by Zalenium
11:33:21.176 INFO - The node is registered to the hub and ready to use
11:33:21.381 INFO - [DS]  Setting up 0 nodes...
11:33:21.382 INFO - 0 containers were created, it will take a bit more until all get registered.
........................................DockerSeleniumStarter node started!
Sauce Labs not enabled...
Browser Stack not enabled...
TestingBot not enabled...
Zalenium is now ready!
11:36:00.682 INFO - Got a request to create a new session: Capabilities {acceptInsecureCerts: true, acceptSslCerts: true, browserName: chrome, proxy: {httpProxy: x.x.x.x:8080, proxyType: manual, sslProxy: x.x.x.x:8080}, recordVideo: true, version: }
11:36:00.686 INFO - [DS] Starting new node for {proxy={httpProxy=x.x.x.x:8080, proxyType=manual, sslProxy=x.x.x.x:8080}, acceptSslCerts=true, acceptInsecureCerts=true, recordVideo=true, browserName=chrome, version=}.
11:36:00.784 INFO - Pods in the list 0
11:37:30.177 INFO - Registered a node http://10.130.5.165:40000
11:37:30.179 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, acceptSslCerts=true, screen-resolution=1920x1080, tz=Europe/Berlin, browserName=chrome, maxInstances=1, screenResolution=1920x1080, resolution=1920x1080, version=62.0.3202.89, platform=LINUX}
11:37:32.191 INFO - [DS] Container zalenium-40000-6dnl4 is up after ~30 seconds...
11:37:43.394 INFO - zalenium-40000-6dnl4 [bash, -c, start-video]
11:37:50.788 INFO - zalenium-40000-6dnl4 video-rec: started
Waiting for ffmpeg video recording to start...
.................Videos at /home/seluser/videos/vid_chrome_40000.mp4* started to be recorded! (wait-video-rec.sh)

11:37:56.784 INFO - http://10.130.5.165:40000 AFTER_SESSION command received. Node should shutdown soon...
11:37:56.785 INFO - zalenium-40000-6dnl4 [bash, -c, notify 'Zalenium', 'TEST COMPLETED', --icon=/home/seluser/images/completed.png]
11:37:59.486 INFO - zalenium-40000-6dnl4 
11:37:59.486 INFO - zalenium-40000-6dnl4 [bash, -c, stop-video]
11:38:25.204 INFO - zalenium-40000-6dnl4 video-rec: stopped
Waiting for video to stop recording...
video-rec                        STOPPED   Nov 10 11:38 AM
Done waiting for video recording to stop.
Video recording stopped
--LOG 11:38:25:187553193 -- DEBUG: video-rec-stdout.log ----
frame=    7 fps=5.8 q=0.0 size=       1kB time=00:00:00.00 bitrate=N/A    
frame=   10 fps=5.2 q=0.0 size=       1kB time=00:00:00.00 bitrate=N/A    
frame=   13 fps=5.0 q=0.0 size=     110kB time=00:00:01.00 bitrate= 903.9kbits/s    
frame=   16 fps=5.0 q=0.0 size=     135kB time=00:00:01.60 bitrate= 693.1kbits/s    
frame=   19 fps=5.0 q=0.0 size=     161kB time=00:00:02.30 bitrate= 571.9kbits/s    
frame=   22 fps=4.9 q=0.0 size=     186kB time=00:00:02.90 bitrate= 524.8kbits/s    
frame=   25 fps=4.8 q=0.0 size=     211kB time=00:00:03.60 bitrate= 479.6kbits/s    
frame=   27 fps=4.6 q=0.0 size=     228kB time=00:00:04.00 bitrate= 466.3kbits/s    
frame=   29 fps=4.5 q=0.0 size=     244kB time=00:00:04.40 bitrate= 455.0kbits/s    
frame=   32 fps=4.4 q=0.0 size=     270kB time=00:00:05.10 bitrate= 433.1kbits/s    
frame=   35 fps=4.5 q=0.0 size=     295kB time=00:00:05.80 bitrate= 416.2kbits/s    
frame=   38 fps=4.5 q=0.0 size=     337kB time=00:00:06.80 bitrate= 405.9kbits/s    
frame=   41 fps=4.5 q=0.0 size=     365kB time=00:00:07.60 bitrate= 393.5kbits/s    
frame=   43 fps=4.3 q=0.0 size=     384kB time=00:00:08.00 bitrate= 392.8kbits/s    
frame=   45 fps=4.3 q=0.0 size=     402kB time=00:00:08.40 bitrate= 392.0kbits/s    
frame=   47 fps=4.3 q=0.0 size=     420kB time=00:00:08.80 bitrate= 391.3kbits/s    
frame=   49 fps=4.2 q=0.0 size=     441kB time=00:00:09.40 bitrate= 384.7kbits/s    
--LOG 11:38:02:879834242 Trapped SIGTERM or SIGINT so shutting down ffmpeg gracefully...
--LOG 11:38:02:981924543 Will kill VID_TOOL_PID=1573 ...
frame=   50 fps=3.9 q=-1.0 Lsize=     547kB time=00:00:12.50 bitrate= 358.8kbits/s    
video:546kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.201073%
[libx264 @ 0x12078c0] frame I:1     Avg QP: 0.00  size: 79688
[libx264 @ 0x12078c0] frame P:49    Avg QP: 0.00  size:  9781
[libx264 @ 0x12078c0] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0x12078c0] mb P  I16..4: 87.1%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:12.9%
[libx264 @ 0x12078c0] coded y,u,v intra: 0.2% 0.1% 0.1% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x12078c0] i16 v,h,dc,p: 100%  0%  0%  0%
[libx264 @ 0x12078c0] kb/s:352.11
Exiting normally, received signal 2.
--LOG 11:38:03:987334057 Tried to kill -SIGTERM VID_TOOL_PID=1573
--LOG 11:38:04:080498454 Waiting up to 6s for VID_TOOL_PID=1573 to end with SIGTERM...
--LOG 11:38:04:183296615 wait_pid successfully managed to SIGTERM:VID_TOOL_PID=1573 within less than 6s
--LOG 11:38:04:280491902 Will try to fix the videos...
--LOG 11:38:04:882220552 Fixing perms for /home/seluser/videos/vid_chrome_40000.mkv*
--LOG 11:38:04:979905594 Changing video encoding from mkv to mp4...
--LOG 11:38:23:283339519 Conversion from mkv to mp4 succeeded!
--LOG 11:38:23:381078963 Cleaning up /home/seluser/videos/vid_chrome_40000.mkv ...
--LOG 11:38:23:481304341 Optimizing /home/seluser/videos/vid_chrome_40000.mp4 for HTTP streaming...
--LOG 11:38:23:787192731 Succeeded to mp4box_retry.sh within 8s
--LOG 11:38:23:882849710 ffmpeg shutdown complete.
--LOG 11:38:25:195477514 -- DEBUG: video-rec-stderr.log ----
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 10 fps, 10240 tbn, 10 tbc (default)
    Metadata:
      DURATION        : 00:00:12.500000000
      encoder         : Lavc56.60.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=   10 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A dup=7 drop=0    
frame=   14 fps= 10 q=0.0 size=     104kB time=00:00:00.40 bitrate=2126.2kbits/s dup=9 drop=0    
frame=   21 fps=9.2 q=0.0 size=     177kB time=00:00:01.10 bitrate=1318.6kbits/s dup=13 drop=0    
frame=   25 fps=8.6 q=0.0 size=     210kB time=00:00:01.50 bitrate=1149.0kbits/s dup=15 drop=0    
frame=   32 fps=8.9 q=0.0 size=     269kB time=00:00:02.20 bitrate=1001.1kbits/s dup=19 drop=0    
frame=   38 fps=8.9 q=0.0 size=     319kB time=00:00:02.80 bitrate= 933.4kbits/s dup=22 drop=0    
frame=   44 fps=9.2 q=0.0 size=     369kB time=00:00:03.40 bitrate= 889.0kbits/s dup=25 drop=0    
frame=   48 fps=8.7 q=0.0 size=     402kB time=00:00:03.80 bitrate= 867.2kbits/s dup=27 drop=0    
frame=   54 fps=9.0 q=0.0 size=     452kB time=00:00:04.40 bitrate= 842.4kbits/s dup=31 drop=0    
frame=   58 fps=8.5 q=0.0 size=     486kB time=00:00:04.80 bitrate= 829.6kbits/s dup=33 drop=0    
frame=   65 fps=8.8 q=0.0 size=     544kB time=00:00:05.50 bitrate= 810.8kbits/s dup=38 drop=0    
frame=   71 fps=8.4 q=0.0 size=     610kB time=00:00:06.10 bitrate= 819.1kbits/s dup=42 drop=0    
frame=   76 fps=8.2 q=0.0 size=     656kB time=00:00:06.60 bitrate= 813.9kbits/s dup=45 drop=0    
frame=   80 fps=8.1 q=0.0 size=     693kB time=00:00:07.00 bitrate= 810.5kbits/s dup=47 drop=0    
frame=   84 fps=7.9 q=0.0 size=     730kB time=00:00:07.40 bitrate= 807.7kbits/s dup=49 drop=0    
frame=   88 fps=7.9 q=0.0 size=     766kB time=00:00:07.80 bitrate= 804.8kbits/s dup=51 drop=0    
frame=   96 fps=8.1 q=0.0 size=     840kB time=00:00:08.60 bitrate= 799.9kbits/s dup=56 drop=0    
frame=  101 fps=8.1 q=0.0 size=     888kB time=00:00:09.10 bitrate= 799.7kbits/s dup=59 drop=0    
frame=  105 fps=8.0 q=0.0 size=     930kB time=00:00:09.50 bitrate= 801.8kbits/s dup=62 drop=0    
frame=  111 fps=7.8 q=0.0 size=     985kB time=00:00:10.10 bitrate= 798.9kbits/s dup=66 drop=0    
frame=  119 fps=8.0 q=0.0 size=    1058kB time=00:00:10.90 bitrate= 795.0kbits/s dup=71 drop=0    
frame=  122 fps=7.9 q=0.0 size=    1085kB time=00:00:11.20 bitrate= 793.8kbits/s dup=73 drop=0    
frame=  125 fps=7.7 q=0.0 size=    1113kB time=00:00:11.50 bitrate= 792.5kbits/s dup=75 drop=0    
frame=  126 fps=7.4 q=-1.0 Lsize=    1214kB time=00:00:12.60 bitrate= 789.3kbits/s dup=76 drop=0    
video:1213kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.107989%
[libx264 @ 0xe890e0] frame I:1     Avg QP: 0.00  size: 79688
[libx264 @ 0xe890e0] frame P:125   Avg QP: 0.00  size:  9293
[libx264 @ 0xe890e0] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0xe890e0] mb P  I16..4: 87.2%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:12.8%
[libx264 @ 0xe890e0] coded y,u,v intra: 0.1% 0.0% 0.0% inter: 0.0% 0.0% 0.0%
[libx264 @ 0xe890e0] i16 v,h,dc,p: 100%  0%  0%  0%
[libx264 @ 0xe890e0] kb/s:788.11

11:38:26.095 INFO - http://10.130.5.165:40000 Video file copied to: /home/seluser/videos/zalenium_eafbf86d-397e-4d2c-9575-e492c62b9fac_chrome_LINUX_20171110113825.mp4
11:38:26.098 WARN - http://10.130.5.165:40000 Error while copying the video
java.io.IOException: Pipe closed
    at java.io.PipedInputStream.read(PipedInputStream.java:307)
    at java.io.PipedInputStream.read(PipedInputStream.java:377)
    at java.io.InputStream.skip(InputStream.java:224)
    at org.apache.commons.compress.utils.IOUtils.skip(IOUtils.java:101)
    at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.consumeRemainderOfLastBlock(TarArchiveInputStream.java:668)
    at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getRecord(TarArchiveInputStream.java:388)
    at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(TarArchiveInputStream.java:265)
    at de.zalando.ep.zalenium.proxy.DockerSeleniumRemoteProxy.copyVideos(DockerSeleniumRemoteProxy.java:430)
    at de.zalando.ep.zalenium.proxy.DockerSeleniumRemoteProxy.processContainerAction(DockerSeleniumRemoteProxy.java:415)
    at de.zalando.ep.zalenium.proxy.DockerSeleniumRemoteProxy.processContainerAction(DockerSeleniumRemoteProxy.java:404)
    at de.zalando.ep.zalenium.proxy.DockerSeleniumRemoteProxy.videoRecording(DockerSeleniumRemoteProxy.java:368)
    at de.zalando.ep.zalenium.proxy.DockerSeleniumRemoteProxy.cleanupNode(DockerSeleniumRemoteProxy.java:488)
    at de.zalando.ep.zalenium.proxy.DockerSeleniumRemoteProxy.shutdownNode(DockerSeleniumRemoteProxy.java:502)
    at de.zalando.ep.zalenium.proxy.DockerSeleniumRemoteProxy.afterSession(DockerSeleniumRemoteProxy.java:263)
    at org.openqa.grid.internal.TestSlot.performAfterSessionEvent(TestSlot.java:250)
    at org.openqa.grid.internal.DefaultGridRegistry._release(DefaultGridRegistry.java:140)
    at org.openqa.grid.internal.DefaultGridRegistry.access$100(DefaultGridRegistry.java:43)
    at org.openqa.grid.internal.DefaultGridRegistry$1.run(DefaultGridRegistry.java:123)
    at java.lang.Thread.run(Thread.java:748)
11:38:26.102 INFO - zalenium-40000-6dnl4 [bash, -c, transfer-logs.sh]
11:38:26.347 INFO - zalenium-40000-6dnl4 
diemol commented 6 years ago

The basic auth also covers the dashboard resources.

But I don't really know what else can be done, because the basic auth works by itself but it seems that the combination with your oauth layer overwrites it. Maybe you need to try to tweak your env a bit?

mojsha commented 6 years ago

I must be doing something wrong... I have removed the oauth proxy and it works just like with it - i.e. no basic auth.

Is there anything else I should do, other than this commandline:

start --firefoxContainers 0 --chromeContainers 0 --seleniumImageName openshift/elgalu_selenium:3.7.1-p0 --sendAnonymousUsageInfo false --gridUser zalenium --gridPassword hk33TIVCjPUBcmuo
diemol commented 6 years ago

So that means that when you go to the url in your browser https://zalenium-sample.endpoint/grid/console, you do not need to enter a user and password...

When I see this

Enabling basic auth via startup script...
Adding password for user zalenium

it means that Nginx was able to start the basic auth.

I mean, you can just try it locally with the docker version and see that it is working.

docker run --rm -ti --name zalenium -p 4444:4444 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /tmp/videos:/home/seluser/videos \
    --privileged dosel/zalenium start --gridUser zalenium --gridPassword yourPwd

Perhaps double check that you have the latest image, and try to use it first in minishift? Maybe the secret is being used in your setup and injected somehow in the requests?

mojsha commented 6 years ago

Ok, I got it working - basically I need to have two routes and two services to achieve what I want. It won't work the way I had in mind.

diemol commented 6 years ago

Cool! Only took us 3 months 😄 Thanks for being patient, helping and giving us all the feedback @mojsha Closing it since it works!