Add FastAPI dashboard MVP
This commit is contained in:
86
RUNBOOK.md
Normal file
86
RUNBOOK.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# Second-Brain 2.0 (Grundversion) — Runbook
|
||||
|
||||
This is the operational quick-reference for the shipped systemd timers/services and the optional FastAPI dashboard backend.
|
||||
|
||||
Repository root (on host): `/root/.openclaw/workspace`
|
||||
|
||||
## Systemd units (cron jobs)
|
||||
|
||||
Unit files are shipped in `systemd/` (repo root). Install them into `/etc/systemd/system/` (symlink or copy), then reload:
|
||||
|
||||
```bash
|
||||
sudo ln -sf /root/.openclaw/workspace/systemd/openclaw-secondbrain-*.service /etc/systemd/system/
|
||||
sudo ln -sf /root/.openclaw/workspace/systemd/openclaw-secondbrain-*.timer /etc/systemd/system/
|
||||
sudo ln -sf /root/.openclaw/workspace/systemd/openclaw-memory-archive.* /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
Enable timers:
|
||||
|
||||
```bash
|
||||
sudo systemctl enable --now openclaw-secondbrain-ingest-memory.timer
|
||||
sudo systemctl enable --now openclaw-secondbrain-index-vectors.timer
|
||||
sudo systemctl enable --now openclaw-secondbrain-review.timer
|
||||
sudo systemctl enable --now openclaw-secondbrain-backup.timer
|
||||
sudo systemctl enable --now openclaw-secondbrain-heartbeat.timer
|
||||
sudo systemctl enable --now openclaw-secondbrain-proactive-search.timer
|
||||
sudo systemctl enable --now openclaw-memory-archive.timer
|
||||
|
||||
# Optional (Obsidian coupling)
|
||||
sudo systemctl enable --now openclaw-secondbrain-ingest-obsidian.timer
|
||||
sudo systemctl enable --now openclaw-secondbrain-export-obsidian.timer
|
||||
```
|
||||
|
||||
Verify scheduling:
|
||||
|
||||
```bash
|
||||
sudo systemctl list-timers --all | grep -E 'openclaw-(secondbrain|memory-archive)' || true
|
||||
```
|
||||
|
||||
Run a job once:
|
||||
|
||||
```bash
|
||||
sudo systemctl start openclaw-secondbrain-ingest-memory.service
|
||||
sudo systemctl status openclaw-secondbrain-ingest-memory.service --no-pager
|
||||
sudo journalctl -u openclaw-secondbrain-ingest-memory.service -n 200 --no-pager
|
||||
```
|
||||
|
||||
Wrapper logs:
|
||||
|
||||
```bash
|
||||
tail -n 200 /root/.openclaw/workspace/cron_wrapper.log
|
||||
```
|
||||
|
||||
## FastAPI dashboard (manual start)
|
||||
|
||||
FastAPI entrypoint:
|
||||
|
||||
```bash
|
||||
cd /root/.openclaw/workspace
|
||||
python3 -m pip install -r second-brain/requirements-dashboard.txt
|
||||
SECOND_BRAIN_WORKSPACE="/root/.openclaw/workspace/second-brain" python3 second-brain/fastapi_app.py
|
||||
```
|
||||
|
||||
Default port is `8501` (same as Streamlit default). Do not run both on the same port.
|
||||
|
||||
Endpoint smoke tests:
|
||||
|
||||
```bash
|
||||
curl -fsS http://127.0.0.1:8501/api/stats
|
||||
curl -fsS "http://127.0.0.1:8501/api/engrams?limit=1&offset=0"
|
||||
curl -fsS "http://127.0.0.1:8501/api/search?q=test&limit=1"
|
||||
```
|
||||
|
||||
## DB quick check
|
||||
|
||||
```bash
|
||||
python3 - <<'PY'
|
||||
import sqlite3
|
||||
db="/root/.openclaw/workspace/second-brain/data/brain.sqlite"
|
||||
con=sqlite3.connect(db)
|
||||
cur=con.cursor()
|
||||
print(cur.execute("PRAGMA integrity_check").fetchone()[0])
|
||||
print("engrams:", cur.execute("SELECT COUNT(*) FROM engrams").fetchone()[0])
|
||||
con.close()
|
||||
PY
|
||||
```
|
||||
Reference in New Issue
Block a user