octant-serve
A lightweight, read-only file server for HPC hosts that streams remote datasets to Octant on your local machine.
octant-serve is a read-only HTTP server that serves a file or directory on a remote host
(such as a login node or Slurm job) using byte-range requests so Octant on your local
machine can stream only the data it needs. It compiles to a single self-contained binary
with no runtime dependencies and requires no root privileges.
Desktop Octant launches octant-serve automatically whenever you open an
ssh:// URL. Use this guide to install octant-serve on a remote host or to
connect to it from a web browser.
Install
Every Octant release includes static Linux binaries for x86_64 and aarch64. On the
remote host, download the one matching its architecture (uname -m) into ~/bin:
mkdir -p ~/bin
curl -L -o ~/bin/octant-serve \
https://github.com/ndvis/octant/releases/latest/download/octant-serve-$(uname -m)-linux
chmod +x ~/bin/octant-serveKeep the name octant-serve: desktop Octant looks for it under that name. The binary's
third-party license notices are attached to the same release
(octant-serve-THIRD_PARTY_LICENSES.md).
When opening an ssh:// URL, desktop Octant searches for octant-serve in the host's
PATH, ~/bin, and ~/.cargo/bin.
Open data in a browser
Run a single command on your local machine to connect over SSH, forward a local port, and start the server:
ssh -t -L 8765:127.0.0.1:8765 hpc octant-serve --port 8765 --idle-timeout 2h /scratch/me/run.zarroctant-serve prints both a browser link and a URL you can paste into desktop Octant:
Then open in your browser:
https://ndvis.github.io/octant/?src=http://127.0.0.1:8765/t/<token>/fs/run.zarr
or paste into desktop Octant's Dataset panel:
http://127.0.0.1:8765/t/<token>/fs/run.zarr- Keep the
-tflag: Without it, terminatingsshwithCtrl-Cmay leaveoctant-serverunning in the background on the host. - Set an idle timeout: Passing
--idle-timeout 2hensures the server exits after two hours of inactivity if your SSH connection drops unexpectedly. - Local network prompt: Firefox and Chrome may prompt you once to allow access to devices on your local network; allow this permission.
- Safari compatibility: Safari blocks
https://pages from fetchinghttp://local addresses. To use Safari, serve the web app alongside the data with--web-dir(see below), or use Firefox or Chrome.
If you start octant-serve directly on the remote host instead
(octant-serve /scratch/me/run.zarr), it selects an available port automatically and prints
the corresponding ssh -L port-forwarding command to run on your local machine.
Serving the web app locally with --web-dir
If you place a copy of Octant's web app on the remote host, octant-serve can serve both
the application and the dataset from the same origin. This works in every browser—including
Safari—without triggering local-network permission prompts.
Each Octant release includes the web app as octant-web.tar.gz. Download it once on the
remote host, using the same release as octant-serve:
# On the remote host: unpacks to ~/octant-web
curl -L https://github.com/ndvis/octant/releases/latest/download/octant-web.tar.gz | tar -xz -C ~Then start the server with --web-dir from your local machine:
ssh -t -C -L 8765:127.0.0.1:8765 hpc \
octant-serve --port 8765 --idle-timeout 2h --web-dir ~/octant-web /scratch/me/run.zarrThe web app bundle is roughly 30 MB and is downloaded once per session; the -C flag
enables SSH compression to speed up the initial transfer.
Build the web app yourself
Inside an Octant checkout on your local machine (requires Trunk and Rust's wasm32
target):
trunk build --release --public-url ./ --dist octant-web
cargo run --release --manifest-path tools/cjk_slices/Cargo.toml -- octant-web/fonts/cjk
scp -r octant-web hpc:~/The build must use --public-url ./, and must not be the VS Code extension's
compressed dist-web folder; octant-serve reports an error otherwise. The second
command adds the font slices used for Chinese, Japanese and Korean text.
Serving behavior
- Single files vs. directories: Passing a single file serves its parent directory so
companion sidecar files (such as a GRIB
.idxindex) remain accessible. Passing a directory serves that directory directly. - Path confinement: Requests that traverse outside the served directory via
..or symbolic links are rejected by default. Pass--follow-symlinksto permit symbolic links pointing outside the root. - Access control: The server binds to
127.0.0.1by default (configurable with--bind) and prefixes all endpoints with a random session token so other users on a shared host cannot read your files. - Unconsolidated Zarr stores: Zarr directories without consolidated metadata can be opened in the web app. Desktop Octant currently requires consolidated metadata.
Command-line options
| Option | Description |
|---|---|
--port N | Port to listen on (defaults to an automatically selected free port) |
--bind ADDR | Network address to bind to (defaults to 127.0.0.1) |
--idle-timeout T | Exit automatically after duration T with no requests (e.g., 90s, 30m, 2h) |
--web-dir DIR | Also serve Octant's web app from DIR (the release's octant-web.tar.gz, or a trunk build --public-url ./) |
--follow-symlinks | Allow serving symbolic links that resolve outside the served directory |
--json | Emit a single JSON line (port, token, base_url, target_url, web_url) for scripting |
--token-stdin | Read the session token from the first line of standard input (used internally by desktop Octant's ssh:// integration) |