Build and Operations¶
Scope¶
This runbook describes local single-machine operation using the Rust workspace and moraine as the primary lifecycle interface.
Build¶
This produces binaries for:
morainemoraine-ingestmoraine-monitormoraine-mcp
Install Runtime Binaries From Source¶
Cargo install¶
git clone https://github.com/eric-tramel/moraine.git ~/src/moraine
cd ~/src/moraine
for crate in moraine moraine-ingest moraine-monitor moraine-mcp; do
cargo install --path "apps/$crate" --locked
done
Or install directly from GitHub without cloning:
for bin in moraine moraine-ingest moraine-monitor moraine-mcp; do
cargo install --git https://github.com/eric-tramel/moraine.git \
--package "$bin" \
--bin "$bin" \
--locked
done
Prebuilt release binary¶
curl -fsSL https://raw.githubusercontent.com/eric-tramel/moraine/main/scripts/install.sh \
| bash
export PATH="$HOME/.local/bin:$PATH"
The installer fetches a full bundle (moraine, moraine-ingest, moraine-monitor, moraine-mcp) and overwrites binaries in place in a single bin directory.
Install directory precedence:
MORAINE_INSTALL_DIRXDG_BIN_HOME$(dirname "$XDG_DATA_HOME")/bin~/.local/bin
The installer writes a receipt at ${XDG_CONFIG_HOME:-~/.config}/moraine/install-receipt.json.
Installer environment configuration:
MORAINE_INSTALL_REPO(defaulteric-tramel/moraine)MORAINE_INSTALL_VERSION(defaultlatest)MORAINE_INSTALL_ASSET_BASE_URL(requiresMORAINE_INSTALL_VERSIONto be a non-latesttag)MORAINE_INSTALL_SKIP_CLICKHOUSE(1|true|yes|onskips managed ClickHouse install)
Publish prebuilt binaries¶
Tag-driven GitHub Actions release workflow:
- Push a semantic tag (example:
v0.3.1). - Workflow
.github/workflows/release-moraine.ymlbuilds: x86_64-unknown-linux-gnuaarch64-unknown-linux-gnuaarch64-apple-darwin- Uploads
moraine-bundle-<target>.tar.gzplusmoraine-bundle-<target>.sha256to the tag release.
Each bundle includes manifest.json with target/version metadata, per-binary checksums, and build metadata.
Multiplatform functional CI (.github/workflows/ci-functional.yml) also packages per-target bundles and validates scripts/install.sh by installing from a local artifact server before running the stack + MCP smoke test.
Config model¶
Use one shared config schema at config/moraine.toml.
Resolution precedence:
--config <path>- env override (
MORAINE_CONFIG, plusMORAINE_MCP_CONFIGfor MCP) ~/.moraine/config.toml(if present)- repo default
config/moraine.toml
Start stack¶
moraine up does the following:
- Starts ClickHouse process.
- Waits for DB health.
- Applies versioned migrations through
moraine-clickhouse(schema_migrationsledger). - Starts ingest and optional services from
runtimeconfig.
It auto-installs managed ClickHouse when missing and runtime.clickhouse_auto_install=true.
moraine clickhouse status reports managed install state, active binary source (managed vs PATH), installed version, and checksum state.
DB lifecycle¶
db doctor checks:
- ClickHouse health/version.
- Database existence.
- Applied vs pending migrations.
- Required table presence.
Service entrypoints¶
cd ~/src/moraine
bin/moraine run ingest
bin/moraine run monitor
bin/moraine run mcp
bin/moraine run clickhouse
Replay latency benchmark¶
Use the replay benchmark to measure current MCP search latency against recent worst-case telemetry:
For workload inspection only, run with --dry-run.
Detailed options, output fields, and troubleshooting are in operations/replay-search-latency-benchmark.md.
Status, logs, shutdown¶
cd ~/src/moraine
bin/moraine status
bin/moraine status --output rich --verbose
bin/moraine status --output json
bin/moraine logs
bin/moraine logs ingest --lines 200 --output plain
bin/moraine down
Status includes process state, DB health/schema checks, and latest ingest heartbeat metrics.
bin/moraine logs clickhouse reads ClickHouse's internal rotating log at
~/.moraine/clickhouse/log/clickhouse-server.log.
All subcommands support output control:
--output auto|rich|plain|json(defaultauto, rich on TTY).--verbosefor expanded diagnostics in rich/plain output.
Legacy scripts¶
Legacy lifecycle aliases remain as fail-fast migration stubs with a moraine replacement hint:
bin/start-clickhousebin/init-dbbin/statusbin/stop-all
Legacy wrappers remain only as fail-fast stubs:
bin/start-ingestor->bin/moraine upbin/run-codex-mcp->bin/moraine run mcpbin/moraine-monitor->bin/moraine run monitor
Failure triage¶
- If
upfails before migration, runbin/moraine db doctorand inspect ClickHouse logs viabin/moraine logs clickhouse. - If ingest stalls, run
bin/moraine statusand confirm heartbeat recency/queue depth. - If monitor APIs degrade, run
bin/moraine run monitorin foreground for direct error output. - If MCP retrieval degrades, verify
search_*tables in doctor output and rerundb migrate.