muster setup

muster setup

Set up a project: detect its services and write muster.json plus one hook folder per service.

Synopsis

Terminal
muster setup [flags]
muster init [flags]   # alias

Description

Without flags, setup runs an interactive wizard (it needs a terminal). It scans the project, including docker/, k8s/, deploy/ and infra/, for Dockerfiles, compose files, Kubernetes manifests and app manifests such as package.json, then proposes services, a deploy order, health checks and credentials. Paths in .musterignore and folders named archived, deprecated, old or backup are skipped.

On a Kubernetes stack, setup also reads the live cluster (kubectl get deployments) for real deployment names, ports and probes. Services found in files but not in the cluster get skip_deploy: true. Without kubectl or a reachable cluster this step is skipped with a warning.

Infrastructure services (redis, postgres, mysql, mongo, rabbitmq, kafka, nginx and similar) get pull-only hooks and are ordered before app services. Setup adds .muster/logs/ and .muster/pids/ to .gitignore; commit muster.json and .muster/hooks/. All files are written at the end, so Ctrl+C leaves the project unchanged.

Flags

FlagDescription
--path, -p <dir>Project directory (default: .).
--scanAuto-detect stack and services from project files.
--stack, -s <type>Stack: k8s, compose, docker, bare, dev.
--services <list>Comma-separated service names.
--order <list>Comma-separated deploy order (default: services order).
--health <spec>Per-service health: svc=type[:arg:arg] (repeatable).
--creds <spec>Per-service credentials: svc=mode (repeatable). Modes: off, save, session, always.
--remote <spec>Per-service remote: svc=user@host[:port][:path].
--git-pull <spec>Per-service git pull: svc[=remote:branch] (repeatable; default origin/main).
--strategy <spec>Per-service strategy: svc=rolling|blue-green|canary (k8s services). With --update alone it switches an existing service and regenerates its unedited hooks.
--namespace <ns>Kubernetes namespace (default: default).
--name, -n <name>Project name (default: directory name).
--force, -fStart over: regenerate muster.json and hooks (hooks you edited are backed up first).
--update, -uRe-run on an existing project: add new services, keep your muster.json changes and edited hooks.
--dry-runWith --scan: show what setup would do, write nothing.
--jsonWith --scan --dry-run: print the preview as JSON.

Spec formats

FlagDescription
--health api=http:/health:8080HTTP check on path and port.
--health redis=tcp:6379TCP check on a port.
--health worker=command:./check.shRun a command.
--health api=noneNo health check.
--git-pull api=upstream:developPull upstream/develop before each deploy.
--remote [email protected]:2222:/opt/myappRun api's hooks on that host, port and directory.

Examples

Terminal
muster setup                                   # interactive wizard
muster setup --scan                            # detect everything, no prompts
muster setup --path /app --scan
muster setup --stack k8s --services api,redis --name myapp
muster setup --scan --health api=http:/health:3000 --name myapp
muster setup --scan --dry-run --json           # preview detected services as JSON
muster setup --update --scan                   # add new services, keep your edits
muster setup --update --strategy api=canary    # switch api to canary deploys

Exit codes and JSON

--scan --dry-run --json prints the detected stack, services, health checks and deploy order without writing anything. Shape: JSON API.