docs · pre-release
Menu
Other places it runs / Other hosts

Other hosts

Each machine has its own shepherd and its own flock. List the machines once in shep.toml and shep flock shows the flocks of all of them, so seven hosts take one command instead of seven.

Listing hosts

The list is the top-level hosts array in the shep.toml of the home you run shep from. shep host add <destination>, shep host remove and shep host list edit and read it. A destination is whatever ssh takes: a host name, user@host, or a name from ~/.ssh/config. One that starts with - is refused.

add keeps the entry and dials it once. A host that does not answer gets a warning, because a host that is down tonight is still a host.

What shep flock prints

With a list, shep flock and shep ls ask this machine and every listed host at once. This machine's flock comes first under local, then each host in list order under its name as listed. The order never depends on which host answered first.

$ shep flock
local
host  cpu  11%   mem  37.2G / 48.0G   disk  r 1.2M/s w 480.0K/s   net  rx 24.0K/s tx 9.0K/s

ID  NAME  STATUS  PID    RESTARTS  EXIT  CFG  CPU  MEM    UPTIME  FOLD  SMIT
1   web   online  41873  0         -     -    1%   88.0M  3h      -     -

amp2
host  cpu  4%   mem  9.1G / 16.0G   disk  r 0B/s w 12.0K/s   net  rx 1.1K/s tx 2.3K/s

ID  NAME   STATUS  PID   RESTARTS  EXIT  CFG  CPU  MEM    UPTIME  FOLD  SMIT
1   queue  online  2210  0         -     -    0%   41.0M  2d      -     -
$ echo $?
0

A host that does not answer

A host that fails prints one line on stderr in place of its table, and the others still print. The exit code is 0 only when every host answered. Otherwise it is the code of the first host that failed, this machine first.

$ shep flock
local
...
error[daemon_unreachable]: amp3: did not answer within 5s
$ echo $?
5

Each host gets five seconds. Listed hosts are dialled with no prompts, so a key that needs a passphrase must be in ssh-agent. A host running another shep version is listed with a warning, not counted as failed.

One host

shep flock --host amp2 lists that host alone. It may prompt as plain ssh does, and it takes --format json. With a list and no --host, --format json is refused for now, naming --host <name>, rather than printing this machine's flock alone and hiding the rest.

shep flock --follow follows one host: this machine, or the --host one. It dials no other.

Whistle reads the same list

shep whistle hands a model host on list_flock and describe_sheep, and accepts only a name from this list, read once when whistle starts. See Whistle.

What the remote needs

ssh runs shep dial-stdio on the host without a terminal, soshep must be on the PATH a non-interactive shell has. ssh amp2 shep --version checks it. The host's shepherd must be running; shep --host amp2 muster starts it from that host's own roll.

shep adds no keys or ports. The boundary is ssh's, and SECURITY.md says what that trusts.