Skip to content

Commit

Permalink
Support wss
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishal Gowda committed Mar 8, 2017
1 parent 2b20cf3 commit 3f9affa
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 22 deletions.
22 changes: 22 additions & 0 deletions config/droid_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"thrift_host": "0.0.0.0",
"thrift_port": "9090",
"droids": [
{
"port": "5554",
"avd": "nexus4-android7",
"display": "1",
"ws_port": "6080",
"clip": "580x1000+100+90",
"dim": "768x1280x24"
},
{
"port": "5556",
"avd": "nexus4-android7-2",
"display": "2",
"ws_port": "6081",
"clip": "580x1000+100+90",
"dim": "768x1280x24"
}
]
}
67 changes: 67 additions & 0 deletions config/hackerearth.ca-bundle
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
-----BEGIN CERTIFICATE-----
MIIGCDCCA/CgAwIBAgIQKy5u6tl1NmwUim7bo3yMBzANBgkqhkiG9w0BAQwFADCB
hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV
BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQwMjEy
MDAwMDAwWhcNMjkwMjExMjM1OTU5WjCBkDELMAkGA1UEBhMCR0IxGzAZBgNVBAgT
EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
Q09NT0RPIENBIExpbWl0ZWQxNjA0BgNVBAMTLUNPTU9ETyBSU0EgRG9tYWluIFZh
bGlkYXRpb24gU2VjdXJlIFNlcnZlciBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
ADCCAQoCggEBAI7CAhnhoFmk6zg1jSz9AdDTScBkxwtiBUUWOqigwAwCfx3M28Sh
bXcDow+G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1u80GH4r6XnTq1dFDK8o+tDb5VCViLvfhVdpfZLY
Uspzgb8c8+a4bmYRBbMelC1/kZWSWfFMzqORcUx8Rww7Cxn2obFshj5cqsQugsv5
B5a6SE2Q8pTIqXOi6wZ7I53eovNNVZ96YUWYGGjHXkBrI/V5eu+MtWuLt29G9Hvx
PUsE2JOAWVrgQSQdso8VYFhH2+9uRv0V9dlfmrPb2LjkQLPNlzmuhbsdjrzch5vR
pu/xO28QOG8=
-----END CERTIFICATE-----
31 changes: 31 additions & 0 deletions config/hackerearth.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFWTCCBEGgAwIBAgIQJUkJ7q4LGWXQEJS8JBxn1DANBgkqhkiG9w0BAQsFADCB
kDELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxNjA0BgNV
BAMTLUNPTU9ETyBSU0EgRG9tYWluIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZlciBD
QTAeFw0xNTA4MjUwMDAwMDBaFw0xNzEwMDQyMzU5NTlaMF0xITAfBgNVBAsTGERv
bWFpbiBDb250cm9sIFZhbGlkYXRlZDEcMBoGA1UECxMTQ09NT0RPIFNTTCBXaWxk
Y2FyZDEaMBgGA1UEAwwRKi5oYWNrZXJlYXJ0aC5jb20wggEiMA0GCSqGSIb3DQEB
AQUAA4IBDwAwggEKAoIBAQDNB+Ygzl7T9jPtg59J+Lq59dGSsQ1LKmwliklovOYI
5hLXcOolXJOi94FxIqimrJ8FQLgY+qfgGABYpfGlkJhR9njd23ybvf355bRZLr3d
ykuUoaFVv0iZdMVIsCoKfv0fizThtYPsLwpquwQLnNAAhkRF9Rx3ZEHI4mHJpz+3
ONKXiUS9LpkIgxoigKm0EywIu5ct8Q6W2mpCkPqannnM9tgXvpmQ6OIBGzzQ2AZ3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BJD+C5b2bRQ4UrI2LgZ0R
rHjcFI9WeeNqcOIanpXs+NhxG67CgGCLKWzv1aE=
-----END CERTIFICATE-----
28 changes: 28 additions & 0 deletions config/hackerearth.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDNB+Ygzl7T9jPt
g59J+Lq59dGSsQ1LKmwliklovOYI5hLXcOolXJOi94FxIqimrJ8FQLgY+qfgGABY
pfGlkJhR9njd23ybvf355bRZLr3dykuUoaFVv0iZdMVIsCoKfv0fizThtYPsLwpq
uwQLnNAAhkRF9Rx3ZEHI4mHJpz+3ONKXiUS9LpkIgxoigKm0EywIu5ct8Q6W2mpC
kPqannnM9tgXvpmQ6OIBGzzQ2AZ3ROjv8VuheJfWdbWzP4ZafQCZ0n+m39QW0sam
glmVsg9TVlsWPSgZHxmHtf1alCqIpImgRq4hXl+CpZmBiT40PEa2CRrw8jCtOvoH
6cCW+e7fAgMBAAECggEBAIlPCu1Zh+RH9ArSpTCy5Mp5N/sXm6GFLZwOeo8sQpof
CutBcW3IDA+N1iBgZ7YH0Q+BgkkoRJktOb4klCqfJYNunw9lWJQsrxRWo2s+hGUu
f2Nww01bp1EuBJljcSRKW1ZuseGe4FSiREWqLVFhmWNgiASZ3JCQkgXopjiYS3F1
5w5jxwVROwovuJby3uNCzPmgmH8edyPuvWfEnOBhzBj7g7bjghdnrXnXYZ8rYXDU
Qfwy8T5lOyMDmz5bYruWpV0SRInerhjJeqC5j1MgrU4aoEaejQNYa6H5bJS1/rm/
j8sFXMtuISzNYzZN7wCk2MORHJ6xe7mC49keAM185jECgYEA88l+8lJBumbMDhoc
jZVwkdPbM+klc6dOcah6sMBdXaOzACsbaNFuYn3289tc5pu4EwkgowUVDF79B+jP
XMF5/iBJdjNZlEJ+11tXRpjnHqNELb9nFhhBhiIQ4g1NOjZuOAGiMqox4YxWE1EC
6IzT6zmNrnRPnj6TNwWdnokXYQsCgYEA101dXFC5GJDshGrIALF4kfHiRuBicGCo
Cs8PY/FKMdTJGD7oRJjs35qhkHEqKYD4FWryAZIqxXpZNCqL930TkbSrhcIhnGv7
cYbBMpLepwPyUPtWslLFwr7AcokwGdcarJiC6PQbMEOpVkT0wLp7Tj5UNAPiczKk
7kbAZ1+vdf0CgYEAiU2QGQypBkIFZV/hewCSwR8wE0GZnVS6gpsgVtJRA39CPrMI
ofVqlUBaySdgYGWNu/LlFcuz+h65pi3CNHynp7Apj9AGANGevM4uDo3phcDwkk99
0NzicphXJ+nT+BhV5WdOIfjnVSAEDqcO20kNxirJGFtbyEV4BoI8LuEJcNcCgYEA
qi4Sr5d21v4mlXw53qJo5SNGcjOGW8Fq0jBcv+jHdp/0299NhHtEMHJvZlastuWk
Mnm4FJnOiQ1uWReQTu1kfHVMZovOOW/47gFP0IPazjUGYhBotMdMXeSdBWt+w84M
3YQnZa8dlobE4NXciEJemLgXoo23fsr3JwhxqMQvUpkCgYAL3CnHVwUvmgGqDyf+
dmQqOqCaGrEDDhZLed2cu4Z67Kqhe8iLX8qaPuGpLg5Rd7FcH1+O2Q6RQjdpzP3+
svomcF2zL4iLx/UbvBeAgj5f0F/yVWScH2DROo/WS6CUKW68MQ9j8R6jZom6ctTa
WXospi8IkOGCeBZC9tOm8qOVAQ==
-----END PRIVATE KEY-----
18 changes: 0 additions & 18 deletions droid_config.json

This file was deleted.

5 changes: 4 additions & 1 deletion hedroid/common_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
VAR_DIR = os.path.join(ROOT_DIR, 'var')
CONFIG_PATH = os.path.join(ROOT_DIR, 'droid_config.json')
CONFIG_DIR = os.path.join(ROOT_DIR, 'config')
CONFIG_PATH = os.path.join(CONFIG_DIR, 'droid_config.json')

ZK_HOST = "localhost"
ZK_PORT = "2181"

DEBUG = True
1 change: 1 addition & 0 deletions hedroid/worker/vnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def portfile_wait(self):
def _start(self):
cmd = ["x11vnc", "-forever", "-rfbport", str(self.rfb_port),
"-display", ":{}".format(self.display),
"-noxfixes", "-nowf", "-ncache", "10",
"-clip", self.clip, "-flag", self._portfile_p]
# Remove portfile if it previously exists
try:
Expand Down
12 changes: 10 additions & 2 deletions hedroid/worker/websockify.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import subprocess32 as subprocess

from hedroid.logger import logger
from hedroid.common_settings import CONFIG_DIR, DEBUG
from hedroid.worker.executor import Executor


Expand All @@ -25,8 +26,15 @@ def netcat_wait(self, proc):
break

def _start(self):
cmd = ["websockify", ":{}".format(self.source_port),
":{}".format(self.target_port)]
cmd = ["websockify"]
if not DEBUG:
cmd = ["websockify",
"--cert", os.path.join(CONFIG_DIR, "hackerearth.crt"),
"--key", os.path.join(CONFIG_DIR, "hackerearth.key"),
"--ssl-only"]

cmd.extend([":{}".format(self.source_port),
":{}".format(self.target_port)])
proc = subprocess.Popen(
cmd,
stdout=self.stdout_fd,
Expand Down
5 changes: 5 additions & 0 deletions scripts/start_master_thrift.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /usr/bin/env python
from hedroid.master.thrift_server import start_server

if __name__ == '__main__':
start_server()
6 changes: 6 additions & 0 deletions scripts/start_worker_thrift.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /usr/bin/env python
from hedroid.worker.thrift_server import start_server


if __name__ == '__main__':
start_server()
2 changes: 1 addition & 1 deletion start_master_thrift.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env python
from master.thrift_server import start_server
from hedroid.master.thrift_server import start_server

if __name__ == '__main__':
start_server()

0 comments on commit 3f9affa

Please sign in to comment.