From 4844e0d8de5a944db3f5fc6c44bae2a080f475e2 Mon Sep 17 00:00:00 2001 From: Tommy Tang Date: Thu, 31 Aug 2017 09:21:31 +0000 Subject: [PATCH 1/4] update steps to start novnc as docker container --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 70a819a9..4cbedef2 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,10 @@ WebSockets to TCP socket proxy. There is a python proxy included ### Quick Start +* download docker-compose.yml and customize server:port parameter + +* docker-compose -f docker-compose.yml up + * Use the launch script to start a mini-webserver and the WebSockets proxy (websockify). The `--vnc` option is used to specify the location of a running VNC server: From 9964a55d496a3dbb7a111fd710a70daccd58fff7 Mon Sep 17 00:00:00 2001 From: Tommy Tang Date: Thu, 31 Aug 2017 09:35:13 +0000 Subject: [PATCH 2/4] add dockerfile and sample compose file --- Dockerfile | 16 ++++++++++++++++ docker-compose.yml | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100755 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 00000000..62d749ec --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM python + +ENV VER=${VER:-relpath} \ + REPO=https://github.com/twhtanghk/noVNC \ + APP=/usr/src/app + +RUN apt-get update \ +&& apt-get install -y git net-tools \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* \ +&& pip install numpy \ +&& git clone -b $VER $REPO $APP + +WORKDIR $APP + +EXPOSE 6080 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..9aca6a4b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '2' +services: + novnc: + image: twhtanghk/novnc + ports: + - 6080 + env_file: + - ../.env + command: /usr/src/app/utils/launch.sh --vnc server:port From 214e92f4a942d942969a3c7d840e278ea32d216d Mon Sep 17 00:00:00 2001 From: Tommy Tang Date: Thu, 31 Aug 2017 09:49:16 +0000 Subject: [PATCH 3/4] add relpath for websocker uri --- Dockerfile | 2 +- core/rfb.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 62d749ec..1b155532 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python -ENV VER=${VER:-relpath} \ +ENV VER=${VER:-master} \ REPO=https://github.com/twhtanghk/noVNC \ APP=/usr/src/app diff --git a/core/rfb.js b/core/rfb.js index ece0f008..5aa5a1db 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -392,7 +392,10 @@ RFB.prototype = { uri = this._encrypt ? 'wss' : 'ws'; } - uri += '://' + this._rfb_host + ':' + this._rfb_port + '/' + this._rfb_path; + var relpath = location.pathname.split('/'); + relpath.splice(1, -1); + relpath = relpath.join('/') + '/'; + uri += '://' + this._rfb_host + ':' + this._rfb_port + relpath + this._rfb_path; Log.Info("connecting to " + uri); try { From 06e99de5eee1aa74c4da872bb3106e3109d5634c Mon Sep 17 00:00:00 2001 From: root Date: Fri, 1 Sep 2017 09:54:54 +0800 Subject: [PATCH 4/4] update relpath creation --- core/rfb.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/rfb.js b/core/rfb.js index 5aa5a1db..ae4d13d2 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -393,8 +393,8 @@ RFB.prototype = { } var relpath = location.pathname.split('/'); - relpath.splice(1, -1); - relpath = relpath.join('/') + '/'; + relpath[relpath.length - 1] = ""; + relpath = relpath.join("/"); uri += '://' + this._rfb_host + ':' + this._rfb_port + relpath + this._rfb_path; Log.Info("connecting to " + uri);