← Back to Damru Overview
01 / LIFECYCLE & ORCHESTRATION

Workflow

Damru replaces scattered Flagsmith setup docs with a deterministic four-phase CLI workflow: parallel machine checks, profile-aware Docker orchestration, live flag verification, and atomic JSON reporting.

PHASE 01 — DIAGNOSE

Parallel Prerequisite & Runtime Checks

When you run damru check, the CLI executes environment and toolchain probes concurrently rather than failing on the first missing binary. Checks are defined declaratively as TOML manifests inside damru/checks/ ↗ and evaluated by damru/src/checks.rs ↗.

Each check inspects Docker Compose v2 availability, Node.js major version (≥ 24), npm (≥ 11.10), uv installation and version alignment with pre-commit, and host memory/CPU headroom. Results are classified into pass, warn, or fail so non-blocking warnings never halt local onboarding.

PHASE 02 — ORCHESTRATE

Profile Selection & Flagsmith Stack Setup

During damru setup, damru/src/runtime.rs ↗ inspects available host resources (or respects --profile low|default) to pick the right Docker Compose profile. Low-memory machines automatically skip heavy optional services so the core Flagsmith API and database start reliably.

Next, damru/src/envfile.rs ↗ safely hydrates local .env configuration from templates without overwriting existing secrets, and damru/src/orchestrator.rs ↗ invokes damru/api-Makefile.doctor.mk ↗ using argument-array subprocesses.

damru check --explain
damru setup --profile low
damru verify --json
PHASE 03 — VERIFY

End-to-End Live Flag Round-Trip

Container healthchecks alone do not prove Flagsmith can evaluate flags. The verify command in damru/src/main.rs ↗ and the TypeScript verifier in damru/ts-verify/src/index.ts ↗ perform a real REST API round-trip against localhost:8000.

Damru creates a temporary feature flag (e.g., doctor-tmp-<timestamp>), evaluates it for a synthetic identity via /api/v1/identities/, asserts the returned value matches, deletes the temporary flag, and confirms a subsequent lookup returns HTTP 404.

PHASE 04 — REPORT

Atomic Status & Deterministic CI Exit Codes

Every run writes an atomic, secret-redacted status.json snapshot via damru/src/report.rs ↗. Passing --json emits machine-readable diagnostics for CI pipelines and powers the GET /api/doctor/status endpoint.

Exit CodeStateMeaning in Local & CI Runs
0passAll prerequisite checks, setup steps, and live flag evaluation cleared
1warnNon-blocking warnings detected; Flagsmith stack remains usable
2failPrerequisite, Docker Compose, or live flag verification failed
3usageInvalid CLI arguments, unsafe remote URL, or missing config