Skip to content

Commit

Permalink
Remove websockify
Browse files Browse the repository at this point in the history
jupyter-server-proxy 4.3.0 includes jupyterhub/jupyter-server-proxy#447
  • Loading branch information
manics committed Jul 4, 2024
1 parent b4e88e9 commit cadd5a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 32 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ For an example, see the [`Dockerfile`](./Dockerfile) in this repository which in
pip install jupyter-remote-desktop-proxy
```

2. Install the [websockify](https://github.com/novnc/websockify) dependency. Unfortunately,
the PyPI `websockify` package is broken, so you need to install it either
from [conda-forge](https://anaconda.org/conda-forge/websockify) or with
[apt](https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=websockify)

3. Install the packages needed to provide a VNC server and the actual Linux Desktop environment.
2. Install the packages needed to provide a VNC server and the actual Linux Desktop environment.
You need to pick a desktop environment (there are many!) - here are the packages
to use TigerVNC and the light-weight [XFCE4](https://www.xfce.org/) desktop environment on Ubuntu 22.04:

Expand Down
8 changes: 2 additions & 6 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# Unfortunately the version of websockify on PyPI doesn't include the [compiled
# wrapper library](https://github.com/novnc/websockify#wrap-a-program) which is
# used by this extension, so either you'd have to manually compile it after pip
# installing websockify, or use the conda package.
#
channels:
- conda-forge
dependencies:
- jupyter-server-proxy>=1.4
- jupyter-server-proxy>=4.3.0
- jupyterhub-singleuser
- pip
# TODO: remove when test.yaml is updated
- websockify
26 changes: 6 additions & 20 deletions jupyter_remote_desktop_proxy/setup_websockify.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import shlex
import tempfile
from shutil import which

HERE = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -12,8 +11,6 @@ def setup_websockify():
raise RuntimeError(
"vncserver executable not found, please install a VNC server"
)
if not which('websockify'):
raise RuntimeError("websockify executable not found, please install websockify")

# TurboVNC and TigerVNC share the same origin and both use a Perl script
# as the executable vncserver. We can determine if vncserver is TigerVNC
Expand All @@ -30,16 +27,10 @@ def setup_websockify():
is_tigervnc = "tigervnc" in vncserver_file.read().casefold()

if is_tigervnc:
# Make a secure temporary directory for sockets that is only readable,
# writeable, and searchable by our uid - TigerVNC can listen to a Unix
# socket!
sockets_dir = tempfile.mkdtemp()
sockets_path = os.path.join(sockets_dir, 'vnc-socket')

websockify_args = ['--unix-target', sockets_path]
vnc_args = [vncserver, '-rfbunixpath', sockets_path]
unix_socket = True
vnc_args = [vncserver, '-rfbunixpath', "{unix_socket}"]
else:
websockify_args = []
unix_socket = False
vnc_args = [vncserver, '-localhost', '-rfbport', '{port}']

if not os.path.exists(os.path.expanduser('~/.vnc/xstartup')):
Expand All @@ -58,18 +49,13 @@ def setup_websockify():
)

return {
'command': [
'websockify',
'--verbose',
'--heartbeat=30',
'{port}',
]
+ websockify_args
+ ['--', '/bin/sh', '-c', f'cd {os.getcwd()} && {vnc_command}'],
'command': ['/bin/sh', '-c', f'cd {os.getcwd()} && {vnc_command}'],
'timeout': 30,
'new_browser_window': True,
# We want the launcher entry to point to /desktop/, not to /desktop-websockify/
# /desktop/ is the user facing URL, while /desktop-websockify/ now *only* serves
# websockets.
"launcher_entry": {"title": "Desktop", "path_info": "desktop"},
"unix_socket": unix_socket,
"raw_socket_proxy": True,
}

0 comments on commit cadd5a2

Please sign in to comment.