From b6f23b5e8f3826fb778e05dece16ff446678e104 Mon Sep 17 00:00:00 2001
From: Stefano Alberto Russo <stefano.russo@gmail.com>
Date: Wed, 29 Apr 2020 17:49:39 +0200
Subject: [PATCH] Addedd support for novnc port.

---
 containers/MetaDesktop/Dockerfile             |  5 ++--
 containers/MetaDesktop/files/run_novnc.sh     | 12 ++++++++++
 .../MetaDesktop/files/supervisord_novnc.conf  | 23 +++++++++++++++++++
 3 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100755 containers/MetaDesktop/files/run_novnc.sh
 create mode 100644 containers/MetaDesktop/files/supervisord_novnc.conf

diff --git a/containers/MetaDesktop/Dockerfile b/containers/MetaDesktop/Dockerfile
index ea43e98..9f43a61 100644
--- a/containers/MetaDesktop/Dockerfile
+++ b/containers/MetaDesktop/Dockerfile
@@ -56,8 +56,9 @@ RUN cd /opt && wget https://bintray.com/tigervnc/stable/download_file?file_path=
 # Supervisord configuration
 COPY files/supervisord_vnc.conf /etc/supervisor/conf.d/
 COPY files/run_vnc.sh /etc/supervisor/conf.d/
+COPY files/run_novnc.sh /etc/supervisor/conf.d/
 RUN chmod 755 /etc/supervisor/conf.d/run_vnc.sh
-
+RUN chmod 755 /etc/supervisor/conf.d/run_novnc.sh
 
 # Web VNC (noVNC) v0.6.1.
 # NOTE: this is a custom version from Doro Wu (fcwu.tw@gmail.com).
@@ -69,7 +70,7 @@ COPY files/index.html /usr/lib/noVNC
 RUN apt-get install -y net-tools
 
 # Supervisord configuration
-COPY files/supervisord_webvnc.conf /etc/supervisor/conf.d/
+COPY files/supervisord_novnc.conf /etc/supervisor/conf.d/
 
 # X environment setup/startup
 RUN apt-get install fluxbox -y
diff --git a/containers/MetaDesktop/files/run_novnc.sh b/containers/MetaDesktop/files/run_novnc.sh
new file mode 100755
index 0000000..3caeaf8
--- /dev/null
+++ b/containers/MetaDesktop/files/run_novnc.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Exec TigerVNC server 
+
+if [ "x$TASK_PORT" == "x" ]; then
+    /usr/lib/noVNC/utils/launch.sh --listen 8590
+    echo "Running noVN on port 8590"
+else
+    /usr/lib/noVNC/utils/launch.sh --listen $TASK_PORT
+    echo "Running noVN on port $TASK_PORT"
+
+fi
diff --git a/containers/MetaDesktop/files/supervisord_novnc.conf b/containers/MetaDesktop/files/supervisord_novnc.conf
new file mode 100644
index 0000000..abedb27
--- /dev/null
+++ b/containers/MetaDesktop/files/supervisord_novnc.conf
@@ -0,0 +1,23 @@
+;=======================================
+; noVNC service
+;=======================================
+ 
+[program:novnc]
+ 
+; General
+directory     = /usr/lib/noVNC/
+command       = /etc/supervisor/conf.d/run_novnc.sh
+numprocs      = 1
+autostart     = true
+autorestart   = true
+startsecs     = 10
+stopwaitsecs  = 30
+process_name  = novnc
+ 
+; Standard out / error
+stdout_logfile          = /metauser/logs/%(program_name)s.log
+stdout_logfile_maxbytes = 5MB
+stdout_logfile_backups  = 10
+stderr_logfile          = /metauser/logs/%(program_name)s.log
+stderr_logfile_maxbytes = 5MB
+stderr_logfile_backups  = 10
-- 
GitLab