Skip to content

Actions and jobs

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
Terminal window
moira update shop-prod
moira apply edge/shop/ # whole stack, asks for confirmation
moira restart nas/legacy-app # unmanaged containers: restart, start, stop only

Every 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.

  • update pulls the tag that is in the compose file. To ship a different tag, edit the compose file and apply.
  • start never recreates existing containers, including dependencies of missing services.
  • A service-level restart fails if the service has no container. A service-level stop skips a missing service.
  • update and apply need a Compose target. Unmanaged containers only accept restart, start and stop.

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/k3f9x2 and exits 130.
  • --detach prints the accepted job and returns immediately.
  • The exit code is 0 when the job succeeds and 1 when it fails or the stream breaks.
Terminal window
moira jobs # recent jobs on every host, newest first
moira jobs edge # one host
moira jobs attach edge/k3f9x2 # replay the buffered output, then follow

Each 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/k3f9x2

Actions on unmanaged containers lock that container only. moira ls and moira status show the locking job.

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.

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.