From 5ad9d9093fcbe7037e5474a9d8fa20a0b64fb79a Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 25 Feb 2026 15:07:40 +0000 Subject: drop nostr-db backend support, keep only lmdb and memory --- docs/explanation/architecture.md | 2 +- docs/explanation/comparison.md | 10 +++++----- docs/explanation/deletion-requests.md | 2 +- docs/how-to/deploy.md | 4 ++-- docs/learnings/grasp-01-implementation.md | 4 ++-- docs/reference/configuration.md | 28 +++++++++++----------------- 6 files changed, 22 insertions(+), 28 deletions(-) (limited to 'docs') diff --git a/docs/explanation/architecture.md b/docs/explanation/architecture.md index e101425..e0a57e5 100644 --- a/docs/explanation/architecture.md +++ b/docs/explanation/architecture.md @@ -101,7 +101,7 @@ After examining both the reference implementation and HTTP server options, we ha - Initialize configuration from environment (clap + dotenvy) - Set up Hyper HTTP server with request routing - Initialize Nostr relay builder with custom [`Nip34WritePolicy`](src/nostr/builder.rs:51) -- Set up shared storage (LMDB, NostrDB, or Memory) +- Set up shared storage (LMDB or Memory) - Handle WebSocket upgrades for Nostr relay - Handle graceful shutdown diff --git a/docs/explanation/comparison.md b/docs/explanation/comparison.md index 090e0eb..315f091 100644 --- a/docs/explanation/comparison.md +++ b/docs/explanation/comparison.md @@ -11,7 +11,7 @@ This document compares ngit-grasp (this project) with ngit-relay (the reference | **Git Protocol** | git-http-backend (C via fcgiwrap) | HTTP layer in Rust + git subprocess | | **Authorization** | Pre-receive Git hook | Inline HTTP handler validation | | **Nostr Relay** | Khatru (Go library) | nostr-relay-builder (Rust library) | -| **Event Store** | Badger (Go KV database) | LMDB or NostrDB (Rust) | +| **Event Store** | Badger (Go KV database) | LMDB (Rust) | | **Proactive Sync** | Git-only (polls DB + fetches from git servers) | Nostr event sync + git sync (event-driven) | | **Process Management** | supervisord (4 processes) | Single tokio runtime | | **Packaging** | Docker with supervisord | Single static binary or Docker | @@ -78,7 +78,7 @@ This document compares ngit-grasp (this project) with ngit-relay (the reference │ │ │ │ builder library) │ │ │ │ - info/refs │ │ - NIP-34 Policy │ │ │ │ - upload-pk │◀─────┤ (inline query) │ │ -│ │ - receive-pk │ auth │ - LMDB/NostrDB │ │ +│ │ - receive-pk │ auth │ - LMDB/Memory │ │ │ │ + inline │ check│ - WebSocket │ │ │ │ validation │ │ - NIP-11 endpoint │ │ │ └──────┬───────┘ └──────────┬─────────┘ │ @@ -100,7 +100,7 @@ This document compares ngit-grasp (this project) with ngit-relay (the reference │ │ │ ┌──────────────────────────────────────────────────┐ │ │ │ Shared State (Arc) │ │ -│ │ - Database (LMDB/NostrDB/Memory) │ │ +│ │ - Database (LMDB/Memory) │ │ │ │ - Purgatory (DashMap - concurrent queue) │ │ │ │ - Metrics (Prometheus) │ │ │ └──────────────────────────────────────────────────┘ │ @@ -161,7 +161,7 @@ This is why ngit-grasp has ~13x more code - the majority is implementing GRASP-0 | Feature | ngit-relay | ngit-grasp | |---------|-----------|-----------| | **Implementation** | Khatru (Go library) | nostr-relay-builder (Rust library) | -| **Database** | Badger (Go KV store) | LMDB or NostrDB (Rust) | +| **Database** | Badger (Go KV store) | LMDB (Rust) | | **Process** | Separate process on :3334 | Integrated (same binary) | | **Policies** | Go functions in `policies.go` | Rust traits (modular sub-policies) | | **Event Validation** | Single function with branches | 4 separate policy modules | @@ -287,7 +287,7 @@ For users of ngit-relay, migration to ngit-grasp involves: ### Data Migration -1. **Events**: Export from Badger → Import to LMDB/NostrDB +1. **Events**: Export from Badger → Import to LMDB - No direct migration tool yet (would need to be built) - Alternative: Use proactive sync to re-fetch from other relays 2. **Git Repositories**: Direct copy (same structure) diff --git a/docs/explanation/deletion-requests.md b/docs/explanation/deletion-requests.md index 7660774..4b4cd88 100644 --- a/docs/explanation/deletion-requests.md +++ b/docs/explanation/deletion-requests.md @@ -28,7 +28,7 @@ The deletion system uses three separate data stores: ┌─────────────────────────────────────────────────────────┐ │ Main Database │ │ (Live events - actively served) │ -│ LMDB/NostrDB/Memory backend │ +│ LMDB/Memory backend │ └─────────────────────────────────────────────────────────┘ ↓ deletion request ┌─────────────────────────────────────────────────────────┐ diff --git a/docs/how-to/deploy.md b/docs/how-to/deploy.md index 157e5f8..9117fe2 100644 --- a/docs/how-to/deploy.md +++ b/docs/how-to/deploy.md @@ -233,7 +233,7 @@ git ls-remote https://ngit.example.com//.git ### Storage - `dataDir` - Base directory for data (default: /var/lib/ngit-grasp-{name}) -- `databaseBackend` - "lmdb" | "nostr-db" | "memory" (default: "lmdb") +- `databaseBackend` - "lmdb" | "memory" (default: "lmdb") ### Identity - `relayName` - Relay name for NIP-11 (default: "{domain} grasp relay") @@ -363,7 +363,7 @@ curl http://localhost:8082/metrics **Tune configuration:** - Reduce `metricsTopNRepos` - Increase `syncMaxBackoffSecs` -- Switch to `databaseBackend = "nostr-db"` for better performance +- Tune `syncMaxBackoffSecs` for your network conditions --- diff --git a/docs/learnings/grasp-01-implementation.md b/docs/learnings/grasp-01-implementation.md index 27124af..f893d78 100644 --- a/docs/learnings/grasp-01-implementation.md +++ b/docs/learnings/grasp-01-implementation.md @@ -20,7 +20,7 @@ |-----------|--------|-----------| | HTTP Server | Hyper (not actix-web) | Better control over WebSocket upgrade handling | | Nostr Relay | nostr-relay-builder | Mature, well-tested, supports custom policies | -| Database | LMDB (default), NostrDB, Memory | LMDB for production, Memory for testing | +| Database | LMDB (default), Memory | LMDB for production, Memory for testing | | Configuration | clap + dotenvy | CLI flags > env vars > .env > defaults | --- @@ -125,7 +125,7 @@ The decision to validate pushes **before** spawning git-receive-pack worked extr Using rust-nostr's relay builder was the right call: - Handles NIP-01 protocol correctly - Custom `WritePolicy` trait for our validation -- Database abstraction (LMDB, NostrDB, Memory) +- Database abstraction (LMDB, Memory) - Active maintenance and updates ### 3. Separate Audit Tool diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index b09b20f..a05aeee 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -245,44 +245,38 @@ NGIT_RELAY_DATA_PATH=/mnt/ssd/relay-data #### `NGIT_DATABASE_BACKEND` **Description:** Database backend type for storing Nostr events -**Type:** String (enum: memory, nostrdb, lmdb) -**Default:** `memory` +**Type:** String (enum: memory, lmdb) +**Default:** `lmdb` **Required:** No **Valid Values:** -- `memory` - In-memory database (default, fastest, no persistence) -- `nostrdb` - NostrDB backend (persistent, optimized for Nostr) [Not yet implemented] -- `lmdb` - LMDB backend (persistent, general purpose) [Not yet implemented] +- `lmdb` - LMDB backend (persistent, general purpose) +- `memory` - In-memory database (fastest, no persistence) **Examples:** ```bash -# Development (default, no persistence) -NGIT_DATABASE_BACKEND=memory - -# Production with NostrDB (when implemented) -NGIT_DATABASE_BACKEND=nostrdb - -# Production with LMDB (when implemented) +# Production (default, persistent) NGIT_DATABASE_BACKEND=lmdb + +# Development/testing (no persistence) +NGIT_DATABASE_BACKEND=memory ``` **Comparison:** | Backend | Persistence | Performance | Use Case | | ------- | ----------- | ----------- | ---------------------------- | -| memory | No | Fastest | Development, testing | -| nostrdb | Yes | High | Production (Nostr-optimized) | | lmdb | Yes | High | Production (general purpose) | +| memory | No | Fastest | Development, testing | **Notes:** - `memory` backend loses all data on restart -- NostrDB and LMDB backends will use `NGIT_RELAY_DATA_PATH` for storage -- NostrDB and LMDB are planned features, not yet available +- `lmdb` backend uses `NGIT_RELAY_DATA_PATH` for storage - Default `memory` backend suitable for development and testing only -- Production deployments should use persistent backends when available +- Production deployments should use `lmdb` --- -- cgit v1.2.3