Mosaic CLI Docs 中文

Gateway

Gateway Module: Step-by-Step Tutorial

Control gateway lifecycle and test the method-call interface through CLI commands.

Step 1: Install local gateway runtime

mosaic --project-state gateway install --host 127.0.0.1 --port 8787

Step 2: Start gateway process

mosaic --project-state gateway start
# optional explicit host/port
mosaic --project-state gateway start --host 127.0.0.1 --port 8787

Step 3: Check status and health

mosaic --project-state gateway status
mosaic --project-state gateway status --deep
mosaic --project-state gateway health
mosaic --project-state gateway health --verbose
mosaic --project-state gateway health --verbose --repair

Step 4: Probe and discover

mosaic --project-state gateway probe
mosaic --project-state gateway discover

Step 5: Execute call interface

mosaic --project-state gateway call status
mosaic --project-state gateway call status --params '{"detail":true}'
mosaic --project-state --json gateway call status

call forwards method and optional JSON params to the active gateway service.

Step 6: Run end-to-end diagnostics

mosaic --project-state gateway diagnose --method status
mosaic --project-state --json gateway diagnose --method status --params '{"detail":true}'

diagnose executes probe -> discover -> call and returns per-step health, latency, and error code.

Step 7: Restart and controlled shutdown

mosaic --project-state gateway restart
mosaic --project-state gateway stop

Step 8: Uninstall when cleaning up

mosaic --project-state gateway uninstall

Step 9: Operational checklist

  • status, health, and probe must all succeed.
  • diagnose should report failed=0 in stable environments.
  • Use gateway health --repair when endpoint is down and you want one-shot auto recovery.
  • call status must return valid payload for automation.
  • After restart, probe result should remain healthy.