noVNC plugin
1 note
- Plugins are part of enterprise plans. Contact support to enable them for your account. support@unikraft.com.
The noVNC plugin adds a virtual desktop to an instance. You use the desktop in a browser through noVNC, and a program drives it through the plugin endpoint. The plugin brings its own root filesystem for the desktop, so the image of the instance needs no desktop software.
| Image | Content |
|---|---|
plugins/novnc:latest | A desktop with a terminal, approximately 210 MiB. |
plugins/novnc:firefox-latest | A desktop with a terminal and the Extended Support Release of Firefox, approximately 510 MiB, for an instance with at least 2 GiB of memory. |
The plugin serves the desktop on the destination port of its first plugin service:
Code
Open https://novnc-<uuid>.api.fra.unikraft.cloud/ in a browser, and log in with the user novnc and the password of the configuration.
With stateful scale-to-zero, the instance sleeps while nobody uses the desktop, and wakes with its windows still open.
Always set a password.
Without one, anyone who knows the address can control the desktop.
The plugin takes these keys in config, all optional:
| Key | Default | Description |
|---|---|---|
password | None | Password of the desktop, without which the desktop has no authentication |
user | novnc | User name for HTTP basic authentication, without a : |
width, height | 1024, 768 | Initial size of the screen, at most 2560 × 1600 |
host_view | false | true shows the files and mounts of the instance in the desktop, and runs the desktop programs as root |
launchers | None | Panel buttons, each with a name, an exec command, and an optional icon |
autostart | None | Shell commands that the desktop starts when it's ready |
The desktop accepts the password in these ways:
| Method | Use |
|---|---|
HTTP basic authentication with user and password | The login dialog of the browser, or a program, for example curl -u 'novnc:<password>' |
The token query parameter | A link that opens the desktop without a login dialog, a WebSocket to /websockify, or a frame on a page of another site |
| A session cookie | A browser after it opens a link with token, until the desktop restarts |
For example, this link opens the desktop:
Code
In a browser, the plugin then sets a session cookie, and removes the token from the address.
The first address still contains the password, so the browser history and the logs of a proxy can keep it.
Treat a link with token like the password.
A page of another site can show the desktop in a frame only with the token in the address of the frame, for example vnc.html?token=<URL-encoded password>&autoconnect=true.
Thus, that page contains the password.
A program drives the desktop through the plugin endpoint, /v1/instances/<uuid>/plugins/novnc.
The API reference describes each request.
Positions are in pixels from the top-left corner of the screen:
| Request | Body | Description |
|---|---|---|
GET /screen | None | Returns the width and height of the screen. |
PUT /screen | {"width": 1280, "height": 800} | Resizes the screen, and keeps the windows open. |
POST /pointer/move | {"x": 512, "y": 384} | Moves the pointer. |
POST /pointer/click | {"x": 512, "y": 384, "button": "left", "count": 2} | Presses and releases a mouse button: x and y are optional, button is left, middle, or right, and count is 1 to 10. |
Code
Learn more
- Plugins: how plugins load, and how plugin services work.
- noVNC plugin API reference: every request of the plugin.
- Remote desktops: run a desktop on Unikraft Cloud.
- Scale-to-zero: how an idle desktop sleeps and wakes.