Management agent for GlassOS. It supervises the glass
process under cage and exposes an HTTP API for OTA
updates, log access, configuration management, and asset uploads.
supervisor is built into GlassOS images and runs
automatically as a systemd service. Refer to the GlassOS repository for pre-built images.
Go 1.26 or later is required.
go build -o supervisor ./cmd/supervisorsupervisor [options]--addr ADDR (default: :80)
HTTP listen address for the management API and web UI.
--glass-bin PATH (default: /usr/lib/glass/glass)
Path to the glass binary that supervisor supervises. OTA updates replace this file.
--data-dir PATH (default: /data)
Root of the persistent data directory. The agent reads and writes the following sub-directories:
| Path | Purpose |
|---|---|
<data-dir>/config/config.yaml |
Looking Glass configuration file |
<data-dir>/config/secrets.yaml |
Looking Glass secrets file |
<data-dir>/assets/ |
Static assets served to modules |
<data-dir>/modules/ |
Downloaded WASM module cache |
--log.level LEVEL (default: info)
Minimum log level. Supported values: trace, debug, info, warn, error.
All endpoints are served on the address given by --addr (default port 80).
Responses use application/json unless noted otherwise.
Returns a JSON snapshot of the supervised glass process.
Response 200 OK
{
"pid": 1234,
"restarts": 2,
"uptime": "5m32s"
}| Field | Type | Description |
|---|---|---|
pid |
integer | OS process ID of the running glass process. 0 if not yet started. |
restarts |
integer | Number of times the process has been restarted since agent startup. |
uptime |
string | Duration since the process last started. Empty string if the process is not running. |
Returns the last 2000 lines of glass stdout/stderr as text/plain.
Query parameters
| Parameter | Description |
|---|---|
follow=true |
Stream new log lines in real time until the client disconnects. |
Response 200 OK — text/plain; charset=utf-8
2024/01/15 10:30:00 Starting glass...
2024/01/15 10:30:01 Module loaded: simple-clock
Sends SIGTERM to the running glass process. The supervision loop restarts it automatically.
Response 204 No Content
Downloads a new glass binary, verifies its SHA-256 checksum, replaces --glass-bin, and
restarts the process. The download is aborted if the checksum does not match.
Accepts application/gzip, application/zip, or an uncompressed binary. For zip archives
the first file in the archive is used.
Request body application/json
{
"url": "https://example.com/glass-linux-arm64.zip",
"sha256": "e3b0c44298fc1c149afb..."
}| Field | Required | Description |
|---|---|---|
url |
✓ | URL of the binary or compressed archive to download. |
sha256 |
✓ | Expected lowercase hex-encoded SHA-256 of the downloaded binary. |
Response 204 No Content on success.
Returns the current config.yaml as text/plain.
Response 200 OK — text/plain; charset=utf-8
Response 404 Not Found — if no config has been uploaded yet.
Replaces config.yaml with the request body. The file is written atomically.
Restart Glass to apply the new configuration.
Request body Raw YAML.
Response 204 No Content
Replaces secrets.yaml with the request body. The file is written atomically.
Restart Glass to apply the new secrets.
Request body Raw YAML.
Response 204 No Content
Returns a JSON array of filenames currently stored in the assets directory.
Response 200 OK
["background.jpg", "logo.svg"]Downloads the named asset file. Supports HTTP range requests and conditional GET via
Last-Modified.
Response 200 OK — file contents with appropriate Content-Type.
Response 404 Not Found — if the asset does not exist.
Uploads a file to the assets directory, replacing any existing file with the same name. The file is written atomically.
Request body Raw file bytes.
Response 204 No Content
Deletes the named asset file. Returns 204 No Content even if the file does not exist.
Response 204 No Content
These endpoints require RAUC and systemd-logind to be reachable on the system D-Bus. They are only meaningful when running on GlassOS.
Downloads a RAUC bundle from the given URL and installs it. The request blocks until installation completes. Reboot the device to activate the new OS image.
Request body application/json
{
"url": "https://example.com/glassos-v1.2.3-rpi4.raucb"
}| Field | Required | Description |
|---|---|---|
url |
✓ | URL of the .raucb bundle to download and install. |
Response 204 No Content on success.
Returns the RAUC slot status for the running system.
Response 200 OK
{
"compatible": "glassos-rpi4",
"variant": "",
"booted": "system0",
"slots": [
{
"name": "system0",
"class": "system",
"device": "/dev/mmcblk0p4",
"type": "erofs",
"bootname": "system0",
"state": "booted",
"sha256": "abc123...",
"size": 268435456
},
{
"name": "system1",
"class": "system",
"device": "/dev/mmcblk0p5",
"type": "erofs",
"bootname": "system1",
"state": "inactive"
}
]
}| Field | Description |
|---|---|
compatible |
RAUC system compatibility string. |
variant |
RAUC system variant string. Empty if not set. |
booted |
Name of the currently active boot slot. |
slots |
Array of all configured RAUC slots and their states. |
Triggers a graceful system reboot via systemd-logind. The 204 No Content response is sent
before the reboot begins.
Response 204 No Content
curl http://glass.local/glass/statuscurl http://glass.local/glass/logs
# Stream live
curl http://glass.local/glass/logs?follow=truecurl -X POST http://glass.local/glass/restartcurl -X POST http://glass.local/glass/update \
-H 'Content-Type: application/json' \
-d '{"url":"https://github.com/glasslabs/looking-glass/releases/download/v1.2.3/glass-v1.2.3-linux-arm64-wayland.zip","sha256":"<hex>"}'curl -X POST http://glass.local/glass/config --data-binary @config.yaml
curl -X POST http://glass.local/glass/restartcurl http://glass.local/glass/configcurl -X POST http://glass.local/glass/secrets --data-binary @secrets.yaml
curl -X POST http://glass.local/glass/restartcurl -X POST http://glass.local/glass/assets/background.jpg --data-binary @background.jpgcurl http://glass.local/glass/assetscurl http://glass.local/glass/assets/background.jpg -o background.jpgcurl -X DELETE http://glass.local/glass/assets/background.jpgcurl -X POST http://glass.local/os/update \
-H 'Content-Type: application/json' \
-d '{"url":"https://github.com/glasslabs/os/releases/download/v1.2.3/glassos-v1.2.3-rpi4.raucb"}'
# Then reboot to activate the new image
curl -X POST http://glass.local/os/rebootcurl http://glass.local/os/status