Skip to content

bootstrap — Architecture

The @mnemose/bootstrap package is the single source of truth for Mnemose deployment topology and the shared bootstrap planning/execution engine used by the CLI, gateway, and command handlers during tenant and cloud-project onboarding.

Responsibilities

  • Define the CoreManifest — tenant IDs, Pub/Sub topic + subscription names, and the required core kernel entries (diagnostics, operations) for an environment
  • Export coreManifestForEnv(env) returning the manifest for development, staging, or production
  • Provide assessCoreHealth(manifest, rows) — a pure function (no DB, no I/O) that compares the manifest’s expected kernel entries against the enrolled kernel rows, returning a per-kernel health status used by the gateway platformCore resolver and the Fleet UI
  • Provide bootstrap plan + execution helpers (createBootstrapOrganizationPlan, createBootstrapCloudProjectPlan, createBootstrapLocalPlan, and their execute* counterparts) that translate BootstrapOrganization / BootstrapCloudProject commands into WIF/IAM/resource steps

Key Components

FileRole
src/core-manifest.tsCoreManifest type, coreManifestForEnv(), and the dev/staging/production manifest constants
src/core-health.tsassessCoreHealth() pure function and CoreHealth / CoreKernelStatus result types
src/index.tsRe-exports manifest + health, and hosts the bootstrap planning/execution helpers

Dependencies

  • @mnemose/cloud-adapters — GCP IAM/resource ports used by the bootstrap executors
  • @mnemose/db — bootstrapStates table and DbClient for persisting bootstrap run status
  • @mnemose/domain — BootstrapOrganizationCommand, BootstrapCloudProjectCommand schemas
  • google-auth-library — ADC-based GCP credential resolution

Data Flow

CLI / gateway / command handler
↓ coreManifestForEnv(env) → CoreManifest (tenant IDs, topics, kernels)
↓ assessCoreHealth(manifest, agent_kernels rows) → CoreHealth
↓ createBootstrap*Plan(command) → plan
↓ execute*Plan(plan) → WIF pool/provider creation, IAM bindings, state persistence

The manifest is consumed by Pulumi (infra/), the compose-bootstrap script (scripts/compose-bootstrap.mjs), the gateway platformCore resolver, and the Fleet UI. Changing the manifest requires updating every downstream consumer — see docs/architecture.md.