Actions and jobs
Which action
Section titled “Which action”| Action | What runs on the host | Use when |
|---|---|---|
update |
docker compose pull <svc>, then docker compose up -d <svc> |
A new image was pushed to the tag in the compose file |
apply |
docker compose up -d <svc> |
An env file or the compose file changed |
restart |
Engine restart by container name | The process is stuck and nothing changed |
start |
up -d --no-recreate for missing services, then Engine start |
The service is stopped or has no container yet |
stop |
Engine stop by container name |
moira update shop-prodmoira apply edge/shop/ # whole stack, asks for confirmationmoira restart nas/legacy-app # unmanaged containers: restart, start, stop onlyEvery Compose call runs as
docker compose --project-directory <DEPLOY_DIR>/<stack> --progress plain <cmd> <services> in
the stack directory, with Compose’s normal file discovery (including override files) and
dependency handling. It is the same command you would run over SSH.
updatepulls the tag that is in the compose file. To ship a different tag, edit the compose file andapply.startnever recreates existing containers, including dependencies of missing services.- A service-level
restartfails if the service has no container. A service-levelstopskips a missing service. updateandapplyneed a Compose target. Unmanaged containers only acceptrestart,startandstop.
Confirmation
Section titled “Confirmation”Whole-stack actions always ask. update, apply and stop also ask when the target was
chosen because it was the only running copy, and actions on a scaled service selected by one
replica’s name ask because they affect every replica. Pass --yes to skip the prompt. Without
a terminal on stdin, a command that needs confirmation exits 2 and asks for --yes.
Every action becomes a job on the host. The CLI streams its output:
→ pull shop-prod Pulled→ up Container shop-prod Recreated Container shop-prod Started- Ctrl-C detaches, it doesn’t cancel. The job keeps running; the CLI prints
job continues: moira jobs attach edge/k3f9x2and exits130. --detachprints the accepted job and returns immediately.- The exit code is
0when the job succeeds and1when it fails or the stream breaks.
moira jobs # recent jobs on every host, newest firstmoira jobs edge # one hostmoira jobs attach edge/k3f9x2 # replay the buffered output, then followEach host keeps its newest 50 jobs in memory, with up to 2000 lines and 512 KiB of output each.
Job history is lost when moirad restarts. moira status shows the last few jobs for the
selected target.
Only one action runs per stack at a time. A second one is refused with the job that holds the lock, and the CLI prints the command to attach to it:
stack shop is busy with job k3f9x2: moira jobs attach edge/k3f9x2Actions on unmanaged containers lock that container only. moira ls and moira status show
the locking job.
Output and secrets
Section titled “Output and secrets”Before Compose output reaches the job buffer, moirad masks every value of at least four
characters from the stack’s .env and env_files as ***, and drops overlong lines. For
stacks that use a top-level Compose include, it hides Compose output entirely and reports its
own step lines and the exit code. Image builds can print anything, so keep secrets out of build
output.
Acting on moirad itself
Section titled “Acting on moirad itself”moirad is a stack in the deploy folder too, so you can update it through moira. See
Self-update. Stopping it over the API is refused: use SSH.