Skip to content

Enroll a client

Each machine that runs moira enrolls separately with each host. An invite is single-use, expires after 15 minutes, and carries the server’s certificate fingerprint, so the very first connection is already pinned.

On the host, ask the running daemon for an invite over its admin socket. Pipe it straight into moira server add - so the secret never appears in process arguments:

Terminal window
ssh edge docker exec moirad moirad invite --name laptop | moira server add -
✓ edge enrolled as "laptop" (https://192.0.2.10:7443)
  • --name on invite decides the client name, so a leaked invite can’t pick its own. Without it, the client’s hostname is used. Enrolling the same name again replaces the old token.
  • moira server add checks the certificate against the invite, exchanges the secret for a token, confirms the API version and saves the server to ~/.config/moira/config.json.
  • --name <alias> on server add stores the server under a different local alias.
  • When stdin is piped or redirected, the - can be omitted.

Repeat for every host.

Terminal window
moira server ls
HOST URL REACHABLE VERSION API CLIENT ERROR
edge https://192.0.2.10:7443 yes v0.3.0 1 laptop —
nas https://192.0.2.20:7443 yes v0.3.0 1 laptop —

A host that doesn’t answer within two seconds is shown as unreachable and doesn’t block the others.

Terminal window
moira ls # every service on every host
moira ls --drift # only services with config or image drift
moira status shop-prod # detail for one service, wherever it runs
moira logs shop-prod -f # follow its logs
moira update shop-prod # pull its image tag and recreate it
moira ui --open # the same in a browser

Read Targets next: it explains how a bare name like shop-prod finds its host.

Terminal window
moira server rm edge

This forgets the server locally. To also invalidate the token on the host, revoke the client there: see Clients and access.