Draft

svc-ncu — NCU Controller

Clientnovameraactive

FastAPI backend that drives the NBIT downhole tool through a full DAQ → QC → upload workflow. Runs in two modes: field (on hardened operator laptops at drill sites) and hosted simulator (ECS Fargate, paired with svc-nbit-sim for QA).

flowchart LR
    subgraph Field["Field laptop"]
        CLI["ncu CLI
(Typer)"] --> NCU["svc-ncu
FastAPI"] NCU --> SM["15-state machine"] end subgraph Hosted["ECS Fargate (QA)"] NCU2["svc-ncu"] --> SIM["svc-nbit-sim
digital twin"] SIM --> NCU2 end NBIT["NBIT downhole tool"] --> NCU NCU --> NBIT NCU -->|ZIP upload| S3[(S3)] S3 --> QC[svc-qc] style NCU fill:#EDEDFF,stroke:#3B54F7 style NCU2 fill:#EDEDFF,stroke:#3B54F7 style SIM fill:#E4E4FF,stroke:#23233A
  • State machine: 15 states via the transitions library (connect → start-run → download → run-qc → upload → complete).
  • Operator CLI: ncu command (Typer) — connect, start-run, stop-run, download, run-qc, upload, complete, update/rollback.
  • Updates: ncu update writes a signal file read by ncu-updater.timer systemd service; --direct runs docker pull immediately.
  • Field release: push a semver tag (v1.2.0) → release-field.yml builds multi-arch (amd64 + arm64) image → ECR.
  • Hosted release: deploy.yml → ECS deploy (dev1 / stg1 / prd1).
  • Built on: the ecs-service pattern for the hosted tier.