@@ -33,8 +33,8 @@ cargo --version
3333git clone https://github.com/varshith-Git/Valori-Kernel.git
3434cd Valori-Kernel
3535
36- # Build every crate in the workspace
37- cargo build --workspace
36+ # Build all default crates (excludes valori-ffi which needs maturin)
37+ cargo build
3838
3939# Run the core test suite
4040cargo test -p valori-kernel -p valori-node
@@ -47,12 +47,40 @@ All tests should pass. On Linux, install `build-essential` / `gcc` if you hit a
4747## 2. Run a standalone node (the simplest start)
4848
4949``` bash
50- # In-memory, no persistence (fastest for dev)
50+ # In-memory only — no persistence, data lost on restart (fastest for dev/testing )
5151VALORI_DIM=128 cargo run -p valori-node
5252
53- # With WAL + snapshot ( survives restarts — recommended)
53+ # With WAL + snapshot — data survives restarts ( recommended for real work )
5454VALORI_DIM=128 \
55- VALORI_EVENT_LOG_PATH=/tmp/valori.log \
55+ VALORI_EVENT_LOG_PATH=/tmp/valori-events.log \
56+ VALORI_SNAPSHOT_PATH=/tmp/valori.snap \
57+ cargo run -p valori-node
58+
59+ # With auth token — all endpoints require "Authorization: Bearer <token>"
60+ VALORI_DIM=128 \
61+ VALORI_EVENT_LOG_PATH=/tmp/valori-events.log \
62+ VALORI_SNAPSHOT_PATH=/tmp/valori.snap \
63+ VALORI_AUTH_TOKEN=mysecrettoken \
64+ cargo run -p valori-node
65+
66+ # HNSW index instead of brute-force (faster search, uses more RAM)
67+ VALORI_DIM=128 \
68+ VALORI_INDEX=hnsw \
69+ VALORI_EVENT_LOG_PATH=/tmp/valori-events.log \
70+ VALORI_SNAPSHOT_PATH=/tmp/valori.snap \
71+ cargo run -p valori-node
72+
73+ # Custom port
74+ VALORI_DIM=128 \
75+ VALORI_BIND=0.0.0.0:8080 \
76+ cargo run -p valori-node
77+
78+ # With embedding provider (enables POST /v1/ingest — chunk+embed+insert in one call)
79+ VALORI_DIM=768 \
80+ VALORI_EMBED_PROVIDER=ollama \
81+ VALORI_EMBED_MODEL=nomic-embed-text \
82+ VALORI_EMBED_URL=http://localhost:11434 \
83+ VALORI_EVENT_LOG_PATH=/tmp/valori-events.log \
5684VALORI_SNAPSHOT_PATH=/tmp/valori.snap \
5785cargo run -p valori-node
5886```
@@ -72,6 +100,15 @@ curl -s -X POST http://localhost:3000/records \
72100curl -s -X POST http://localhost:3000/search \
73101 -H " Content-Type: application/json" \
74102 -d ' {"query": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8], "k": 5}' | jq .
103+
104+ # Proof — BLAKE3 state hash (same on every machine for the same data)
105+ curl -s http://localhost:3000/v1/proof/state | jq .
106+
107+ # List collections
108+ curl -s http://localhost:3000/v1/namespaces | jq .
109+
110+ # Wipe and start fresh (in-memory node: just restart; persisted node: delete files)
111+ rm -f /tmp/valori-events.log /tmp/valori.snap
75112```
76113
77114> ** ` VALORI_DIM ` is immutable after the first insert.** Set it once and never change it for the same data directory.
@@ -123,27 +160,88 @@ npm start
123160
124161---
125162
126- ## 5. Local 3-node cluster (Docker)
163+ ## 5. Local 3-node cluster
164+
165+ ### Option A — Docker (easiest)
127166
128167``` bash
129168# Start 3 nodes + bootstrap automatically
130- docker compose up -d
169+ docker compose -f docker-compose.cluster.yml up -d
131170
132171# Wait ~3 seconds for the leader election, then check
133172curl http://localhost:3001/health
134173curl http://localhost:3001/v1/cluster/status | jq .
135174```
136175
137- | Node | HTTP port | Raft gRPC port |
176+ Tear down and wipe volumes:
177+
178+ ``` bash
179+ docker compose -f docker-compose.cluster.yml down -v
180+ ```
181+
182+ ### Option B — Raw ` cargo run ` (no Docker)
183+
184+ Open ** 3 separate terminal tabs** in the repo root.
185+
186+ ** Tab 1 — node 1 (bootstrap leader)**
187+ ``` bash
188+ VALORI_NODE_ID=1 \
189+ VALORI_CLUSTER_INIT=1 \
190+ VALORI_CLUSTER_MEMBERS=" 1=127.0.0.1:3101/127.0.0.1:3001,2=127.0.0.1:3102/127.0.0.1:3002,3=127.0.0.1:3103/127.0.0.1:3003" \
191+ VALORI_BIND=0.0.0.0:3001 \
192+ VALORI_RAFT_BIND=0.0.0.0:3101 \
193+ VALORI_RAFT_LOG_PATH=/tmp/valori-n1.redb \
194+ VALORI_EVENT_LOG_PATH=/tmp/valori-n1-events.log \
195+ VALORI_SNAPSHOT_PATH=/tmp/valori-n1.snap \
196+ VALORI_DIM=128 \
197+ cargo run -p valori-node
198+ ```
199+
200+ ** Tab 2 — node 2**
201+ ``` bash
202+ VALORI_NODE_ID=2 \
203+ VALORI_CLUSTER_MEMBERS=" 1=127.0.0.1:3101/127.0.0.1:3001,2=127.0.0.1:3102/127.0.0.1:3002,3=127.0.0.1:3103/127.0.0.1:3003" \
204+ VALORI_BIND=0.0.0.0:3002 \
205+ VALORI_RAFT_BIND=0.0.0.0:3102 \
206+ VALORI_RAFT_LOG_PATH=/tmp/valori-n2.redb \
207+ VALORI_EVENT_LOG_PATH=/tmp/valori-n2-events.log \
208+ VALORI_SNAPSHOT_PATH=/tmp/valori-n2.snap \
209+ VALORI_DIM=128 \
210+ cargo run -p valori-node
211+ ```
212+
213+ ** Tab 3 — node 3**
214+ ``` bash
215+ VALORI_NODE_ID=3 \
216+ VALORI_CLUSTER_MEMBERS=" 1=127.0.0.1:3101/127.0.0.1:3001,2=127.0.0.1:3102/127.0.0.1:3002,3=127.0.0.1:3103/127.0.0.1:3003" \
217+ VALORI_BIND=0.0.0.0:3003 \
218+ VALORI_RAFT_BIND=0.0.0.0:3103 \
219+ VALORI_RAFT_LOG_PATH=/tmp/valori-n3.redb \
220+ VALORI_EVENT_LOG_PATH=/tmp/valori-n3-events.log \
221+ VALORI_SNAPSHOT_PATH=/tmp/valori-n3.snap \
222+ VALORI_DIM=128 \
223+ cargo run -p valori-node
224+ ```
225+
226+ ** Start node 1 first** , wait for ` "Raft initialized" ` in its log, then start nodes 2 and 3.
227+
228+ ** Verify from any terminal:**
229+ ``` bash
230+ curl http://localhost:3001/health
231+ curl http://localhost:3001/v1/cluster/status | jq .
232+ ```
233+
234+ ** Port layout:**
235+
236+ | Node | HTTP | Raft gRPC |
138237| ---| ---| ---|
139238| node-1 | 3001 | 3101 |
140239| node-2 | 3002 | 3102 |
141240| node-3 | 3003 | 3103 |
142241
143- Tear down and wipe volumes:
144-
242+ ** Wipe and restart cleanly:**
145243``` bash
146- docker compose down -v
244+ rm -f /tmp/valori-n{1,2,3}.{redb,snap} /tmp/valori-n{1,2,3}-events.log
147245```
148246
149247---
0 commit comments