Debugging
Ask a fleet what is running, what the proxies route to, and whether the two agree — as JSON from the CLI, or from an AI agent through dash mcp.
Inspection commands#
Each of these prints exactly one diagnostic as JSON on stdout — nothing else, so | jq works. Without --json the human output is unchanged. A host that cannot be reached is an entry with an error, not a failed command: the debugging tool keeps answering for the rest of the fleet exactly when one host is broken. None of them takes the deploy lock or changes a host.
| Command | What it prints |
|---|---|
dash config --json | The effective config (redacted) plus its topology: roles to hosts, proxied roles, proxy hosts, load balancer |
dash app containers --json | Every container per host: role, replica slot, version, state, health, image |
dash proxy services [--json] | What dash-proxy routes for this deploy on each proxy host, and on the load balancer |
dash proxy drift [--json] | The containers compared with the proxy and load balancer targets |
dash doctor --json | The readiness checks as {check, target, status, detail}; exits 1 when one fails |
dash audit --json | The audit log per host, parsed into recorded_at, performer, tags, message |
dash lock status --json | Whether the deploy lock is held, by whom, since when, why |
dash report show --json [--last N] | The saved deploy reports, most recent first (at most 20) |
dash scale status --json | Per role: replica bounds and each host's slots |
dash autoscale explain ROLE --json | What the autoscale controller's next tick would decide for ROLE, with every input |
dash autoscale history [ROLE] --json | The controller's decision log: actions, reason codes, errors and inputs |
dash autoscale status --json | The controller's heartbeat (running, stale or stopped) and the paused roles |
dash autoscale signal ROLE --json | One live sample of ROLE's signal and each guard, with latencies, read from this machine |
dash autoscale simulate --samples FILE --json | A --record file replayed with deploy.yml's thresholds now: simulated actions and a summary per role |
dash app stats [--json] | Each container's CPU, memory against its limit, network and block I/O, PIDs |
dash accessory stats NAME|all [--json] | The same for an accessory's container on its hosts |
dash server stats [--json] | Each host's load against its CPUs, memory, swap, disk for / and Docker's data root, uptime |
Resource usage#
dash app stats samples every running container of this service on each app host — docker stats --no-stream, about a second per host, hosts in parallel — and joins it to the container's role, replica slot and version. dash server stats reads each host's load average next to its CPU count (load.per_cpu above 1 means work is queuing), memory and swap, disk use for / and for Docker's data root, and uptime.
Both are a snapshot of now, not a history: there is no retention, no thresholds and no alerting here. Memory is in bytes with the raw docker string kept under raw, so a value docker prints in a form dash cannot read stays visible instead of turning into a wrong number. Only this service's containers are reported, even on a host other apps share.
Accessories are reported on their own hosts: dash accessory stats mysql (or all), and over MCP the containers and container_stats tools list them under accessories next to the app's hosts. The logs tool takes accessory: instead of role: — where a database's errors are.
Drift#
dash proxy drift answers "is the proxy pool consistent with what is running?" in one question. It reads the containers on every app host, the targets dash-proxy routes to on every proxy host, and the load balancer's targets, and reports each mismatch as {code, host, role, detail}. dash doctor runs the same check: the fail codes fail it, the rest warn.
| Code | Means | doctor |
|---|---|---|
proxy_target_not_running | dash-proxy routes to a container that is not running | fail |
running_not_targeted | a running container of a proxied role (any replica slot) is not a proxy target | warn |
loadbalancer_target_missing | a host the load balancer should forward to is not one of its targets | fail |
loadbalancer_target_extra | the load balancer forwards to a host no proxied role runs on | warn |
version_mismatch | the hosts of one role run different versions | warn |
multiple_running_versions | one host runs more than one version of a role | warn |
While the deploy lock is held, the two version codes are left out — a deploy in flight runs two versions on purpose — and the snapshot says "lock_held": true. A host whose containers or proxy routes could not be read is not compared: it is listed under unread with its error, the fleet is not reported consistent, and dash doctor warns.
dash mcp#
dash mcp is a Model Context Protocol server over stdio. The agent's client (Claude Code, Cursor, …) starts it from the project directory, like any dash command, so it reads the same deploy.yml, .dash/secrets and SSH agent you do. It exposes the diagnostics above as tools — every one of them read-only:
| Tool | Same answer as |
|---|---|
config | dash config --json |
containers | dash app containers --json |
proxy_services | dash proxy services --json |
drift | dash proxy drift --json |
doctor | dash doctor --json, without the registry check |
audit | dash audit --json (lines: up to 500 per host) |
lock_status | dash lock status --json |
deploy_reports | dash report show --json (last: up to 20) |
logs | dash app logs or dash accessory logs (role or accessory), off unless allowed (lines: up to 500, since, grep) |
scale_status | dash scale status --json |
autoscale_explain | dash autoscale explain ROLE --json (role) |
autoscale_decisions | dash autoscale history --json (role, lines: up to 500) |
controller_status | dash autoscale status --json |
signal_sample | dash autoscale signal ROLE --json (role) |
container_stats | dash app stats --json and dash accessory stats all --json together |
host_stats | dash server stats --json |
The mcp gem is not a dash dependency — a deploy never needs it. Add it to the project's Gemfile:
gem "mcp", "~> 1.6", group: :developmentThen point the client at it. For Claude Code, .mcp.json in the project root:
{
"mcpServers": {
"dash-staging": {
"command": "bundle",
"args": ["exec", "dash", "mcp", "-d", "staging"]
}
}
}Ask "is the proxy pool consistent?" and the agent answers from drift. The destination, config file, and the --hosts / --roles it starts with are fixed for the process; each question re-reads deploy.yml, so an edit shows up without a restart. The pre-connect hook runs once, at boot.
| Option | Effect |
|---|---|
-d, --destination | The destination, for the life of the process |
-c, --config-file | The config file |
-h, --hosts / -r, --roles / -p | A ceiling: a question can narrow inside it, never widen past it |
--allow-logs | Turn on the logs tool (or DASH_MCP_ALLOW_LOGS=true) |
Security model#
SSH authenticates dash to your hosts, and it stays the only way in: dash mcp listens on nothing, runs with your own SSH credentials, and can reach exactly what dash can. What SSH says nothing about are the three boundaries an agent adds — so dash mcp closes each one itself.
The agent → the remote shell. A tool's arguments come from a model, which may be reading text an attacker wrote. Every argument is checked against the tool's schema (unknown arguments are refused), hosts and roles are looked up in the config so only configured names survive, lines is a bounded integer, since must look like 15m or a timestamp, and grep is a substring match done in dash — it never reaches a shell. dash's test suite records every command each tool sends to a host and fails on anything outside a list of read-only shapes (docker ps, dash-proxy list, tail, stat/cat of the lock, docker logs, and the doctor's docker version, docker inspect, docker manifest inspect, ss). There is no deploy, scale, lock, reboot or exec tool. The doctor's registry check is left out because it runs docker login on every host.
Your hosts → the model provider. Whatever a tool returns goes to the agent's model. Every response, and every error message, passes a redactor on its way out: any value under a key naming a credential (password, token, secret, key — deliberately broad, so ssh_options.keys is hidden too), and every value from .dash/secrets wherever it appears inside a string, so a password inside a DATABASE_URL, an audit line or an SSH error is blanked. Log lines are redacted before grep sees them, so a grep cannot probe a secret. Secrets shorter than 6 characters are only caught by their key. Container logs are off unless you start the server with --allow-logs: they carry whatever your app prints, personal data included, and the redactor only knows your secrets, not your users'.
Your hosts → the agent. Audit lines, lock messages and logs are text other people wrote, and a model can mistake text for instructions. That cannot be filtered out reliably; the defence is that nothing the agent can call through dash mcp changes anything. The server tells the agent to treat tool output as data. Mind what other tools the same agent holds — a shell tool is not covered by any of this.
The token gate is not authentication. When DASH_MCP_TOKEN is set, dash mcp refuses to start unless DASH_MCP_AUTH_TOKEN matches. Over stdio both come from whoever launches the process, so this only stops a launch nobody configured — a stray .mcp.json, a copied command — not a determined local user, who has your SSH agent anyway.
Operating notes#
- Secrets resolve without a prompt. stdin is the protocol, so a
.dash/secretscommand substitution that prompts (a password manager without a session) hangs the server. Sign in first. They are resolved once, at boot; restart after rotating one. - stdout is the protocol. Everything dash would print — SSHKit, hooks, warnings — goes to stderr, which MCP clients show as the server's log.
- The ceiling limits SSH, not the config.
--hostskeeps every question off other hosts, but theconfigtool still describes the whole topology. The deploy lock lives on the primary host, solock_statusrefuses when the primary is outside the ceiling. - Large fleets: narrow per question with
hosts/roles, andaudit/logsread at most 500 lines per host.