openstf / stf

Control and manage Android devices from your browser.
https://openstf.io
Other
13.37k stars 2.79k forks source link

Is it possible to run same stf services on a single server for redundant backup? #830

Open David-gulu opened 6 years ago

David-gulu commented 6 years ago

Hi, there

We are now deploying STF in production mode(App role and provider role separately). Taking disaster recovery into consideration, we want to double stf services for the APP role. We tried to configure that by ourself by doubling triproxy app (each with two processors connected), triproxy dev(each with 2 processors connected), and modifying the configuration of the reaper, websocket, api and the provider. Then we found we can not control the smartphone remotely on the webpage.

I want to know Is it possible to run same stf services on a single server ? Looking forward for your advices!

In addition, also provide the statements for starting the above mentioned STF services using docker:

APP Role:

[1] triproxy app docker run -d -e "ZMQ_TCP_KEEPALIVE=1" -e "ZMQ_TCP_KEEPALIVE_IDLE=300" --name stf-triproxy-app01 --net host openstf/stf:latest stf triproxy app --bind-pub "tcp://:7350" --bind-dealer "tcp://:7360" --bind-pull *"tcp://:7370"**

docker run -d -e "ZMQ_TCP_KEEPALIVE=1" -e "ZMQ_TCP_KEEPALIVE_IDLE=300" --name stf-triproxy-app --net host openstf/stf:latest stf triproxy app --bind-pub "tcp://:7150" --bind-dealer "tcp://:7160" --bind-pull *"tcp://:7170"**

[2] triproxy dev docker run -d -e "ZMQ_TCP_KEEPALIVE=1" -e "ZMQ_TCP_KEEPALIVE_IDLE=300" --name stf-triproxy-dev01 --net host openstf/stf:latest stf triproxy dev --bind-pub "tcp://:7450" --bind-dealer "tcp://:7460" --bind-pull *"tcp://:7470"**

docker run -d -e "ZMQ_TCP_KEEPALIVE=1" -e "ZMQ_TCP_KEEPALIVE_IDLE=300" --name stf-triproxy-dev --net host openstf/stf:latest stf triproxy dev --bind-pub "tcp://:7250" --bind-dealer "tcp://:7260" --bind-pull *"tcp://:7270"**

[3] reaper docker run -d --name stf-reaper01 --link rethinkdb-proxy-28015:rethinkdb openstf/stf:latest stf reaper dev --connect-push tcp://$(FAKE_IP_STF_APP):7270 tcp://$(FAKE_IP_STF_APP):7470 --connect-sub tcp://$(FAKE_IP_STF_APP):7150 tcp://$(FAKE_IP_STF_APP):7350 --heartbeat-timeout 30000

[4] processor docker run -d -e "ZMQ_TCP_KEEPALIVE=1" -e "ZMQ_TCP_KEEPALIVE_IDLE=300" --name stf-processor01 --link rethinkdb-proxy-28015:rethinkdb openstf/stf:latest stf processor stf-processor --connect-app-dealer tcp://$(FAKE_IP_STF_APP):7160 --connect-dev-dealer tcp://$(FAKE_IP_STF_APP):7260

docker run -d -e "ZMQ_TCP_KEEPALIVE=1" -e "ZMQ_TCP_KEEPALIVE_IDLE=300" --name stf-processor --link rethinkdb-proxy-28015:rethinkdb openstf/stf:latest stf processor stf-processor --connect-app-dealer tcp://$(FAKE_IP_STF_APP):7160 --connect-dev-dealer tcp://$(FAKE_IP_STF_APP):7260

docker run -d -e "ZMQ_TCP_KEEPALIVE=1" -e "ZMQ_TCP_KEEPALIVE_IDLE=300" --name stf-processor02 --link rethinkdb-proxy-28015:rethinkdb openstf/stf:latest stf processor stf-processor --connect-app-dealer tcp://$(FAKE_IP_STF_APP):7360 --connect-dev-dealer tcp://$(FAKE_IP_STF_APP):7460

docker run -d -e "ZMQ_TCP_KEEPALIVE=1" -e "ZMQ_TCP_KEEPALIVE_IDLE=300" --name stf-processor03 --link rethinkdb-proxy-28015:rethinkdb openstf/stf:latest stf processor stf-processor --connect-app-dealer tcp://$(FAKE_IP_STF_APP):7360 --connect-dev-dealer tcp://$(FAKE_IP_STF_APP):7460

[5] websocket docker run -d -e "ZMQ_TCP_KEEPALIVE=1" -e "ZMQ_TCP_KEEPALIVE_IDLE=300" --name stf-websocket01 --link rethinkdb-proxy-28015:rethinkdb -e "SECRET=YOUR_SESSION_SECRET_HERE" -p 7110:7110 openstf/stf:latest stf websocket --port 7110 --storage-url http://$(FAKE_IP_STF_APP):7100/ --connect-sub tcp://$(FAKE_IP_STF_APP):7150 tcp://$(FAKE_IP_STF_APP):7350 --connect-push tcp://$(FAKE_IP_STF_APP):7170 tcp://$(FAKE_IP_STF_APP):7370

[6] api docker run -d --name stf-api01 --link rethinkdb-proxy-28015:rethinkdb -e "SECRET=YOUR_SESSION_SECRET_HERE" -p 7106:7106 openstf/stf:latest stf api --port 7106 --connect-sub tcp://$(FAKE_IP_STF_APP):7150 tcp://$(FAKE_IP_STF_APP):7350 --connect-push tcp://$(FAKE_IP_STF_APP):7170 tcp://$(FAKE_IP_STF_APP):7370

Provider Role:

[1] provider docker run -d -e "ZMQ_TCP_KEEPALIVE=1" -e "ZMQ_TCP_KEEPALIVE_IDLE=300" --name stfprovider-floor01 --net host openstf/stf:latest stf provider --name stfprovider/floor01 --connect-sub tcp://$(FAKE_IP_STF_APP):7250 tcp://$(FAKE_IP_STF_APP):7450 --connect-push tcp://$(FAKE_IP_STF_APP):7270 tcp://$(FAKE_IP_STF_APP):7470 --storage-url http://$(FAKE_IP_STF_APP):7100/ --public-ip $(FAKE_IP_STF_PROVIDER) --min-port=15000 --max-port=17000 --heartbeat-interval 10000 --screen-ws-url-pattern "ws://$(FAKE_IP_STF_APP):7100/d/floor01/<%= serial %>/<%= publicPort %>/"

Thanks a lot!

yours David

thinkhy commented 6 years ago

Did you modify nginx config to update upstream server list?

David-gulu commented 6 years ago

not change anything about nginx. Should I change the configuration of nginx under such condition?

thinkhy commented 6 years ago

yes, you can add more instances in nginx config.

zr0827 commented 6 years ago

I am trying to do the same configuration as this one, which has more than one tri-proxy-dev. I encounter the same problem which cannot control the device remotely. It seems like only half of event messages can go through zmq channel to the device side. theoretically this configuration should work, couldn't figure out what is the issue. nginx configuration does't seem to affect anything with this configuration. @David-gulu have you solved the issue?

David-gulu commented 6 years ago

@zr0827 not yet. We are trying using k8s for redundancy.

thinkhy commented 6 years ago

@David-gulu That's great. I've also attempted K8S recently.