CLI reference · all pages

Start

Guides

Reference

Project

  1. Docs
  2. Reference
  3. CLI reference

CLI reference

Every diaporos command and option.

  • 3 min read
diaporos inspect <binary>
    Print the contract embedded in a binary. Never executes it.

diaporos push <binary|dir> [--store DIR] [--out FILE] [--base OLD.manifest] [--remote URL]
              [--sign KEY]
    Binary: chunk it into the store. Directory: build the tree (stat cache in
    .diaporos/index). --remote uploads only the objects the server lacks, then the
    manifest. --base also precomputes patches for nodes on that release.
    --sign KEY signs the release: <manifest>.sig beside it, and the store's copy
    with --remote. `warning` lines flag a contract that pushes but won't deploy: a
    listen port pinned to a number (`env PORT 9000`, `cap env.read PORT`) instead of
    `${DIAPOROS_PORT_<NAME>}`. `init`, `import` and `run` print them too, and a
    deploy that fails its health check names them as the likely cause.
    Defaults: --store .diaporos/store, --out .diaporos/releases/<name>-<release>.manifest

diaporos bundle <dir> [--into lib] [--lib-path DIR]... [--check]
    Copy the shared libraries the tree's executables and libraries load (from their
    ELF or Mach-O headers, transitively; nothing is run) into <dir>/<into>, and add
    `env LD_LIBRARY_PATH ${DIAPOROS_RELEASE}/<into>` (DYLD_LIBRARY_PATH on macOS) to
    the contract. The C library and loader stay the host's: the report lists them and
    the newest glibc version used. Fails if a library can't be found (--lib-path adds
    search directories). --check reports without copying. Bundle on the OS you ship to.

diaporos import <image|archive.tar|oci-dir> <out-dir> [--name NAME]
                [--exec "PROGRAM ARGS"] [--platform linux/amd64]
    Turn a container image into a tree in <out-dir> (new or empty), with a contract
    from the image config. Takes an image reference (run through `docker save`),
    `docker save` output (legacy or OCI) or an OCI image layout; layers may be gzip,
    zstd or plain. Multi-platform images pick --platform (default: this machine's).
    `note` lines report what didn't carry over (user, volumes, health check, UDP).

diaporos init <checkout> <out-dir> [--name NAME] [--entry "FILE ARGS"] [--port N]
              [--health /PATH|tcp] [--memory 1024Mi] [--node-binary FILE]
              [--include PATH]... [--no-bundle]
    Turn a built Node.js checkout into a tree in <out-dir> and infer its contract
    (exec, port, health, memory, env, env.read grants) from Dockerfiles, package.json
    scripts, .env* names, Kubernetes/Helm manifests and source routes; each line is
    commented with its source. Ships what runs, plus the node binary as bin/node, then
    runs `bundle`. <out-dir> must be new, empty or a previous init: then the files are
    refreshed and the contract (with your edits) is kept. Flags override inference.

diaporos diff <old.manifest> <new.manifest> [--store DIR]
    What a node running <old> must download to run <new>, plus contract changes.

diaporos run <manifest|URL> [--store DIR|URL] [--node DIR] [--env-file FILE]
         [--runner process|sandbox] [--strict] [--until-healthy] [--timeout SECS]
         [--trust FILE]
    Act as the node: pull, materialize (or assemble), launch, supervise.
    --trust FILE refuses a release no key in FILE signed.
    --env-file supplies values for granted env.read variables.
    --runner sandbox (Linux) enforces the contract with Landlock + cgroup v2 and
    runs as uid 65534 when the node is root; --strict refuses to start if this
    host can't enforce something the contract declares. Limits need a delegated,
    writable cgroup (systemd Delegate=yes, or a privileged container).
    Defaults: --store .diaporos/store, --node .diaporos/node, --timeout 30

diaporos node [--store DIR|URL] [--node DIR] [--api ADDR] [--bind ADDR] [--env-file FILE]
          [--secrets-cmd CMD] [--runner process|sandbox] [--strict]
          [--timeout SECS] [--drain SECS] [--grace SECS] [--trust FILE]
    Run the node daemon. It owns each service's public ports through a TCP proxy;
    every release listens on a private loopback port. A deploy starts the new
    release beside the old one, waits for it to be healthy, switches the proxy,
    then drains the old release (up to --drain) and stops it: SIGTERM, then SIGKILL
    after --grace. A release that exits or isn't healthy within --timeout is
    rejected and the old one keeps serving.
    Deployed services are saved in <node>/state/ and restored when the daemon starts
    (no fetch if the release is still on disk, so a restart survives the store being
    down). A failed restore is logged and retried on the next start.
    The API needs `Authorization: Bearer <token>`; the daemon creates the token in
    <node>/api.token (0600). It is plain HTTP: keep --api on loopback.
    With a trust file (--trust FILE, else <node>/trusted.keys if present) it runs
    only releases signed by one of its keys; see Signed releases below.
    Under systemd: examples/systemd/diaporos-node.service.
    Defaults: --api 127.0.0.1:7171, --bind 0.0.0.0, --timeout 30, --drain 30, --grace 10

API commands take [--api ADDR] and a token: --token T, else $DIAPOROS_API_TOKEN, else
<node>/api.token (pass --node DIR on the node itself).

diaporos deploy <manifest|URL|id> [API]
    Ask the daemon to deploy a release. A 64-hex id is fetched from the daemon's
    remote store. Prints the timings, or the reason it was rejected.

diaporos status [API]
    Services on the daemon: release, health, uptime, public -> private ports, and
    granted keys no secret source had.

diaporos restart <service> [API]
    Redeploy the running release with freshly resolved secrets (same health-gated,
    zero-downtime swap as a deploy). How a rotated secret goes live.

diaporos stop <service> [API]
    Stop a service (SIGTERM, then SIGKILL after --grace), close its public ports, and
    forget it so it isn't restored.

diaporos logs <service> [-n LINES] [-f] [API]
    The service's stdout/stderr from <node>/logs/<service>.log (default last 100
    lines; -f follows). Each start writes a `--- <time> start <service> <release> ---`
    marker; the file is rotated to .log.1 past 10 MiB.

