cta-wave / dpctf-deploy

Repo for Docker deployment. This is basically the repository you need to deploy the Test Runner (and later the Test Execution Framework) locally. It will make the deployment and configuration of all components much easier
Other
2 stars 5 forks source link

Due to an open issue with wsl, testrunner is not reachable in LAN #83

Open mlasak opened 4 months ago

mlasak commented 4 months ago

https://github.com/microsoft/WSL/issues/4983

open since 2020. only workaround for now is to start test runner without ssl and use a simple proxy on windows host machine to terminate ssl there.

example:

const fs = require('fs')
const path = require('path')
const hp = require('http-proxy')

const certFolder = 'certs'

hp.createServer({
    target: {
        host: '172.31.146.167',
        port: 8000
    },
    ssl: {
        key: fs.readFileSync(path.join(certFolder, 'key.pem'), 'utf8'),
        cert: fs.readFileSync(path.join(certFolder, 'cert.pem'), 'utf8'),
        ca: fs.readFileSync(path.join(certFolder, 'ca.pem'), 'utf8')
    }
}).listen(8443)

hp.createServer({
    target: {
        host: '172.31.146.167',
        port: 8000
    },
}).listen(8000)

whereas the "172.31.146.167" address should be replaced with the one you have on your setup:

outside wsl call:

 wsl hostname -I
louaybassbouss commented 4 months ago

@mlasak it is possible to replace Node.js proxy with something else like NGINX?

mlasak commented 4 months ago

@louaybassbouss yes, any proxy should work. NGINX as well. However, it must be running directly on host system.

jpiesing commented 4 months ago

Don't forget that the documentation needs to be updated somewhere to describe this.

mlasak commented 4 months ago

@jpiesing a proxy is imo only a hack/workaround and should only be used in case of desperation. As well, it turns out, that it really depends on your local network setup and security measures (like firewalls, DNS rebind protection, etc). The question is how far a documentation should go and what level of knowledge can be expected from person setting up the test runner?

I have a running setup on

And yes, we will share/update documentation on this

jpiesing commented 4 months ago

@jpiesing a proxy is imo only a hack/workaround and should only be used in case of desperation. As well, it turns out, that it really depends on your local network setup and security measures (like firewalls, DNS rebind protection, etc). The question is how far a documentation should go and what level of knowledge can be expected from person setting up the test runner?

I have a running setup on

  • win10
  • using wsl2
  • without docker for desktop (instead docker installed inside wsl2)
  • with free DNS name and SSL certificates

And yes, we will share/update documentation on this

@mlasak IMHO we should provide limited documentation on using Windows + WSL2 without Docker Desktop. We should just list things to watch out for and not go into proper depth on how to solve them at the same level as the main supported configurations of Linux and Windows+Docker Desktop. We have a (old) document on Windows + WSL2 - https://github.com/cta-wave/dpctf-deploy/blob/master/WINDOWS_WSL.md. I think it's enough to review & update that document and perhaps add a few comments about new problems and the type of solution.

Does this sound reasonable?

mlasak commented 4 months ago

Yes, sounds good. pls close this issue @FritzHeiden once the doc has been updated. Such a documentation should simply point to relevant further sources, like https://learn.microsoft.com/en-us/windows/wsl/networking

Forwarding the traffic from Win -> wsl2 -> test runner in docker requires imo

powershell:

netsh.exe interface portproxy add v4tov4 listenport=8000 listenaddress=0.0.0.0 connectport=8000 connectaddress=(wsl hostname -I)
netsh.exe interface portproxy add v4tov4 listenport=8443 listenaddress=0.0.0.0 connectport=8443 connectaddress=(wsl hostname -I)
netsh.exe interface portproxy add v6tov4 listenport=8000 listenaddress=0.0.0.0 connectport=8000 connectaddress=(wsl hostname -I)
netsh.exe interface portproxy add v6tov4 listenport=8443 listenaddress=0.0.0.0 connectport=8443 connectaddress=(wsl hostname -I)

docker-compose.yml:

network_mode: "host"

Due to the fact that the same setup i tested yesterday in a corporate network in London, today simply work in my home network in Berlin without any additional proxy, i'm fine to close this issue right away. Nothing changed except networking.

Recommend to add info to doc: If you face connectivity issues then please check that firewall, DNS-rebind protection and other network related topics do not block connectivity between your local devices (DUT, test runner host, smartphone)