stf icon indicating copy to clipboard operation
stf copied to clipboard

Deploy stf service on public network.

Open EltonZhong opened this issue 5 years ago • 9 comments

How can I deploy stf service on public network?

Describe the solution you'd like I have a centos server exposed to public network. While my laptop connecting to android devices is in private network. I can access centos server ip address from my laptop, cause it's in public network, and of course the centos can not access my laptop with http protocal(while websocket will work).

I start my stf master on my centos server, and I want to connect my android devices to it, with running command below on my laptop:

stf provider --name id_mac --min-port 7400 --max-port 7700 --connect-sub tcp://$server_ip:7114 --connect-push tcp://$server_ip:7116 --group-timeout 20000 --public-ip $server_ip --storage-url http://$server_ip:7100/ --vnc-initial-size 600x800 --allow-remote --adb-host $local --adb-port 5037

But it fails with :

Providing all 0 of 1 device(s); ignoring "5ab031e"

I notice that log Receiving input from "tcp://***:7114" shows. Is that stf master is pulling from stf slave with protocols like http? Websocket or pulling from slave side will just be ok. Or did I configure something wrong?

Need your kindly help, thank you!!!

EltonZhong avatar Jul 03 '19 10:07 EltonZhong

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.80. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Jul 03 '19 10:07 issue-label-bot[bot]

An easy way is to reverse-proxy your adb port to the public server

thinkhy avatar Jul 06 '19 14:07 thinkhy

An easy way is to reverse-proxy your adb port to the public server how to do?

Xuzhiwei avatar Jul 09 '19 01:07 Xuzhiwei

An easy way is to reverse-proxy your adb port to the public server

Thanks but not working in my case, due to some secure reasons.

EltonZhong avatar Jul 11 '19 06:07 EltonZhong

I encountered the same problem. log like this

2019-07-17T08:19:53.779Z INF/provider 6147 [*] Subscribing to permanent channel "Iz4tupotSRWjx/rLJF2HsQ=="
2019-07-17T08:19:53.799Z INF/provider 6147 [*] Sending output to "tcp://10.112.78.174:7116"
2019-07-17T08:19:53.800Z INF/provider 6147 [*] Receiving input from "tcp://10.112.78.174:7114"
2019-07-17T08:19:53.806Z INF/provider 6147 [*] Tracking devices
2019-07-17T08:19:53.807Z INF/provider 6147 [*] Found device "7bf567ed" (device)
2019-07-17T08:20:03.814Z INF/provider 6147 [*] Providing all 0 of 1 device(s); ignoring "7bf567ed"

I guessed there was something wrong with zmq message in this case. since the provider didn't received "register" message, the register then method wasn't called.

register.then(function() {
        log.info('Registered device "%s"', device.id)
        check()
      })

so the local device on the provider never got chance to register itself.

But, I don't know how to continue from here.

gebitang avatar Jul 17 '19 09:07 gebitang

It turned out my guess was correct.

@EltonZhong make sure your "stf master" starting with parameter as following:

bind_dev_pub="tcp://0.0.0.0:7114"
bind_dev_pull="tcp://0.0.0.0:7116"
--bind-dev-pull $bind_dev_pull --bind-dev-pub $bind_dev_pub

so it will listen all the requests both from local and remote. the default value is "tcp://127.0.0.1:7114".

Now, I can provide my local phone to 'stf master'.

So far, the remote control can't be done due to "can’t establish a connection to the server at ws://xxx.xxx.xxx:7416/." error. Anyway, that is another issue.

good luck.

gebitang avatar Jul 18 '19 06:07 gebitang

It turned out my guess was correct.

@EltonZhong make sure your "stf master" starting with parameter as following:

bind_dev_pub="tcp://0.0.0.0:7114"
bind_dev_pull="tcp://0.0.0.0:7116"
--bind-dev-pull $bind_dev_pull --bind-dev-pub $bind_dev_pub

so it will listen all the requests both from local and remote. the default value is "tcp://127.0.0.1:7114".

Now, I can provide my local phone to 'stf master'.

So far, the remote control can't be done due to "can’t establish a connection to the server at ws://xxx.xxx.xxx:7416/." error. Anyway, that is another issue.

good luck.

Thanks, will try

EltonZhong avatar Jul 21 '19 13:07 EltonZhong

Anyupdate on this question, i am also facing this problem on Ubuntu 18.04. and my adb server is windows under the corp network. i tried using bind_dev_pub as below:docker run -itd --name stf --net host openstf/stf stf local --public-ip 10.3.67.55 bind_dev_pub="tcp://0.0.0.0:7114" bind_dev_pull="tcp://0.0.0.0:7116" --allow-remote

chaooe avatar Jun 18 '20 03:06 chaooe