diaporos events [-f] [API]
    What the node did: deploy, rejected, failed, swap, drained, stop, and the
    supervisor's start, healthy, exit, liveness_kill, start_failed, oom, gave_up.
    The last 1024 are kept in memory. -f follows.

diaporos metrics [API]
    The daemon's Prometheus metrics (GET /metrics). Scrape them with the API token:
    `authorization: { credentials_file: <node>/api.token }`.

diaporos dashboard [--open] [API]
    Prints the URL of the daemon's read-only dashboard: headline tiles with live
    charts (health, CPU, memory, traffic, deploy outcomes and times), services with
    sparklines, the deploy pipeline (fetch / materialize / healthy per deploy),
    delivery and supervision counters, and a panel per service (gauges, ports,
    grants vs. enforcement, deploys, events, logs with a filter). Charts cover what
    the open page has polled (about 3 minutes). The token is in the
    URL fragment so it never reaches the server. --open launches the browser. For a
    remote node: `ssh -L 7171:127.0.0.1:7171 host`, then `diaporos dashboard --open`.
    The theme follows the OS; the header's picker overrides it (light or dark), saved
    in the browser for that address. The fleet page has the same picker.

diaporos secret set <service> <KEY> [--node DIR]     value from stdin (one trailing newline dropped)
diaporos secret import <service> <.env> [--contract TREE|FILE] [--check] [--node DIR]
diaporos secret ls  <service> [--node DIR]           key names only
diaporos secret rm  <service> <KEY> [--node DIR]
    The node's secret store: <node>/secrets/<service>/<KEY>, one 0600 file per key
    (the systemd-credentials / k8s Secret volume layout). Edited on the node, so
    values never cross the control API.
    `import` stores every value in a .env file, read as dotenv (`export`, comments,
    quotes removed, `\n` in double quotes). With --contract (a tree or contract file of
    that service) it stores only the names the contract grants and lists, by name,
    what was added, changed, unchanged, skipped (not granted or not a valid key) and
    the grants nothing provides yet. Unchanged values aren't rewritten. --check
    reports without writing.

