Skip to content

Commit 6cde856

Browse files
authored
Merge pull request #145 from consideRatio/pr/use-unix-socket-in-turbovnc
Access TurboVNC via a unix socket instead of a port
2 parents 9fa0cce + 9fad4eb commit 6cde856

File tree

3 files changed

+20
-32
lines changed

3 files changed

+20
-32
lines changed

.github/workflows/test.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
run: |
5656
# -help flag is not available for TurboVNC, but it emits the -help
5757
# equivalent information anyhow if passed -help, but also errors. Due
58-
# to this, we fallback to use the errorcode of vncsrever -list.
58+
# to this, we fallback to use the errorcode of vncserver -list.
5959
docker run test bash -c "vncserver -help || vncserver -list > /dev/null"
6060
6161
- name: Test vncserver

README.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,21 @@ When this extension is launched it will run a Linux desktop on the Jupyter singl
1616

1717
## VNC Server
1818

19-
This extension requires a [VNC Server](https://en.wikipedia.org/wiki/Virtual_Network_Computing)
20-
to be installed on the system (likely, in the container image). The
21-
most tested VNC server is [TigerVNC](https://tigervnc.org/), while
22-
[TurboVNC](https://www.turbovnc.org/) also works. Any VNC server available
23-
in `$PATH` as `vncserver` will be used, but no real testing outside of
24-
these servers has been performed.
25-
26-
For an example, see the [`Dockerfile`](./Dockerfile) in this repository which installs TigerVNC and XFCE4.
19+
This extension requires installing a [VNC server] on the system (likely in a
20+
container image). Compatibility with the latest version of [TigerVNC] and
21+
[TurboVNC] is maintained and verified with tests, but other VNC servers
22+
available in `$PATH` as `vncserver` could also work. The `vncserver` binary
23+
needs to accept the [flags seen passed here], such as `-rfbunixpath` and a few
24+
others.
25+
26+
For an example, see the [`Dockerfile`](./Dockerfile) in this repository which
27+
installs either TigerVNC or TurboVNC together with XFCE4.
28+
29+
[vnc server]: https://en.wikipedia.org/wiki/Virtual_Network_Computing
30+
[tigervnc]: https://tigervnc.org/
31+
[turbovnc]: https://www.turbovnc.org/
32+
[flags seen passed here]: https://github.com/jupyterhub/jupyter-remote-desktop-proxy/blob/main/jupyter_remote_desktop_proxy/setup_websockify.py
33+
[xfce4]: https://www.xfce.org/
2734

2835
## Installation
2936

@@ -35,7 +42,7 @@ For an example, see the [`Dockerfile`](./Dockerfile) in this repository which in
3542

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

4047
```
4148
dbus-x11
@@ -46,7 +53,6 @@ For an example, see the [`Dockerfile`](./Dockerfile) in this repository which in
4653
xorg
4754
xubuntu-icon-theme
4855
tigervnc-standalone-server
49-
tigervnc-xorg-extension
5056
```
5157

5258
The recommended way to install these is from your Linux system package manager

jupyter_remote_desktop_proxy/setup_websockify.py

+3-21
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,8 @@ def setup_websockify():
1212
"vncserver executable not found, please install a VNC server"
1313
)
1414

15-
# TurboVNC and TigerVNC share the same origin and both use a Perl script
16-
# as the executable vncserver. We can determine if vncserver is TigerVNC
17-
# by searching tigervnc string in the Perl script.
18-
#
19-
# The content of the vncserver executable can differ depending on how
20-
# TigerVNC and TurboVNC has been distributed. Below are files known to be
21-
# read in some situations:
22-
#
23-
# - https://github.com/TigerVNC/tigervnc/blob/v1.13.1/unix/vncserver/vncserver.in
24-
# - https://github.com/TurboVNC/turbovnc/blob/3.1.1/unix/vncserver.in
25-
#
26-
with open(vncserver) as vncserver_file:
27-
is_tigervnc = "tigervnc" in vncserver_file.read().casefold()
28-
29-
if is_tigervnc:
30-
unix_socket = True
31-
vnc_args = [vncserver, '-rfbunixpath', "{unix_socket}"]
32-
else:
33-
unix_socket = False
34-
vnc_args = [vncserver, '-localhost', '-rfbport', '{port}']
15+
# {unix_socket} is expanded by jupyter-server-proxy
16+
vnc_args = [vncserver, '-rfbunixpath', '{unix_socket}']
3517

3618
xstartup = os.getenv("JUPYTER_REMOTE_DESKTOP_PROXY_XSTARTUP")
3719
if not xstartup and not os.path.exists(os.path.expanduser('~/.vnc/xstartup')):
@@ -59,6 +41,6 @@ def setup_websockify():
5941
# /desktop/ is the user facing URL, while /desktop-websockify/ now *only* serves
6042
# websockets.
6143
"launcher_entry": {"title": "Desktop", "path_info": "desktop"},
62-
"unix_socket": unix_socket,
44+
"unix_socket": True,
6345
"raw_socket_proxy": True,
6446
}

0 commit comments

Comments
 (0)