[{"data":1,"prerenderedAt":442,"buildId":443},["ShallowReactive",2],{"docs:\u002Fguide\u002Fhosts":3},{"page":4,"section":16,"document":17,"credits":10,"prev":436,"next":440},{"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},"hosts","\u002Fguide\u002Fhosts","guide\u002Fhosts.md","Remote hosts","Set up a host that runs your jobs over ssh, with the tools it needs, the config entry, and how the checkout is copied and checked.",null,[],"i-lucide-server","article",true,4,"guide",{"nodes":18,"toc":430},[19,23,31,110,116,131,137,144,221,246,269,275,365,371,423],[20,21,22],"p",{},"A host is a machine that runs jobs for this one. Nothing is installed on it for fleetjobs: this machine sends a small script with each call, and the host runs it with Node.",[24,25,30],"h2",{"id":26,"anchor":27},"what-a-host-needs",{"label":28,"icon":29},"Section titled \"What a host needs\"","#","What a host needs",[32,33,34,47],"table",{},[35,36,37],"thead",{},[38,39,40,44],"tr",{},[41,42,43],"th",{},"Tool",[41,45,46],{},"Why",[48,49,50,67,78,88,99],"tbody",{},[38,51,52,60],{},[53,54,55,59],"td",{},[56,57,58],"code",{},"ssh",", with a key and no password prompt",[53,61,62,63,66],{},"Every call uses ",[56,64,65],{},"BatchMode=yes"," and a 4-second connect timeout",[38,68,69,75],{},[53,70,71,74],{},[56,72,73],{},"node",", 22.20 or later",[53,76,77],{},"Runs the host script",[38,79,80,85],{},[53,81,82],{},[56,83,84],{},"rsync",[53,86,87],{},"Copies the checkout in and the files the job wrote back",[38,89,90,96],{},[53,91,92,95],{},[56,93,94],{},"bwrap"," (bubblewrap)",[53,97,98],{},"Runs the job with the mirror mounted at the checkout's own path",[38,100,101,107],{},[53,102,103,106],{},[56,104,105],{},"git",", the package manager and the tools your jobs use",[53,108,109],{},"The host installs dependencies and runs the command",[20,111,112,113,115],{},"Without ",[56,114,94],{},", the job still runs, but the mirror sits at a different path than your checkout, so absolute paths in configs and output differ.",[20,117,118,119,121,122,124,125,130],{},"This machine needs ",[56,120,58],{}," and ",[56,123,84],{}," too, and Linux with systemd for ",[126,127,129],"a",{"href":128},"\u002Fguide\u002Fplacement#when-memory-runs-out","local scopes",".",[24,132,136],{"id":133,"anchor":134},"add-a-host",{"label":135,"icon":29},"Section titled \"Add a host\"","Add a host",[20,138,139,140,143],{},"Add it to ",[56,141,142],{},"~\u002F.config\u002Ffleetjobs\u002Fconfig.json",":",[145,146,149],"pre",{"language":147,"class":148,"wrap":14},"json","shiki shiki-themes github-light-default github-dark-default dark:github-dark-default",[56,150,152,161,162,161,216],{"class":151},"language-json",[153,154,157],"span",{"class":155,"style":156},"line","display: inline",[153,158,160],{"style":159},"color:#1F2328;--shiki-dark:#E6EDF3","{","\n",[153,163,164,168,171,174,177,181,184,187,189,192,194,197,199,203,205,208,210,213],{"class":155,"style":156},[153,165,167],{"style":166},"color:#116329;--shiki-dark:#7EE787","  \"hosts\"",[153,169,170],{"style":159},": [{ ",[153,172,173],{"style":166},"\"name\"",[153,175,176],{"style":159},": ",[153,178,180],{"style":179},"color:#0A3069;--shiki-dark:#A5D6FF","\"build-box\"",[153,182,183],{"style":159},", ",[153,185,186],{"style":166},"\"address\"",[153,188,176],{"style":159},[153,190,191],{"style":179},"\"me@build-box\"",[153,193,183],{"style":159},[153,195,196],{"style":166},"\"slots\"",[153,198,176],{"style":159},[153,200,202],{"style":201},"color:#0550AE;--shiki-dark:#79C0FF","2",[153,204,183],{"style":159},[153,206,207],{"style":166},"\"speed\"",[153,209,176],{"style":159},[153,211,212],{"style":201},"0.5",[153,214,215],{"style":159}," }]",[153,217,218],{"class":155,"style":156},[153,219,220],{"style":159},"}",[20,222,223,226,227,229,230,233,234,237,238,241,242,130],{},[56,224,225],{},"address"," is what you would pass to ",[56,228,58],{},". ",[56,231,232],{},"slots"," is how many jobs the host runs at once, and ",[56,235,236],{},"speed"," is its speed against this machine, where ",[56,239,240],{},"1"," is as fast. fleetjobs reads the file on every tick, so there is nothing to restart. See ",[126,243,245],{"href":244},"\u002Freference\u002Fconfig","the config reference",[20,247,248,249,252,253,256,257,260,261,264,265,268],{},"Check the host from this machine with ",[56,250,251],{},"ssh me@build-box node --version",". Then run a test job: ",[56,254,255],{},"HEAVY_REMOTE=1 heavy sh -c 'echo ok > out.txt'",". When the host finishes first, ",[56,258,259],{},"heavy"," prints the line ",[56,262,263],{},"this runs on build-box"," on stderr, and ",[56,266,267],{},"out.txt"," appears here.",[24,270,274],{"id":271,"anchor":272},"what-a-run-does",{"label":273,"icon":29},"Section titled \"What a run does\"","What a run does",[276,277,278,296,326,339,359],"ol",{},[279,280,281,285,286,183,289,121,292,295],"li",{},[282,283,284],"strong",{},"Probe."," The host reports its free slots and whether it is busy. It is busy under 3 GB of free memory, under 15 GB of free disk, or when CPU pressure is 40% or more while other processes use 25% or more of the CPUs. CPU used by fleetjobs' own jobs is subtracted. A host may change these limits with ",[56,287,288],{},"HEAVY_HOST_MIN_MEM_GB",[56,290,291],{},"HEAVY_HOST_MIN_DISK_GB",[56,293,294],{},"HEAVY_HOST_MAX_OTHERS"," in its environment.",[279,297,298,301,302,305,306,183,309,183,312,315,316,319,320,121,323,130],{},[282,299,300],{},"Copy."," rsync copies the checkout, with uncommitted changes, to ",[56,303,304],{},"~\u002Foverflow\u002Fmirror\u003Ccheckout path>"," on the host. It leaves out ",[56,307,308],{},"node_modules",[56,310,311],{},".git",[56,313,314],{},".env"," files, ",[56,317,318],{},".pem"," files, and what git ignores, except ",[56,321,322],{},"dist",[56,324,325],{},".nuxt",[279,327,328,331,332,335,336,130],{},[282,329,330],{},"Install."," The host installs dependencies once per hash of the lockfiles and package manifests, with ",[56,333,334],{},"pnpm install --frozen-lockfile"," or ",[56,337,338],{},"npm ci",[279,340,341,344,345,121,348,350,351,354,355,358],{},[282,342,343],{},"Run."," The job runs under ",[56,346,347],{},"nice",[56,349,94],{}," in a slot of the host, ",[56,352,353],{},"~\u002Foverflow\u002Fheavy-slot-\u003Cn>",", and stops if the connection drops. Output streams back as it comes, and ",[56,356,357],{},"HEAVY_MAX"," applies.",[279,360,361,364],{},[282,362,363],{},"Copy back."," The host lists each file the job wrote with its SHA-256, and rsync copies them to this machine, where fleetjobs checks each one. A copy that fails or does not match turns exit 0 into exit 74.",[24,366,370],{"id":367,"anchor":368},"exit-codes-of-a-host",{"label":369,"icon":29},"Section titled \"Exit codes of a host\"","Exit codes of a host",[32,372,373,383],{},[35,374,375],{},[38,376,377,380],{},[41,378,379],{},"Exit",[41,381,382],{},"Meaning",[48,384,385,393,405,415],{},[38,386,387,390],{},[53,388,389],{},"200 to 205, 208, 255",[53,391,392],{},"The job did not start: the host is busy or has no free slot, the mirror is missing, the install failed, the copy failed, or ssh could not connect. The host rests for a minute and the job goes back to the queue here",[38,394,395,398],{},[53,396,397],{},"206",[53,399,400,401,404],{},"The output shows what the mirror lacks, such as ",[56,402,403],{},"not a git repository",". The job runs here, ahead of the queue",[38,406,407,410],{},[53,408,409],{},"124",[53,411,412,413],{},"The job passed ",[56,414,357],{},[38,416,417,420],{},[53,418,419],{},"74",[53,421,422],{},"The job passed, but the files it wrote did not come back intact",[20,424,425,426,130],{},"Any other code is the job's own. What happens to a failing job is in ",[126,427,429],{"href":428},"\u002Fguide\u002Ftrust","Trust",[431,433,434,435],{"id":26,"depth":432,"text":30},2,{"id":133,"depth":432,"text":136},{"id":271,"depth":432,"text":274},{"id":367,"depth":432,"text":370},{"path":437,"title":438,"description":439},"\u002Fguide\u002Fplacement","How jobs are placed","How fleetjobs decides where a queued job runs, which jobs may leave this machine, and what the local machine's rules allow.",{"path":428,"title":429,"description":441},"How fleetjobs decides whether to believe a result from a remote host or run the command again here, and what the trust table keeps.",1796530822122,"9e7c308e-a25b-413c-bd8b-9a1122ddc1d4"]