CLI
moira <command> [--json]
server add [<invite>|-] [--name <alias>] server ls server rm <host> ls [host] [--all] [--unmanaged] [--drift] status <target> update|apply|restart|start|stop <target> [--yes] [--detach] jobs [host] jobs attach <host>/<id> logs <target> [-f] [--tail N] [--since TIME] [--until TIME] [--grep RE] [--no-color] [--timestamps] env <target> [file] [--yes] [--no-apply] env <target> history [file] env <target> restore <id> [file] [--yes] [--no-apply] pin <name> <host> unpin <name> hide <target> show <target> ui [--port N] [--open] completion bash|zsh|fish --version --helpEvery command accepts --json. See JSON output. Targets are
described in Targets.
Servers
Section titled “Servers”moira server add [<invite>|-] [--name <alias>]
Section titled “moira server add [<invite>|-] [--name <alias>]”Enroll this machine with a host using a one-time invite. - (or piped stdin with no operand)
reads the invite from stdin, which keeps it out of process arguments. --name saves the server
under a local alias instead of the host name from the invite. See
Enroll a client.
moira server ls
Section titled “moira server ls”Every configured server with its URL, reachability, daemon version, API version, the client name it knows you by, and the error if it is unreachable.
moira server rm <host>
Section titled “moira server rm <host>”Forget a server and its target cache. This doesn’t revoke the token on the host.
Inventory
Section titled “Inventory”moira ls [host] [--all] [--unmanaged] [--drift]
Section titled “moira ls [host] [--all] [--unmanaged] [--drift]”One table across hosts: host, stack, service (or container name), state, health, image tag, uptime and drift.
| Flag | Meaning |
|---|---|
host |
Only this host |
--all |
Include hidden rows |
--unmanaged |
Include unmanaged containers (also enabled by showUnmanaged in the config) |
--drift |
Only rows with cfg or img drift |
One-off containers show their container name with (one-off). Missing services show state
missing.
moira status <target>
Section titled “moira status <target>”Detail for a service, container or whole stack: container name, state and health, Docker status, image, uptime, restart count, drift, lock, env files with the services that use them, Compose warnings, and up to five recent jobs.
Actions
Section titled “Actions”moira update|apply|restart|start|stop <target> [--yes] [--detach]
Section titled “moira update|apply|restart|start|stop <target> [--yes] [--detach]”| Action | Effect |
|---|---|
update |
Pull the image tag in the compose file, then up -d |
apply |
up -d: recreate after env or compose changes |
restart |
Restart the container(s). Does not reload env |
start |
Create missing services without recreating others, then start stopped containers |
stop |
Stop the container(s) |
| Flag | Meaning |
|---|---|
--yes |
Skip confirmation |
--detach |
Print the accepted job and return without streaming output |
See Actions and jobs for confirmation rules and locks.
moira jobs [host]
Section titled “moira jobs [host]”Retained jobs across hosts (or one host), newest first: host, ID, action, target, state, client, start time and duration.
moira jobs attach <host>/<id>
Section titled “moira jobs attach <host>/<id>”Replay a job’s buffered output and follow it until it ends. The exit code reflects the job’s result.
moira logs <target> [flags]
Section titled “moira logs <target> [flags]”| Flag | Meaning |
|---|---|
-f |
Follow |
--tail N |
Lines from the end (default 200, max 10000). all requires --since |
--since TIME |
Duration (15m) or RFC 3339 time |
--until TIME |
Duration or RFC 3339 time |
--grep RE |
Keep lines matching a regular expression |
--no-color |
Plain output |
--timestamps |
Show Docker timestamps |
See Logs.
Env files
Section titled “Env files”moira env <target> [file] [--yes] [--no-apply]
Section titled “moira env <target> [file] [--yes] [--no-apply]”Edit an env file in $VISUAL, $EDITOR or vi, review a masked diff, save conditionally and
offer to apply. With several candidate files, name one or pick from the list on a terminal.
moira env <target> history [file]
Section titled “moira env <target> history [file]”List backups: ID, kind (history or bak) and time.
moira env <target> restore <id> [file] [--yes] [--no-apply]
Section titled “moira env <target> restore <id> [file] [--yes] [--no-apply]”Save a backup’s content as the current version through the same review and apply flow.
--json requires --yes.
See Env files.
Preferences
Section titled “Preferences”| Command | Effect |
|---|---|
moira pin <name> <host> |
A bare name means the copy on host |
moira unpin <name> |
Remove the pin |
moira hide <target> |
Leave matching containers out of ls and the board |
moira show <target> |
Undo hide |
Preferences are stored in the client config on this machine only.
| Command | Effect |
|---|---|
moira ui [--port N] [--open] |
Start the web UI on loopback |
moira completion bash|zsh|fish |
Print a shell completion script |
moira --version |
Client version |
moira --help |
Usage |
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
Success, including Ctrl-C while following logs |
1 |
Action failed, job failed, stream interrupted, or an env conflict that needs a terminal |
2 |
Usage error, resolution error, ambiguous target, or a declined or impossible confirmation |
3 |
Server unreachable, authentication failed, or incompatible API version |
130 |
Interrupted: Ctrl-C while attached to a job (the job continues), editing, reading an invite or waiting for the config lock |