Skip to content

M19 — operational hardening: Docker cluster, observability stack, chaos tests#5

Merged
naveed949 merged 1 commit into
mainfrom
claude/operational-hardening
Jun 22, 2026
Merged

M19 — operational hardening: Docker cluster, observability stack, chaos tests#5
naveed949 merged 1 commit into
mainfrom
claude/operational-hardening

Conversation

@naveed949

@naveed949 naveed949 commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

Makes the POC runnable and demoable as a real multi-node cluster, and exercises the HTTP transport that nothing tested before. Operational only — no consensus-core changes. Builds on the merged M11–M18 work (#4).

Docker / cluster

  • Multi-stage Dockerfile (build on node:20 → prod-pruned run on node:20-slim) + .dockerignore.
  • docker-compose.yml: a 3-node book-service cluster wired via NODE_ID/PORT/PEERS/ADVERTISE_URL/DATA_DIR (PEERS excludes self, ADVERTISE_URL uses compose DNS names), named per-node volumes, and a /ready healthcheck.

Observability stack

  • Prometheus (deploy/prometheus.yml) scraping all three nodes' /metrics — avoids a target node label since the app already emits node="<id>".
  • Grafana provisioning (datasource + dashboard provider) and a raft-cluster dashboard wired to the real metric names: leadership/cluster size, commit/apply progress, elections, replication lag, HTTP throughput + p95 latency, read barriers and follower reads.

Fault-injection over the real HttpTransport

  • tests/chaos.test.ts spins up a 3-node cluster on actual HTTP sockets (two-pass ephemeral-port allocation, stdlib http client, no new deps) and covers:
    1. single leader election,
    2. a replicated write readable on a different node,
    3. leader-failure recovery + a new commit through the surviving majority,
    4. partition tolerance (majority commits, isolated minority cannot, then heals and converges),
    5. a strong (ReadIndex) linearizable read.
    • Teardown stops every node and closes every server (no leaked handles under --detectOpenHandles --forceExit).

Docs

  • docs/OPERATIONS.md (run the cluster, hit the API, change membership, scrape metrics, open Grafana) + a README pointer.

Verification

  • npx tsc --noEmit clean.
  • Chaos suite stable across repeated runs (3× here + 6× by the implementer).
  • Full suite green: 25 suites / 201 tests.
  • docker compose config validates and the Grafana dashboard JSON parses.
  • ⚠️ An end-to-end docker compose up --build (image build + cluster boot) was not run — no Docker daemon in the sandbox. Worth a local smoke test.

🤖 Generated with Claude Code


Generated by Claude Code

…, chaos tests)

Make the POC runnable and demoable as a real multi-node cluster, and exercise the
HTTP transport that nothing tested before. Operational only — no consensus-core
changes.

Docker / cluster:
- Multi-stage Dockerfile (build on node:20 → prod-pruned run on node:20-slim) and
  a .dockerignore.
- docker-compose.yml: a 3-node book-service cluster wired via NODE_ID/PORT/PEERS/
  ADVERTISE_URL/DATA_DIR (PEERS excludes self, ADVERTISE_URL uses compose DNS),
  named per-node volumes, and a /ready healthcheck.

Observability stack:
- Prometheus (deploy/prometheus.yml) scraping all three nodes' /metrics; avoids a
  target `node` label since the app already emits node="<id>".
- Grafana provisioning (datasource + dashboard provider) and a raft-cluster
  dashboard wired to the real metric names: leadership/cluster size, commit/apply
  progress, elections, replication lag, HTTP throughput/p95 latency, read barriers
  and follower reads.

Fault-injection over the REAL HttpTransport:
- tests/chaos.test.ts spins up a 3-node cluster on actual HTTP sockets (two-pass
  ephemeral-port allocation, stdlib http client, no new deps) and covers: single
  leader election, replicated write readable on another node, leader-failure
  recovery + new commit, partition tolerance (majority commits / isolated minority
  cannot, then heals), and a strong (ReadIndex) read — with teardown that stops
  every node and closes every server.

Docs: docs/OPERATIONS.md (run the cluster, hit the API, change membership, scrape
metrics, open Grafana) plus a README pointer.

Verified: tsc --noEmit clean; chaos suite stable across repeated runs; full suite
green (25 suites / 201 tests). `docker compose config` validates; an end-to-end
image build/boot was not run (no Docker daemon in CI sandbox).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01NneoGGKxBp5ZExL7D7i1Lu
@naveed949
naveed949 changed the base branch from claude/runtime-productionization to main June 21, 2026 20:05
@naveed949
naveed949 marked this pull request as ready for review June 22, 2026 11:41
@naveed949
naveed949 merged commit fea20da into main Jun 22, 2026
@naveed949
naveed949 deleted the claude/operational-hardening branch June 23, 2026 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants