Skip to content

Deployment

root edited this page Dec 4, 2026 · 5 revisions

Deployment & Operations

🌐 English · 简体中文

This page covers deploying, configuring, connecting Nodes to, backing up, administering, and upgrading the Trizano Hub (trizano-carbon) and Node daemon (trizano-h3). It is intended for users self-hosting and operating Trizano day to day.

Startup Flags

By default, trizano-carbon binds only to loopback (127.0.0.1:47900), leaving external access to an HTTPS reverse proxy or tunnel in front of it. All startup flags are defined in server/cmd/trizano-carbon/main.go:

Flag Default Purpose
--listen 127.0.0.1:47900 Listen address for the web UI and API (supports both HTTP/1.1 and h2c)
--origin (none, repeatable) External HTTPS origin browsers use to reach the Hub (e.g. https://code.example.com). Local http://localhost:<port> is always allowed automatically.
--data ~/.trizano/hub Hub state directory (also accepted by management subcommands)
--node-bin <dir of trizano-carbon>/trizano-h3 Node binary path for the local Node
--node-root (empty; defaults to ~/.trizano/node) State directory for the local Node
--no-local-node false Do not register or start a local Node—use for entry-only deployments
--node-dist <dir of trizano-carbon>/dist Cross-platform Node binary directory containing trizano-h3_<os>_<arch> (.exe on Windows) for SSH, WSL, Windows native, and Reverse Node updates
--remote-dir .trizano Directory on SSH and WSL Nodes for binaries and state (relative to the remote home directory, or an absolute path)
--ssh-config (empty; defaults to ~/.ssh/config) SSH config file used for host discovery and SSH connections

When multiple --origin flags are provided, browsers can sign in with passkeys and open WebSockets on every listed origin. The first --origin is published in the Roster as this Entry's external URL for Node and client discovery; see Multi-Entry & Failover.

Data Directory Layout

Hub and Node state live independently under ~/.trizano/hub and ~/.trizano/node by default, both created with mode 0700.

Hub Directory (~/.trizano/hub)

Only identity.pem and hub.db require persistent backups; all other files are runtime state (see server/hub/hub.go):

Path Mode Purpose
identity.pem 0600 Hub P-256 identity private key (PKCS#8 PEM); also the Roster root key for a single-Entry deployment or the first Entry
hub.db SQLite Stores Roster statements, the Roster root, device last-seen timestamps, Node transport configs, logged-out tickets, and custom model pricing
admin.sock Unix socket Local management channel used by trizano-carbon approve|deny|pairings|devices|revoke
hub.lock / hub.pid 0600 Exclusive single-instance lock and current PID, preventing two Hubs from sharing one data directory
ssh/ 0700 OpenSSH ControlMaster multiplexing socket directory (ControlPath=<data>/ssh/%C, not enabled on Windows)

Node Directory (~/.trizano/node)

All Node daemon state, agent Sessions, and local sockets live under --root (see server/node/daemon.go):

Path Mode Purpose
state.db SQLite Workspaces, Sessions, timelines, tasks, usage records, watches, terminal metadata, and local Roster copy
node_key.pem 0600 Node's own P-256 identity private key (generated for local, SSH, and Reverse Nodes alike)
entries.json 0600 Roster root public key and bootstrap Entry saved by Reverse Nodes; legacy hub.json is migrated and deleted on startup
node.log 0600 Background daemon stdout and stderr log
run/node.sock 0600 Owner-channel Unix socket used by attach, stop, and trizano-h3 admin
run/node.lock 0600 Exclusive daemon lock that also records the current PID
run/tmux.sock Unix socket Dedicated tmux socket for persistent terminals when tmux is installed on the host
orch/s.sock 0600 Dedicated agent orchestration socket exposing only /internal/orch/*
orch/trizano-h3 0700 Copy of the daemon binary written at startup for sandboxed agents to invoke (.exe on Windows)
bin/<build>/ 0755 Immutable build directory used when Entries push updates to a Reverse Node
attachments/ — Session message attachment storage
review/blobs/ — Content-addressed file objects for review baselines
browser/profile/ — Persistent profile directory for the managed headless browser
probe/ — Working directory for probing agent CLI capabilities
scripts.json — Node-level shared project scripts manifest
discussion-modes.json — Optional user-level custom discussion mode manifest

On SSH and WSL Nodes, <remote-dir> (default ~/.trizano) is split into two subtrees: bin/<build>/trizano-h3 holds immutable versioned binaries, and node/ is the Node state directory described above.

Getting the Binaries

Starting with v0.10.0, every GitHub Release includes prebuilt Hub archives: trizano_<version>_linux_amd64.tar.gz, linux_arm64, darwin_arm64, and darwin_amd64. Each archive contains trizano-carbon, the local Node trizano-h3, and dist/ (trizano-h3_<os>_<arch>, which the Hub uses to install and upgrade SSH, WSL, Windows, and Reverse Nodes). Keep all three in the same directory, because trizano-carbon looks beside itself for trizano-h3 and dist/ by default (--node-bin and --node-dist). You can also build the same bin/ layout from source with make build.

Persistent Service Templates

Ready-to-use service templates for macOS (launchd) and Linux (systemd user units) live under deploy/ in the repository. Copy the relevant template and replace the placeholder domain and username.

macOS (launchd)

The template is deploy/launchd/top.onemolchuan.trizano-carbon.plist. Place trizano-carbon (along with trizano-h3 and dist/ as needed) in /usr/local/bin/, then copy the plist into your user LaunchAgents directory:

mkdir -p ~/Library/LaunchAgents ~/Library/Logs
cp deploy/launchd/top.onemolchuan.trizano-carbon.plist ~/Library/LaunchAgents/

Edit ~/Library/LaunchAgents/top.onemolchuan.trizano-carbon.plist:

  • Replace https://YOUR_DOMAIN_HERE after --origin with your external HTTPS origin (add more --origin pairs if needed).
  • Replace /Users/YOUR_USER/Library/Logs/trizano-carbon.log in both StandardOutPath and StandardErrorPath with your actual home directory path (launchd does not expand ~).
  • For an entry-only host that does not run a local Node, append <string>--no-local-node</string> inside ProgramArguments.

The template sets RunAtLoad and KeepAlive by default. Load, inspect logs, and reload after edits:

launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/top.onemolchuan.trizano-carbon.plist
tail -f ~/Library/Logs/trizano-carbon.log

# Reload after editing the plist
launchctl bootout gui/$(id -u)/top.onemolchuan.trizano-carbon
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/top.onemolchuan.trizano-carbon.plist

Linux (systemd User Unit)

The template is deploy/systemd/trizano-carbon.service, which launches %h/.local/bin/trizano-carbon with Restart=on-failure and RestartSec=5. Install trizano-carbon (plus trizano-h3 and dist/ as needed) into ~/.local/bin/, then copy the unit file:

mkdir -p ~/.config/systemd/user
cp deploy/systemd/trizano-carbon.service ~/.config/systemd/user/

Edit ~/.config/systemd/user/trizano-carbon.service to replace https://YOUR_DOMAIN_HERE; on an entry-only host, append --no-local-node to ExecStart. Enable the unit and user lingering so it stays running across logouts and reboots:

systemctl --user daemon-reload
systemctl --user enable --now trizano-carbon.service
sudo loginctl enable-linger "$USER"
journalctl --user -u trizano-carbon.service -f

HTTPS and Entry-Only Deployment

Browser passkeys require a secure context (HTTPS or localhost), so remote access to the Hub must sit behind an HTTPS reverse proxy or tunnel whose external URL matches --origin:

  • Tailscale Serve (recommended, restricted to your tailnet): Run tailscale serve --bg http://127.0.0.1:47900 and pass the assigned https://<host>.<tailnet>.ts.net URL to --origin.
  • Cloudflare Tunnel (public HTTPS without a public IP or open ports): Map your hostname to http://127.0.0.1:47900 in ~/.cloudflared/config.yml or the Zero Trust dashboard, run cloudflared tunnel run, and pass https://<your-domain> to --origin.
  • Caddy (public IP with your own domain): Configure /etc/caddy/Caddyfile with response buffering disabled so streaming events arrive immediately (Caddy handles WebSockets automatically):
code.example.com {
	reverse_proxy 127.0.0.1:47900 {
		flush_interval -1
	}
}

Entry-only deployment (--no-local-node): If a lightweight VPS serves strictly as a Hub Entry without running coding agents locally, start trizano-carbon with --no-local-node. You do not need a local trizano-h3 binary and no local Node is registered. Keep dist/ beside trizano-carbon if you still want this Entry to push automatic updates to Reverse Nodes.

Adding Nodes

Outbound Hub-connected nodes vs. Reverse Nodes behind NAT

Trizano supports five Node connection modes. The first four are dialed outbound by the Hub (configured in Settings → Machines (「设置 → 机器」) or via NodeService.AddNode), while the fifth dials outbound from the Node back to the Hub.

Local Node

Unless --no-local-node is set, the Hub automatically registers its own host as the local Node on startup (the ID is the lowercase slug of the first hostname label, e.g. Mac-mini.local → mac-mini, persisted in hub.db as local_node_id). LocalDialer (server/hub/nodes/dial.go) runs <node-bin> attach to start and connect to the local daemon. The local Node cannot be removed while enabled.

SSH Node (Linux / macOS)

The Hub connects to remote hosts using the system OpenSSH client—reusing ~/.ssh/config, ProxyJump, ssh-agent, and keys—with ControlMaster=auto (ControlPersist=10m, except when the Hub runs on Windows; see server/hub/sshx/sshx.go). In the UI, pick a host discovered by ListSshHosts or enter [user@]host directly.

RemoteDialer (server/hub/nodes/remote.go) handles first-time setup automatically with no remote runtime prerequisites and no SFTP dependency:

  1. Runs uname -sm to detect OS and architecture (30 s timeout), selects trizano-h3_<os>_<arch> from --node-dist, and computes the first 12 hex characters of its SHA-256 as the build ID.
  2. Checks whether <remote-dir>/bin/<build>/trizano-h3 already exists via test -x. If missing, streams it with dd of=….partial bs=65536 (5 min timeout), runs chmod 700, verifies sha256sum (shasum -a 256 on macOS), and atomically moves it into place with mv.
  3. Executes <remote-dir>/bin/<build>/trizano-h3 attach --root <remote-dir>/node and establishes an h2c connection over its stdio.

WSL Distro Node

A WSL distribution connects as an independent Node using the same RemoteDialer install-and-attach pipeline prefixed with wsl.exe -d <distro> --exec:

  • Hub running on Windows: Leave the SSH target blank and enter only the WSL distro name; the Hub runs wsl.exe -d <distro> --exec … locally (with WSL_UTF8=1).
  • WSL on a remote Windows host: Fill in both the SSH target and the WSL distro name; the Hub runs ssh <host> wsl.exe -d <distro> --exec ….

Because Windows OpenSSH passes command lines through its default shell first, each step executes a single binary with plain-character arguments (A-Za-z0-9._/=-)—never shell scripts—and queries printenv HOME to obtain the absolute home path inside the distro. Distro names must match ^[A-Za-z0-9._-]{1,64}$.

Windows Native Node

When you add an SSH Node with no WSL distro and remote uname -sm fails (for a reason other than an SSH exit code 255 disconnect), the Hub automatically runs a PowerShell probe (server/hub/nodes/winprobe.go) to check whether the target is Windows and collect its CPU architecture, OpenSSH DefaultShell, and installed WSL distros. Confirmed Windows hosts are handled by server/hub/nodes/windows.go:

  • Prerequisites: Remote OpenSSH DefaultShell must be cmd.exe, Windows PowerShell, or PowerShell 7 (shells like Git Bash rewrite command lines; the Hub returns an explicit error pointing to HKLM\SOFTWARE\OpenSSH\DefaultShell), and sshd must have the SFTP subsystem enabled.
  • Install and launch: Checks whether the build exists via PowerShell Test-Path; if missing, uploads .partial using sftp -b - with incremental -mkdir and rename to trizano-h3.exe. It then launches .\.trizano\bin\<build>\trizano-h3.exe attach --root .\.trizano\node (or an absolute C:\… path). When spawning the daemon, the Node detaches from the OpenSSH job object so it stays alive in the background.
  • Caveats: Under Win32-OpenSSH public-key logins, Windows Credential Manager and DPAPI are unavailable (affecting git push or gh when backed by Git Credential Manager, but not file-based agent credentials). Windows lacks tmux, so terminals do not persist across daemon restarts. The Unix socket path under --root must stay shorter than 108 bytes.

Reverse Node (trizano-h3 join + serve)

Use Reverse Nodes for machines behind NAT, without a public IP, or where you do not want to expose sshd. The Node initiates an outbound connection to the Hub (see server/node/join.go, server/cmd/trizano-h3/main.go).

  1. Initial enrollment: Run on the target machine:
trizano-h3 join https://code.example.com [--title gpu-box] [--root ~/.trizano/node]

Only https:// URLs are accepted by default (except loopback localhost / 127.0.0.1 / ::1); pass --allow-insecure-http explicitly for plain-HTTP LAN setups. The command generates <root>/node_key.pem, verifies and pins the Hub's identity public key, and prints a 6-digit verification code. 2. Approve: Enter the 6-digit code manually in the approval card on any signed-in web or Android client, or run trizano-carbon approve <6-digit-code> on the Hub host. Once approved, the Node writes the Roster root and bootstrap Entry to <root>/entries.json (0600). If the machine is already pinned to a different Hub, delete entries.json manually before joining a new Hub. 3. Run persistently: Start trizano-h3 serve (passing --root if you used a custom directory). On Linux, use the deploy/systemd/trizano-h3.service template:

cp deploy/systemd/trizano-h3.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now trizano-h3.service
sudo loginctl enable-linger "$USER"

The legacy --connect flag from older service units is deprecated (kept as a no-op for backward compatibility); serve automatically connects to every Entry with a configured origin in entries.json and the Roster.

Backup and Restore

All persistent Hub state resides in <data>/identity.pem and <data>/hub.db. trizano-carbon backup and trizano-carbon restore package them using age scrypt passphrase encryption and support live online backups while the Hub is running (server/hub/backup.go, server/cmd/trizano-carbon/backup.go).

# Online backup (SQLite VACUUM INTO consistent snapshot + age passphrase encryption)
trizano-carbon backup [--data ~/.trizano/hub] --out ~/trizano-hub.age

# Non-interactive usage (e.g. cron jobs) via environment variable
TRIZANO_BACKUP_PASSPHRASE='your-strong-passphrase' trizano-carbon backup --out ~/trizano-hub.age

Stop the Hub before restoring (the command checks admin.sock and refuses to run if the Hub is still active):

# Restores directly into an empty target directory; pass --force for a non-empty directory
# (the previous directory is moved to <DIR>.bak-YYYYMMDD-HHMMSS)
trizano-carbon restore [--data ~/.trizano/hub] --in ~/trizano-hub.age [--force]

Restore validates the trizano-backup-v1 header and decrypts the archive completely before touching the target directory, so a wrong passphrase or corrupted file leaves existing data untouched. Backups do not include ~/.ssh private keys, per-Node session databases (~/.trizano/node/state.db), or local client configs. In multi-Entry deployments, always keep an off-site backup of the root Entry—see Multi-Entry & Failover.

Management Commands

While the Hub is running, the local owner can manage device pairings, Node/Entry enrollments, and authorized devices via trizano-carbon subcommands over <data>/admin.sock (server/cmd/trizano-carbon/admin.go). Every subcommand accepts --data DIR for non-default data directories:

Command Purpose
trizano-carbon pairings List all pending device pairings and Node/Entry enrollments (with 6-digit code, source IP, proof status, and remaining TTL)
trizano-carbon approve <CODE> Approve a device pairing, Reverse Node enrollment, or new Entry join by 6-digit code (or request ID)
trizano-carbon deny <CODE> Reject the corresponding pairing or enrollment request
trizano-carbon devices List all authorized devices in the Roster with type, pairing time, and last-seen time on this Entry
trizano-carbon revoke <DEVICE> Revoke a device (<ID> or devices/<ID>), removing it from the Roster and immediately disconnecting all active sessions

Two additional offline/initialization subcommands—trizano-carbon entry join and trizano-carbon roster reset—are documented in Multi-Entry & Failover. If all Entries are unreachable, you can inspect Sessions and approve tool calls directly on a Node with trizano-h3 admin; see Node Internals.

Upgrading

For routine upgrades, replace trizano-carbon, the local trizano-h3, and the cross-platform binaries in dist/ on the Hub host, then restart the Hub—you do not need to log into remote machines manually. On reconnect, the Hub compares each Node's reported version and build hash: between release versions (MAJOR.MINOR.PATCH), Nodes only upgrade forward; if either side is a dev build, replacement follows the build hash (dev builds for Reverse Nodes are pushed only by the Roster root Entry). Idle Nodes upgrade immediately (local/SSH Nodes hand off to the new build; Reverse Nodes receive the push and switch in place). If any Turn is active, the Node is marked pending update and upgrades automatically as soon as the last active Turn finishes. Old build directories are cleaned up automatically on Node startup. See Node Internals for build hash and process handoff details.

Upgrading to v0.10.0 (Breaking)

v0.10.0 renames the remaining legacy molchuan identifiers in the protocol layer (RPC paths, HTTP headers, signing domains). Older clients and Nodes cannot talk to a v0.10.0 Hub, so upgrade everything in one go:

  1. Stop the old Hub.
  2. Stop the Node daemon on every machine with the old binary: trizano-h3 stop, or kill the process whose PID is in ~/.trizano/node/run/node.lock. The new Hub cannot replace old Nodes automatically because they speak the old protocol.
  3. Deploy and start the new Hub. The Roster is re-signed under the new signing domain automatically, so paired devices do not need to pair again (in multi-entry setups, upgrade the Roster root Entry first). The Hub installs the new Node binary on each machine; on first start each Node drops its old Roster statements and receives the new ones from the Hub.
  4. Clients: browsers sign in again with their passkey; the desktop app signs in again by itself after upgrading to v0.10.0; Android must pair once more (its device key moved to a new keystore alias).
  5. Backups made with trizano-carbon backup before v0.10.0 cannot be restored by v0.10.0; take a new backup after upgrading.

Deployments on v0.8.0 or earlier (binaries still named molchuan) must upgrade to v0.9.x first to migrate their data directories, then to v0.10.0.

Related Pages

  • Network Topology & Data Paths — connection paths, WebSocket bridges, and default ports across clients and Nodes
  • Multi-Entry & Failover — multi-Entry setup, Roster sync, automatic client failover, and root Entry recovery
  • Security Model — authentication, pairing rules, ticket renewal, proxy isolation, and threat model
  • Node Internals — build hashes, in-place upgrades, and trizano-h3 admin emergency access

Clone this wiki locally