sshwarm

command module
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: GPL-3.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

sshwarm

k9s for ssh. Your Linux machines, their services, containers and logs, in one terminal.

Tired of ssh-ing into box after box to find out what's deployed where, which service died overnight and which container is crash-looping? sshwarm shows the whole swarm at a glance, with the logs of whatever is red a keypress away.

  • In depth overview: uptime, pending reboot, systemd units, compose stacks, system resources.
  • Agentless: a small bash probe over your own ssh, with your keys, agent and ~/.ssh/config. Nothing to install on the machines.
  • Quick actions: start/stop services or containers, or reboot a machine.
  • Scriptable: get a json summary of all machines.

Get it

go install github.com/cmdoret/sshwarm@latest

Or run directly from the flake using nix:

nix run github:cmdoret/sshwarm -- --hosts hosts.toml

Or download a binary from the releases.

Requirements

Linux machines with systemd and bash, reachable over ssh without a password prompt (keys or agent), where the ssh user:

  • is in the systemd-journal group.
  • can run docker without password (either rootless or with passwordless sudo).

To start/stop services, or reboot machines, the user must also be root, or able to run systemctl with passwordless sudo.

Use

sshwarm --hosts hosts.toml

Machines behave like namespaces in k9s:

  • : goes to a table: :ctr web lists the containers of the machine web. :ctr all (or :ctr from the machines) those of every machine, same with :svc and :st.

Hosts file

Only name is required. ssh looks up host, or else name, in ~/.ssh/config for anything not set in the file, like ports or jump hosts. Save it as ~/.config/sshwarm/hosts.toml, or set SSHWARM_HOSTS or SSHWARM_FLAKE, to skip the flag. See sshwarm --help for more.

# hosts.toml: one [[host]] per machine
[[host]]
name = "db"                  # ssh db: user, key, port... from "Host db" in ~/.ssh/config

[[host]]
name = "web-1"
host = "web-1.example.org"   # ssh -i ~/.ssh/web deploy@web-1.example.org
user = "deploy"
key  = "~/.ssh/web"

Nix flake

Instead of a hosts file, you may provide a Nix flake exposing deploy.nodes in its outputs. See deploy-rs for more information.

sshwarm --flake ./nix

How it works

flowchart LR
    src["hosts.toml or flake.nix"] --> sw[sshwarm]
    sw -- "ssh, in parallel,<br>with ~/.ssh/config" --> m["each machine<br>runs probe.sh"]
    m -- "OS, reboot, usage,<br>units, stacks" --> sw
    sw --> ui["browser:<br>machines, services,<br>stacks, containers"]
    ui -. "logs, describe, shell,<br>on demand" .-> m

Docker images

Container images are also available, but they suffer from a few usability limitations:

  • nix is not included in the image, so you can only use hosts.toml
  • hosts.toml must fully define the hosts, as ssh refuses a mounted ~/.ssh/config.
docker run --rm -it -v ./hosts.toml:/hosts.toml:ro \
  -v ~/.ssh/id_ed25519:/root/.ssh/id_ed25519:ro -v ~/.ssh/known_hosts:/root/.ssh/known_hosts:ro \
  ghcr.io/cmdoret/sshwarm --hosts /hosts.toml

Documentation

Overview

sshwarm shows the state of Linux machines over ssh: uptime, pending reboots, CPU, memory and disk use, failed units, compose stacks, and their logs.

Directories

Path Synopsis
internal
inventory
Package inventory lists the machines sshwarm watches, and how to reach them over ssh: from a TOML hosts file, or a Nix flake's deploy.nodes.
Package inventory lists the machines sshwarm watches, and how to reach them over ssh: from a TOML hosts file, or a Nix flake's deploy.nodes.
remote
Package remote runs commands on hosts over ssh: to their end, as a stream of lines, or with the user's terminal.
Package remote runs commands on hosts over ssh: to their end, as a stream of lines, or with the user's terminal.
swarm
Package swarm talks to the machines over ssh: it lists them, probes them, streams their logs and descriptions, opens shells and runs actions.
Package swarm talks to the machines over ssh: it lists them, probes them, streams their logs and descriptions, opens shells and runs actions.
testutil
Package testutil holds what the tests of several packages share.
Package testutil holds what the tests of several packages share.
ui
Package ui shows the machines: as a table on stdout (PrintStatus), or as a TUI (Run) with their services, stacks, containers and logs.
Package ui shows the machines: as a table on stdout (PrintStatus), or as a TUI (Run) with their services, stacks, containers and logs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL