[{"data":1,"prerenderedAt":641,"buildId":642},["ShallowReactive",2],{"docs:\u002Fguide\u002Ffleet":3},{"page":4,"section":16,"document":17,"credits":10,"prev":633,"next":637},{"id":5,"path":6,"file":7,"title":8,"sourceTitle":8,"description":9,"tagline":9,"eyebrow":10,"credits":10,"keywords":11,"icon":12,"layout":13,"sidebar":14,"toc":14,"kind":10,"group":10,"navigation":14,"order":15},"fleet","\u002Fguide\u002Ffleet","guide\u002Ffleet.md","Fleet","Set up and sync other machines from one controller over SSH or Tailscale, check what each last ran, and run a command on all of them.",null,[],"i-lucide-server","article",true,6,"guide",{"nodes":18,"toc":622},[19,35,43,99,121,131,137,227,260,266,292,317,326,336,355,361,374,395,402,408,430,444,472,478,495,501,523,541,547,554,563,575,595,601],[20,21,22,23,27,28,30,31,34],"p",{},"The machine you run ",[24,25,26],"code",{},"fleetrc fleet"," on is the controller. It reads the ",[24,29,5],{}," list in your manifest and reaches each host over ",[24,32,33],{},"ssh"," to set it up, sync it, upgrade it or run a command. Hosts run no fleetrc service.",[36,37,42],"h2",{"id":38,"anchor":39},"hosts",{"label":40,"icon":41},"Section titled \"Hosts\"","#","Hosts",[44,45,49],"pre",{"language":46,"filename":47,"class":48,"wrap":14},"json",".fleetrc\u002Fmanifest.json","shiki shiki-themes github-light-default github-dark-default dark:github-dark-default",[24,50,52,61,62,61,94],{"class":51},"language-json",[53,54,57],"span",{"class":55,"style":56},"line","display: inline",[53,58,60],{"style":59},"color:#1F2328;--shiki-dark:#E6EDF3","{","\n",[53,63,64,68,71,75,78,81,83,86,88,91],{"class":55,"style":56},[53,65,67],{"style":66},"color:#116329;--shiki-dark:#7EE787","  \"fleet\"",[53,69,70],{"style":59},": [",[53,72,74],{"style":73},"color:#0A3069;--shiki-dark:#A5D6FF","\"laptop\"",[53,76,77],{"style":59},", ",[53,79,80],{"style":73},"\"root@vps2\"",[53,82,77],{"style":59},[53,84,85],{"style":73},"\"ssh:\u002F\u002Fdeploy@10.0.0.7:2222\"",[53,87,77],{"style":59},[53,89,90],{"style":73},"\"tag:servers\"",[53,92,93],{"style":59},"]",[53,95,96],{"class":55,"style":56},[53,97,98],{"style":59},"}",[20,100,101,102,104,105,108,109,112,113,116,117,120],{},"An entry is anything ",[24,103,33],{}," takes: a host name, ",[24,106,107],{},"user@host",", an IP address, an ",[24,110,111],{},"~\u002F.ssh\u002Fconfig"," alias or ",[24,114,115],{},"ssh:\u002F\u002Fuser@host:port",". A ",[24,118,119],{},"tag:\u003Cname>"," entry stands for every machine on your tailnet with that Tailscale tag. The name is a letter followed by letters, digits or dashes. fleetrc asks Tailscale each time, so a new tagged server joins the fleet without a manifest change.",[20,122,123,124,126,127,130],{},"Only your own manifest names machines. The ",[24,125,5],{}," of an ",[24,128,129],{},"extends"," manifest is ignored.",[36,132,136],{"id":133,"anchor":134},"commands",{"label":135,"icon":41},"Section titled \"Commands\"","Commands",[138,139,140,153],"table",{},[141,142,143],"thead",{},[144,145,146,150],"tr",{},[147,148,149],"th",{},"Command",[147,151,152],{},"What it does",[154,155,156,174,187,197,207,217],"tbody",{},[144,157,158,164],{},[159,160,161],"td",{},[24,162,163],{},"fleet init \u003Chost>...",[159,165,166,167,170,171,173],{},"Runs ",[24,168,169],{},"npx fleetrc init"," on each host with this machine's manifest, then adds the host to ",[24,172,5],{},".",[144,175,176,181],{},[159,177,178],{},[24,179,180],{},"fleet add [host...]",[159,182,183,184,186],{},"Adds hosts to ",[24,185,5],{}," without setting them up. With no host, lists the tailnet machines and tags you can add.",[144,188,189,194],{},[159,190,191],{},[24,192,193],{},"fleet sync [host...]",[159,195,196],{},"Runs a sync on each host.",[144,198,199,204],{},[159,200,201],{},[24,202,203],{},"fleet status [host...]",[159,205,206],{},"Shows each host's last run.",[144,208,209,214],{},[159,210,211],{},[24,212,213],{},"fleet upgrade [host...]",[159,215,216],{},"Installs this version of fleetrc on each host, then syncs.",[144,218,219,224],{},[159,220,221],{},[24,222,223],{},"fleet run [host...] -- \u003Ccommand>",[159,225,226],{},"Runs a command here and on each host.",[20,228,229,230,77,233,236,237,240,241,243,244,247,248,77,251,236,254,256,257,173],{},"Without hosts, ",[24,231,232],{},"sync",[24,234,235],{},"status"," and ",[24,238,239],{},"upgrade"," use the whole ",[24,242,5],{},". Naming hosts narrows the run to them. All commands take ",[24,245,246],{},"--json",". ",[24,249,250],{},"init",[24,252,253],{},"add",[24,255,232],{}," take ",[24,258,259],{},"--dry-run",[36,261,265],{"id":262,"anchor":263},"add-a-machine",{"label":264,"icon":41},"Section titled \"Add a machine\"","Add a machine",[44,267,270],{"language":268,"frame":269,"class":48,"wrap":14},"sh","terminal",[24,271,273],{"class":272},"language-sh",[53,274,275,279,282,285,288],{"class":55,"style":56},[53,276,278],{"style":277},"color:#953800;--shiki-dark:#FFA657","fleetrc",[53,280,281],{"style":73}," fleet",[53,283,284],{"style":73}," init",[53,286,287],{"style":73}," vps2",[53,289,291],{"style":290},"color:#0550AE;--shiki-dark:#79C0FF"," --timer",[20,293,294,297,298,77,301,77,304,77,307,236,310,313,314,316],{},[24,295,296],{},"fleet init"," accepts ",[24,299,300],{},"--copy",[24,302,303],{},"--no-copy",[24,305,306],{},"--timer",[24,308,309],{},"--no-hooks",[24,311,312],{},"--force",", and passes them to the host's ",[24,315,250],{},". The manifest must be in a git repository the host can read. A manifest in a file or folder on the controller stops with an error.",[20,318,319,320,116,322,325],{},"A host that already has this manifest only syncs. A host that follows another manifest is reported and left alone, unless you pass ",[24,321,312],{},[24,323,324],{},"tag:"," entry is added only when all of its current machines are set up.",[20,327,328,329,331,332,335],{},"When the manifest has a working clone, fleetrc edits ",[24,330,5],{}," there and prints ",[24,333,334],{},"added vps2 to the fleet in ~\u002Fcode\u002Fmanifests\u002F.fleetrc\u002Fmanifest.json; commit and push it",". Otherwise it prints the entry for you to add. After you push, refresh the controller before syncing the fleet:",[44,337,338],{"language":268,"frame":269,"class":48,"wrap":14},[24,339,340,61,347],{"class":272},[53,341,342,344],{"class":55,"style":56},[53,343,278],{"style":277},[53,345,346],{"style":73}," sync",[53,348,349,351,353],{"class":55,"style":56},[53,350,278],{"style":277},[53,352,281],{"style":73},[53,354,346],{"style":73},[36,356,360],{"id":357,"anchor":358},"check-hosts",{"label":359,"icon":41},"Section titled \"Check hosts\"","Check hosts",[44,362,363],{"language":268,"frame":269,"class":48,"wrap":14},[24,364,365],{"class":272},[53,366,367,369,371],{"class":55,"style":56},[53,368,278],{"style":277},[53,370,281],{"style":73},[53,372,373],{"style":73}," status",[44,375,377],{"language":376,"class":48,"wrap":14},"txt",[24,378,380,61,385,61,390],{"class":379},"language-txt",[53,381,382],{"class":55,"style":56},[53,383,384],{},"vps2: last run 4m ago, 38 skills",[53,386,387],{"class":55,"style":56},[53,388,389],{},"web1.tail1234.ts.net (tag:servers): last run 12m ago, 38 skills",[53,391,392],{"class":55,"style":56},[53,393,394],{},"gone.example: unreachable (no answer within 30 s); last run 5h ago, 38 skills; behind: last run 5h ago",[20,396,397,398,401],{},"An unreachable host shows its last run from the controller's cache. A host is behind when its last run is over two hours old, a source sits at another commit than on the freshest host, or it holds updates for review. The command exits ",[24,399,400],{},"1"," when a host is unreachable or reports an error.",[36,403,407],{"id":404,"anchor":405},"run-a-command",{"label":406,"icon":41},"Section titled \"Run a command\"","Run a command",[44,409,410],{"language":268,"frame":269,"class":48,"wrap":14},[24,411,412],{"class":272},[53,413,414,416,418,421,424,427],{"class":55,"style":56},[53,415,278],{"style":277},[53,417,281],{"style":73},[53,419,420],{"style":73}," run",[53,422,423],{"style":290}," --",[53,425,426],{"style":73}," node",[53,428,429],{"style":290}," --version",[44,431,432],{"language":376,"class":48,"wrap":14},[24,433,434,61,439],{"class":379},[53,435,436],{"class":55,"style":56},[53,437,438],{},"laptop: v22.14.0",[53,440,441],{"class":55,"style":56},[53,442,443],{},"vps2: v22.12.0",[20,445,446,447,450,451,453,454,456,457,77,460,77,463,77,466,236,469,173],{},"Each line is printed after its host, and stderr goes to stderr with the same prefix. A host that is unreachable, times out or exits nonzero is reported, and ",[24,448,449],{},"fleet run"," exits ",[24,452,400],{},". With ",[24,455,246],{}," it prints an array of ",[24,458,459],{},"host",[24,461,462],{},"reachable",[24,464,465],{},"exitCode",[24,467,468],{},"stdout",[24,470,471],{},"error",[36,473,477],{"id":474,"anchor":475},"timeout",{"label":476,"icon":41},"Section titled \"Timeout\"","Timeout",[20,479,480,483,484,487,488,491,492,494],{},[24,481,482],{},"--timeout \u003Cs>"," sets the seconds to wait for each host: ",[24,485,486],{},"30"," by default, ",[24,489,490],{},"120"," for ",[24,493,296],{},". A command still running at the deadline is stopped and reported as timed out.",[36,496,500],{"id":497,"anchor":498},"remote-requirements",{"label":499,"icon":41},"Section titled \"Remote requirements\"","Remote requirements",[20,502,503,504,491,507,236,509,512,513,516,517,519,520,522],{},"A host needs Node.js 22.12 or newer, and ",[24,505,506],{},"npx",[24,508,296],{},[24,510,511],{},"fleet upgrade",", on the ",[24,514,515],{},"PATH"," that ",[24,518,33],{}," commands get. That ",[24,521,515],{}," is often shorter than your login shell's. fleetrc says which is missing.",[20,524,525,236,527,529,530,533,534,537,538,540],{},[24,526,296],{},[24,528,511],{}," install ",[24,531,532],{},"fleetrc@\u003Cthis version>"," from npm. Set ",[24,535,536],{},"FLEETRC_PACKAGE"," to a package ",[24,539,506],{}," accepts, such as a tarball, a URL or a preview build, to install that instead. A development build or a version that is not on npm needs it.",[36,542,546],{"id":543,"anchor":544},"tailnet-policy",{"label":545,"icon":41},"Section titled \"Tailnet policy\"","Tailnet policy",[20,548,549,550,553],{},"On Tailscale, set the manifest once in your tailnet policy's ",[24,551,552],{},"nodeAttrs",":",[44,555,559],{"language":556,"filename":557,"class":558,"wrap":14},"jsonc","Tailscale policy","shiki dark:github-dark-default",[24,560,562],{"class":561},"language-jsonc","\"nodeAttrs\": [\n  { \"target\": [\"*\"], \"app\": { \"github.com\u002Fonmax\u002Ffleetrc\": [{ \"manifest\": \"me\u002Fskills\" }] } }\n]",[20,564,565,567,568,571,572,574],{},[24,566,169],{}," on a fresh machine reads it, and each sync asks again. To switch a machine that has its own manifest, run ",[24,569,570],{},"npx fleetrc init tailscale:",". A bare ",[24,573,250],{}," keeps the current manifest. The manifest must be in a git repository.",[576,577,580],"github-callout",{"type":578,"title":579},"warning","Warning",[20,581,582,583,77,586,77,589,236,592,173],{},"Follow only a tailnet policy whose editors you trust. The root manifest can run commands on your machine through ",[24,584,585],{},"hooks",[24,587,588],{},"report",[24,590,591],{},"mcp",[24,593,594],{},"agentHooks",[36,596,600],{"id":597,"anchor":598},"from-code",{"label":599,"icon":41},"Section titled \"From code\"","From code",[20,602,603,606,607,609,610,612,613,616,617,173],{},[24,604,605],{},"runOnFleet(argv, { timeoutMs })"," from ",[24,608,278],{}," runs a command on every host in the fleet as ",[24,611,449],{}," does, but never on this machine. It returns ",[24,614,615],{},"undefined"," when there is no config or the fleet is empty. See the ",[618,619,621],"a",{"href":620},"\u002Freference\u002Fcli","CLI reference",[623,625,626,627,628,629,630,631,632],{"id":38,"depth":624,"text":42},2,{"id":133,"depth":624,"text":136},{"id":262,"depth":624,"text":265},{"id":357,"depth":624,"text":360},{"id":404,"depth":624,"text":407},{"id":474,"depth":624,"text":477},{"id":497,"depth":624,"text":500},{"id":543,"depth":624,"text":546},{"id":597,"depth":624,"text":600},{"path":634,"title":635,"description":636},"\u002Fguide\u002Fhooks-and-mcp","Hooks and MCP servers","Start syncs from agent sessions, sync MCP servers and agent hook files into each agent, and run your own commands after a sync.",{"path":638,"title":639,"description":640},"\u002Fguide\u002Ftimer","Timer","Sync on a schedule from the operating system, for servers and other machines where no Claude Code or Codex session starts a sync.",1796387377685,"d132e1fa-7946-4d59-bf8e-899a35cb66e2"]