diff --git a/Dockerfile b/Dockerfile index 00b77cb..748f873 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,12 +9,23 @@ RUN apt-get update -y -q && \ novnc \ tigervnc-standalone-server +RUN apt-get install -y -q python-pip +# https://github.com/novnc/noVNC/issues/1276 +RUN /usr/bin/pip install -U websockify==0.9.0 -EXPOSE 8080 -ENTRYPOINT ["bash"] -# https://serverfault.com/questions/376302/tigervnc-ssh-without-a-vnc-password/580859#580859 -# vncserver -verbose -xstartup startlxde -SecurityTypes None -geometry 1024x768 -# /usr/share/novnc/utils/launch.sh --listen 5902 --vnc localhost:5901 +ADD websocket-path-ui-js.patch /usr/share/novnc/include +RUN cd /usr/share/novnc/include/ && \ + patch -p0 < websocket-path-ui-js.patch -# In browser go to http://localhost:8080/vnc.html?autoconnect=true +RUN ln -s /usr/lib/websockify/rebind.so /usr/local/lib/ +USER jovyan +# RUN /opt/conda/bin/pip install jupyter-server-proxy +RUN /opt/conda/bin/pip install https://github.com/manics/jupyter-server-proxy/archive/indexpage.zip +ADD jupyter_notebook_config.py /home/jovyan/.jupyter/ + +# websockify --web /usr/share/novnc 5901 -- vncserver -verbose -xstartup startlxde -SecurityTypes None -geometry 1024x768 -fg :1 + +# Both these should work: +# http://localhost:5901/vnc.html?autoconnect=true +# http://127.0.0.1:8888/lxde/vnc.html?path=%2Flxde%2Fwebsockify&autoconnect=true diff --git a/jupyter_notebook_config.py b/jupyter_notebook_config.py new file mode 100644 index 0000000..ae273ac --- /dev/null +++ b/jupyter_notebook_config.py @@ -0,0 +1,13 @@ +c.ServerProxy.servers = { + 'lxde': { + 'command': [ + '/usr/local/bin/websockify', '--web', '/usr/share/novnc', '5901', '--', 'vncserver', '-verbose', '-xstartup', 'startlxde', '-SecurityTypes', 'None', '-geometry', '1024x768', '-fg', ':1'], + 'absolute_url': False, + 'environment': { + 'PATH': '/usr/local/bin:/usr/bin:/bin', + }, + 'port': 5901, + 'timeout': 30, + 'indexpage': 'vnc.html?autoconnect=true', + } +} diff --git a/websocket-path-ui-js.patch b/websocket-path-ui-js.patch new file mode 100644 index 0000000..99d9d30 --- /dev/null +++ b/websocket-path-ui-js.patch @@ -0,0 +1,20 @@ +--- ui.js.bak 2019-09-26 16:55:26.816459927 +0000 ++++ ui.js 2019-09-26 16:57:06.149994873 +0000 +@@ -82,7 +82,7 @@ + UI.initSetting('shared', true); + UI.initSetting('view_only', false); + UI.initSetting('connectTimeout', 2); +- UI.initSetting('path', 'websockify'); ++ console.log('1', UI.getSetting('path')); console.log(); UI.initSetting('path', window.location.pathname.replace(/[^/]*$/, '').substring(1) + 'websockify'); console.log('2', UI.getSetting('path')); + UI.initSetting('repeaterID', ''); + + UI.rfb = RFB({'target': $D('noVNC_canvas'), +@@ -90,7 +90,7 @@ + 'onClipboard': UI.clipReceive, + 'onDesktopName': UI.updateDocumentTitle}); + +- autoconnect = WebUtil.getQueryVar('autoconnect', false); ++ autoconnect = WebUtil.getQueryVar('autoconnect', true); + if (autoconnect === 'true' || autoconnect == '1') { + autoconnect = true; + UI.connect();