GitHub 0
Skip to content

Installation

Install fleethosts, give it your program's places, and run a first command on your machines.
pnpm
pnpm add fleethosts
npm
npm install fleethosts
yarn
yarn add fleethosts
bun
bun add fleethosts

Requires Node 22.20 or later, and ssh on PATH. Tags also need the Tailscale CLI.

  1. import { standardPlaces } from "fleethosts";
    
    const places = standardPlaces("mytool");
    ts
  2. import { fleetEntryProblem } from "fleethosts";
    
    const entries = ["vps", "tag:servers"];
    const problems = entries.map(fleetEntryProblem).filter(Boolean);
    ts
  3. import { resolveHosts, runOnHosts } from "fleethosts";
    
    const runs = await runOnHosts(places, async (remoteCommand) =>
      (await resolveHosts(places, entries, { remoteCommand })).targets,
      ["uname", "-a"],
    );
    ts

    ssh runs in batch mode, so a host that asks for a password is unreachable. Load your key into an agent first.