Documentation version: this README and the sibling docs (GUIDE.md, CLI.md, API.md, MIGRATING.md) describe manta 2.0.0. For an older release, browse the repository at the matching git tag (e.g.
v1.64.3for the last v1 release).
Another CLI tool for Alps.
A command-line + HTTP API frontend for HPC clusters running CSM or OpenCHAMI. Two independent binaries from one Cargo workspace:
manta— interactive CLI. Logs in to the CSCS Keycloak itself (one token for every site), then forwards every operation to amanta-serverover HTTPS; never calls the backend directly.manta-server— Axum HTTPS server. Holds the per-site backend credentials and exposes a Swagger-documented REST + WebSocket API athttps://<host>:8443/v2(default port).
Get something running locally:
# 1. clone and enter the repo
git clone https://github.com/eth-cscs/manta && cd manta
# 2. build both binaries
cargo build -p manta-cli -p manta-server
# 3. drop a minimal cli.toml into manta's config directory.
# Linux: ~/.config/manta/ macOS: ~/Library/Application Support/local.cscs.manta/
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/manta" # Linux
# CONFIG_DIR="$HOME/Library/Application Support/local.cscs.manta" # macOS
mkdir -p "$CONFIG_DIR"
cat > "$CONFIG_DIR/cli.toml" <<'EOF'
log = "info"
site = "ochami"
hsm_group = "nodes_free"
manta_server_url = "https://manta-server.example.com:8443" # required
EOF
# server.toml is site-specific (TLS certs + per-site backend URLs) —
# see the Configuration files section below for the full schema.
# 4. start the server, then drive it with the CLI
./target/debug/manta-server &
./target/debug/manta get sessionsStaying current. Once you have a working manta binary,
three commands handle the day-to-day install plumbing:
# Install shell tab completion to the shell's standard XDG dir
# (substitute bash / fish for zsh; pass --path <DIR> to override)
manta gen-autocomplete --shell zsh
# Install the consolidated `man manta` page (use `/sessions` to search)
# Defaults to $XDG_DATA_HOME/man/man1 (`~/.local/share/man/man1`)
manta gen-man
# Check for a newer release; then apply it
manta upgrade --check
manta upgrade -ymanta upgrade reads the latest v* workspace tag from GitHub
releases (filtered to the same major version as the running binary)
and atomically swaps the binary in place. If you installed
via Homebrew, prefer brew upgrade manta-cli — manta upgrade will
warn (but not block) when it detects a Homebrew-managed install
path. See CLI.md#gen-autocomplete,
#gen-man, and #upgrade for the
full flag reference.
Previewing before mutating. Every backend-mutating manta verb
accepts -d/--dry-run, which builds and prints the exact request
that would have been sent without contacting the server (skipping
confirmation prompts and any user-supplied hooks). It's the safe
way to verify a script before promoting it to a real run. See
GUIDE.md §12 — Preview before mutating with --dry-run.
| Where to look next | For |
|---|---|
| GUIDE.md | common workflows ("how do I deploy a SAT file?") |
| CLI.md | per-flag reference for every manta subcommand |
| API.md | REST + WebSocket endpoints, schemas, status codes |
| MIGRATING.md | upgrading from manta v1 to v2 |
| ARCHITECTURE.md | crate layout, module boundaries, security model |
| SECURITY.md | how to report vulnerabilities, supported versions, security-model summary |
| eth-cscs.github.io/manta | rustdoc for the whole workspace (rebuilt on every push to main) |
manta is a Cargo workspace with three crates:
crates/
├── manta-shared/ (lib) — wire types, common helpers (config loader, MantaError, logging)
├── manta-cli/ (bin) — terminal client (binary: `manta`)
└── manta-server/ (bin) — Axum HTTPS server (binary: `manta-server`)
Build a single crate with cargo build -p manta-cli or cargo build -p manta-server; the two binaries do not depend on each other. See ARCHITECTURE.md for details.
| Document | Description |
|---|---|
| GUIDE.md | User guide — common workflows and practical examples |
| CLI.md | Full CLI command reference — every command, subcommand, and flag |
| API.md | HTTP API reference — REST and WebSocket endpoints |
| ARCHITECTURE.md | Codebase architecture — for contributors |
Manta is a frontend cli to interact with CSM and OCHAMI.
Install build dependencies
$ cargo install cargo-release dist git-cliff
distis the renamed successor ofcargo-dist; the old name still installs the same binary but emits a deprecation warning.
git clone https://github.com/eth-cscs/manta && cd mantaThe main branch holds the current 2.x line.
The two binaries ship as two images, each with its own multi-stage Dockerfile alongside its source. Build from the workspace root in both cases so the Cargo lockfile and shared sources are in the build context:
docker build -f crates/manta-cli/Dockerfile -t manta-cli .
docker build -f crates/manta-server/Dockerfile -t manta-server .
A .dockerignore at the workspace root keeps target/, .git/, and editor state out of the context.
The CLI reads cli.toml; the HTTP server reads server.toml. Both live in manta's config directory (~/.config/manta/ on Linux, ~/Library/Application Support/local.cscs.manta/ on macOS). Each has its own schema — see the Configuration files section below for the full layout. A minimal CLI config looks like:
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/manta" # Linux
# CONFIG_DIR="$HOME/Library/Application Support/local.cscs.manta" # macOS
mkdir -p "$CONFIG_DIR"
cat > "$CONFIG_DIR/cli.toml" <<EOF
log = "info"
site = "ochami"
hsm_group = "nodes_free"
manta_server_url = "https://manta-server.example.com:8443" # required
EOFThe CLI config has no [sites.*] block — per-site backend connection details (URLs, TLS certs, k8s, vault) live in server.toml. The CLI's site = "..." value is just the X-Manta-Site header it sends on each request; the server validates it.
Start the ochami services from the deployment recipe quickstart.
Note
Make sure to set the ACCESS_TOKEN environment variable and create a CA certificate in the same directory as the config file. This can be done using the convienience functions from the the OpenCHAMI deployment recipe repository.
To set the ACCESS_TOKEN environment variable and create/renew the CA certificate (assuming you have cloned the deployment recipe quickstart):
# collection of useful functions
ochami_deployment_recipe_quickstart=path/to/quickstart
source $ochami_deployment_recipe_quickstart/bash_functions.sh
# set environment variable then create the cert
export ACCESS_TOKEN=$(gen_access_token)
get_ca_cert > "$CONFIG_DIR/ochami_root_cert.pem" # $CONFIG_DIR set aboveThe manta-cli image has manta as its ENTRYPOINT, so anything after the image tag is forwarded as CLI args:
docker run -it --network=host \
-v "$CONFIG_DIR":/root/.config/manta \
-e MANTA_SA_CLIENT_ID -e MANTA_SA_CLIENT_SECRET \
manta-cli get redfish-endpointsThe manta-server image runs the HTTPS server; mount your config + TLS material and publish the port:
docker run -p 8443:8443 \
-v "$CONFIG_DIR":/root/.config/manta:ro \
-v /etc/manta/tls:/etc/manta/tls:ro \
manta-serverNote
Some commands will not work yet with OpenCHAMI services and will sometimes show a message indicating no implementation for the backend.
docker run -it --rm --network=host \
-v "$CONFIG_DIR":/root/.config/manta \
-e MANTA_SA_CLIENT_ID -e MANTA_SA_CLIENT_SECRET \
manta-cli get sessions
ERROR | Get and filter sessions command not implemented for this backend
exit status 1Some other commands may fail simply because CSM-only services are not part of an OpenCHAMI deployment.
Manta can run as an HTTPS server, exposing all CLI operations as a REST + WebSocket API. This is useful for automation, scripting, and integration with other tools without requiring direct CLI access.
The HTTP server lives in its own binary (manta-server) inside the crates/manta-server workspace member. Build it with cargo build -p manta-server.
Start the server
Write server.toml in manta's config directory first — see the Configuration files section below for the path on your platform. Then:
manta-serverEach setting in the [server] block can be overridden at runtime:
| Flag | Overrides | Description |
|---|---|---|
--port |
[server].port |
Port to listen on |
--listen-address |
[server].listen_address |
Bind address |
--cert |
[server].cert |
TLS certificate path |
--key |
[server].key |
TLS private key path |
--allow-http |
[server].allow_http |
Opt in to plain-HTTP listen mode when no cert/key is set. Default fail-closed — the server refuses to start without TLS so bearer tokens can't accidentally land on the wire in cleartext. Set only when TLS terminates upstream. |
Beyond the flags above, two settings are config-only:
[server].migrate_backup_root— absolute filesystem directory that confinesPOST /migrate/{backup,restore}paths. Required for those endpoints to function at all; when unset the server returns400 BadRequesteven for admin callers. Set, then restart.- HSTS (
Strict-Transport-Security: max-age=31536000; includeSubDomains) is emitted on every response unconditionally. Browsers ignore it over plain HTTP per RFC 6797, so it's a no-op underallow_http = trueand active otherwise.
The CLI no longer ships a
manta servesubcommand — invokemanta-serverdirectly.
Manta reads two TOML files, one per binary: cli.toml for the CLI and server.toml for the HTTP server. Both live in manta's config directory:
- Linux:
~/.config/manta/(or$XDG_CONFIG_HOME/manta/if set) - macOS:
~/Library/Application Support/local.cscs.manta/
Override the path with MANTA_CLI_CONFIG / MANTA_SERVER_CONFIG.
The two schemas are disjoint: the CLI's cli.toml carries only the CLI-side knobs (site, hsm_group, manta_server_url, optional socks5_proxy, the optional oidc_* login settings) — it has no [sites.*] block and no Kafka audit block (audit emission is server-side only). Every per-site backend connection detail (URLs, TLS certs, k8s, vault) lives in server.toml, alongside the [server] block (TLS, listen address, console timeout, request timeout) and the optional [auditor.kafka] for the server-side audit stream. The server has no per-site SOCKS5 proxy knob — it's expected to sit in a network position where backend URLs are directly reachable.
cli.toml
manta_server_url is required: the CLI no longer talks to CSM/OCHAMI backends directly — every operation is forwarded to the named manta server. Run manta-server on a reachable host first. Login is the one exception: the CLI gets its bearer token from the CSCS Keycloak itself (see Authentication below).
log = "info"
site = "alps" # optional: active site (X-Manta-Site header); omit and pass --site per invocation
manta_server_url = "https://manta-server.cscs.ch:8443" # required
hsm_group = "nodes_free" # optional: default group used when a command takes no explicit group
socks5_proxy = "socks5h://127.0.0.1:1080" # optional: reaches manta-server
read_only = false # optional: refuse mutating verbs locally (see below)
request_timeout_secs = 600 # optional: per-request HTTP timeout (seconds). Default 300 for REST calls; streams (SSE log tail, WS console) unlimited. Setting this also caps streams — pick a value larger than your worst-case session if you set it.
# Optional CLI-side wait loops. Values shown are the built-in defaults;
# delete a line to keep the default. Full annotations in examples/cli.toml.
power_poll_interval_secs = 3
power_max_poll_attempts = 300 # 300 x 3 s = 15 min
sat_file_poll_interval_secs = 10
sat_file_poll_budget_secs = 14400 # 4 hours
sat_file_not_visible_budget_secs = 300 # 5 minutes
# Optional login settings. Defaults: the CSCS realm and the manta client.
# oidc_issuer_url = "https://auth.cscs.ch/auth/realms/cscs"
# oidc_client_id = "manta-cli"
# oidc_headless = false # true: device-code login (URL + code) instead of a browserread_only = true makes the CLI refuse every backend-mutating verb (add, apply, backup, delete, migrate, power, restore, run) before any request leaves the process; --dry-run invocations are still allowed. Toggle it with manta config set read-only / manta config unset read-only. It is a local foot-gun guard, not a security control — there is no server-side counterpart.
Authentication. The CLI logs in to the CSCS Keycloak directly and uses one bearer token for every site; manta-server never sees user credentials. No site accepts the CSCS token as is, so on every request the server exchanges it at the site's identity provider (see [sites.<name>.token_exchange] below): the site's Keycloak for a CSM token, or the site's Hydra for an OpenCHAMI token. It uses the exchanged token for the backend API and, on CSM, Vault.
Every request the CLI sends carries a new token, one no request has carried before: the server exchanges every token it receives, and an OpenCHAMI site's Hydra accepts each token only once. This also keeps a long manta power or manta apply sat-file working, though the access token lives for minutes. The CLI gets each token like this:
- Service-account credentials in
MANTA_SA_CLIENT_IDandMANTA_SA_CLIENT_SECRET(for CI): a token from the CSCS Keycloak with the client credentials grant. Never cached. Set both or neither. - Otherwise the refresh token cached in manta's cache directory (
token.json, mode0600): a refreshed token, written back to the cache. - When there is no cache, or the Keycloak refuses the cached refresh token (the session ended or was revoked): an interactive login, a browser window (authorization code + PKCE), or — with
oidc_headless = true, inside an SSH session, without a graphical display (DISPLAY/WAYLAND_DISPLAY, outside macOS), or when no browser can be opened — a device code to enter on any device. The result is written to the cache. This can happen in the middle of a long command, when the session ends while it runs.
Any other failure, such as the Keycloak being unreachable, fails the request without a login. There is no way to pass a ready-made token: it could be sent only once. MANTA_CSM_TOKEN is no longer read; if it is set, the CLI logs a warning (shown with log = "warn").
manta config unset auth deletes the cached token and forces a new login. The cache records the issuer and client it came from: after changing oidc_issuer_url or oidc_client_id (e.g. prod ↔ TDS), the CLI logs in again rather than send the old refresh token to the new issuer. The login prompts go to stderr, so when stderr is not a terminal (cron, CI, 2>file) the CLI never starts a login; it fails with a pointer to the service-account variables instead. Piping into manta does not prevent a login.
Auditing is server-side only — every CLI command goes through HTTP to manta-server, which records one event per mutating request (see ARCHITECTURE.md § Audit trail) to its log and, when [auditor.kafka] is set, to Kafka. The CLI has no audit configuration.
The CLI has no [sites] section: it only knows about the one
manta-server it talks to. Per-site backend connection details
(URLs, TLS certs, k8s, vault) live entirely in server.toml.
server.toml
log = "info"
[server]
listen_address = "0.0.0.0" # optional; default 0.0.0.0
port = 8443 # optional; default 8443 if cert+key set, else 8080
cert = "/etc/manta/tls/server.crt"
key = "/etc/manta/tls/server.key"
console_inactivity_timeout_secs = 1800
request_timeout_secs = 300 # global per-route timeout (returns 408); default 300 (5 min)
[auditor.kafka] # optional; without it the audit trail goes to the log only
brokers = ["kafka.cscs.ch:9095"]
topic = "manta-server-audit"
# message_timeout_ms = 5000 # how long a queued event retries delivery; default 5000
# [auditor.kafka.properties] # optional librdkafka passthrough, e.g. for TLS/SASL
# "security.protocol" = "SASL_SSL"
# "sasl.mechanism" = "SCRAM-SHA-512"
# "sasl.username" = "manta"
# "sasl.password" = "..."
[sites.alps]
backend = "csm"
shasta_base_url = "https://api.alps.cscs.ch"
root_ca_cert_file = "/etc/manta/certs/alps_root_cert.pem"
[sites.alps.token_exchange] # required for every site
client_id = "cscs-token-exchanger" # Keycloak client allowed to exchange tokens
client_secret = "…" # its secret; keep server.toml readable only by manta-server
subject_issuer = "cscs" # alias of the CSCS identity provider in the shasta realm
[sites.alps.k8s]
api_url = "https://10.0.0.10:6443"
[sites.alps.k8s.authentication.vault]
base_url = "https://vault.cscs.ch:8200" # also used by sat-file/session handlers
[sites.basodino]
backend = "ochami"
shasta_base_url = "https://basodino-mgmt.cscs.ch:8443"
root_ca_cert_file = "/etc/manta/certs/basodino_root_cert.pem"
[sites.basodino.token_exchange] # required for every site
client_id = "…" # Hydra client allowed to use the JWT bearer grant
client_secret = "…" # its secret; keep server.toml readable only by manta-server
scope = "smd.read bss.read smd.write bss.write"[sites.X.token_exchange] configures the token exchange, and is required: the server refuses to start without it. On every request manta-server swaps the caller's CSCS token for a token the site accepts and uses that for the backend API and the role checks; nothing is cached.
csmsites use an RFC 8693 token exchange at the site's Keycloak,<shasta_base_url without /apis>/keycloak/realms/shasta, and needsubject_issuer. The exchanged token also does the Vault login.ochamisites use an RFC 7523 JWT bearer grant at the site's Hydra,<shasta_base_url>/hydra/oauth2/token, and needscope. The Hydra client needs that grant type, and Hydra needs a trust relationship for the CSCS Keycloak's issuer. Hydra accepts each CSCS token only once (it rejects a reusedjtiuntil the token expires), which is why the CLI sends a new token on every request.
Errors: a CSCS token the identity provider rejects (e.g. the site does not trust the CSCS Keycloak) → 401; an exchange refused for the user → 403; a wrong client_secret or other misconfiguration → 500; an error status of the identity provider itself (e.g. 503) is passed through.
The runtime Vault URL is derived from [sites.X.k8s.authentication.vault].base_url at startup; the vault secret path is computed from a hard-coded prefix and the site name. No standalone vault_base_url / vault_secret_path keys.
The cat > "$CONFIG_DIR/cli.toml" <<EOF block in Copy configuration file is the minimum a workstation needs; for server.toml, the [sites.<name>] sub-blocks above are the canonical reference (TLS, k8s, Vault, backend URLs all have their own subsection above).
Migrating from the pre-split config.toml
There is no auto-migration command. When either binary starts and finds its config file missing, it prints a minimal example and — if a legacy config.toml exists in manta's config directory — a field-by-field mapping of what to copy where. Copy by hand following that mapping. The per-site sites.X.manta_server_url field was removed; use the top-level manta_server_url in cli.toml if you need it.
Example — list CFS sessions
curl -sk -H "Authorization: Bearer $TOKEN" \
https://localhost:8443/v2/sessions | jq .Example — open a node console (WebSocket)
wscat -H "Authorization: Bearer $TOKEN" \
--connect wss://localhost:8443/v2/nodes/x3000c0s1b0n0/consoleSee API.md for the full endpoint reference, or browse the interactive Swagger UI at https://localhost:8443/docs once the server is running.
Install Rust toolchain https://www.rust-lang.org/tools/install
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shInstall cross to be able to complile on different platforms
cargo install crossGenerate binary (cross compilation)
scripts/buildor
rustup target add x86_64-unknown-linux-gnu
cargo build --target=x86_64-unknown-linux-gnuInstall dist and cargo-release:
cargo install dist
cargo install cargo-release
Configure dist. Accept default options and only target linux assets:
dist init -t $(uname -m)-unknown-$(uname -s | tr '[:upper:]' '[:lower:]')-gnu
Then remove the assets for macos and windows
Make sure a github workflow is created in .github/workflows/release.yml
This project is already integrated with github actions through 'cargo release' and 'git cliff'
git cliff will parse your commits and update the CHANGELOG.md file automatically as long as your commits follow conventional commits. The commit-type → section mapping lives in the
[git.commit_parsers]table insidecliff.toml.
cargo release <bump level> --execute
choose your bump level accordingly
If everything went well, the binaries will be at target/x86_64-unknown-linux-gnu/release/manta-cli and target/x86_64-unknown-linux-gnu/release/manta-server.
sudo sysctl -w kernel.perf_event_paranoid=-1sudo apt-get install linux-tools-common linux-tools-generic linux-tools-`uname -r`sudo sh -c " echo 0 > /proc/sys/kernel/kptr_restrict"perf stat -ad -r 100 target/release/manta-cli get sessionsperf record -g --call-graph=dwarf -F max target/release/manta-cli get sessionsperf script -F +pid > manta.perfGo to https://profiler.firefox.com/ and open manta.perf file