Secrets (`run` and `node` take --env-file FILE and --secrets-cmd CMD)
    Values for `cap env.read` grants, resolved at every start; first match wins:
    node store, then --secrets-cmd (run as `CMD KEY...` with DIAPOROS_SERVICE set, prints
    KEY=value lines; a short script fronts Vault, Key Vault or AWS), then --env-file,
    then the node's own environment. A failing backend fails the deploy and the
    previous release keeps serving. Reports list names and sources, never values.

diaporos serve [--store DIR] [--listen ADDR]
    The store over HTTP (default 0.0.0.0:7070). Routes are documented in
    crates/store/src/http.rs.

diaporos keygen <name> [--out DIR]
    A new Ed25519 key pair: <DIR>/<name>.key (secret, 0600, never replaced) and
    <name>.pub (one line for trust files). Default --out .diaporos/keys.

diaporos sign <manifest|URL|id> --key KEY [--remote URL]
    Add KEY's signature to a release: merged into <manifest>.sig for a file, and
    uploaded to the store for a URL, an id, or with --remote. For a second key or
    an approval step after `push --sign`.

diaporos verify <manifest|URL|id> --trust FILE [--remote URL]
    Check a release the way a node would; prints the signer.

Signed releases (Ed25519)
    A signature covers the release id (the manifest's sha256), so manifests and ids
    don't change; signatures live beside a manifest file (<manifest>.sig) or in the
    store (PUT/GET /signature/<id>, which checks each one and keeps one per key; it
    doesn't decide trust). A node with a trust file verifies before every deploy,
    restart, rollback and restore, re-reading the file each time, so deleting a line
    revokes that key, even for what is already deployed, on its next start. Accepted
    signatures are kept in <node>/signatures/, so a restart doesn't need the store.
    A refused release is a failed deploy: the old one keeps serving, and a fleet
    rollout rolls back. Nodes without a trust file run anything (the default).
    Metrics: diaporos_signatures_required, diaporos_trusted_keys. Dashboards show
    each node's policy, the signer of each deploy (✓ NAME) and refusals; the fleet
    page warns when some nodes require signatures and others don't.

diaporos fleet status [--fleet FILE]
diaporos fleet deploy <manifest|id> [--fleet FILE] [--batch N]
diaporos fleet dashboard [--fleet FILE] [--listen ADDR] [--open]
diaporos fleet prometheus [--fleet FILE]
    Many nodes from one file (default ./diaporos.fleet), no controller:
        store http://10.0.0.9:7070               # every node: diaporos node --store <this>
        node a 10.0.0.1:7171 token-file tokens/a # relative to the fleet file
        node b 10.0.0.2:7171 token-env TOKEN_B   # default: $DIAPOROS_API_TOKEN
        service web on a b batch 1               # rollout order; nodes at a time
    `deploy` needs the manifest in the store (`diaporos push DIR --remote STORE`). It
    asks every placed node what it runs first (one unreachable: stop, nothing
    changed), skips nodes already on it, then deploys a batch at a time; each node
    health-gates its own swap. Each node first asks up to 3 nodes that already run
    the release (newest first; the fleet file's addresses, so they must be
    reachable node to node), then the store: with batch 1 the store sends the
    release once and the one-line patch once, whatever the fleet size. On any
    failure later batches don't start and every
    node it changed goes back to its previous release (from disk, no fetch). Exits
    non-zero with what failed, what was rolled back and anything stuck. `status`
    shows each service's release and health per node, drift, and strays.
    `dashboard` serves one read-only page for the whole fleet on loopback (default
    127.0.0.1:7272): rollout progress per service with a pip per node, node cards,
    which node runs what, deploy history from every node with phase bars, peer
    traffic. It asks every node on each refresh
    (every 2 s) with the tokens from the fleet file; the page never sees a token,
    and clicking a node opens that node's own page (`diaporos dashboard`). It refuses
    to listen on anything but loopback and answers only Host 127.0.0.1/localhost
    (no DNS rebinding); for a remote operator use `ssh -L`. `prometheus` prints
    scrape jobs, one per node with its token file and a `node` label, for
    `docs/grafana/diaporos-fleet.json`.

↑↓ to move ↵ to open