zebrunner / mcloud-agent

18 stars 11 forks source link

review ports sharing arch #314

Open vdelendik opened 4 months ago

vdelendik commented 4 months ago

let's inspect ports sharing we have to do to organize adb and potentially usbmuxd remote connection. goal to hide as much as possible and do not expose extra ports.

For example if we deploy stf-agent-proxy near the devices we can organize routing for screen port using nginx <-> agent-nginx <-> device container

wss://demo.zebrunner.farm/d/demo.zebrunner.farm/<udid>/7544/
->
wss://demo.zebrunner.farm/d/demo.zebrunner.farm/<device-container>/7544/

global nginx then should redirect to agent nginx:

    # Handle stf-providers
    location ~ "^/d/(?<stfprovider>([^/]+))/(?<udid>([^/]+))/(?<port>[0-9]+)/$" {
      proxy_pass http://$stfprovider:$STF-AGENT-PROXY-PORT/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection upgrade;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header X-Real-IP $remote_addr;
    }

And agent nginx using device container routing goto screen port etc

vdelendik commented 3 months ago

still TBD if really need this complication. To identify it we have to double check functionality in 2.7 release. As I remember we removed mjpeg screen port sharing outside at all.