upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-12 20:30:13 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-12 20:30:13 +0000
commita12927181c571fc1641772ad44dd4c6a4ab209d9 (patch)
treed7cb99fa87606e9fb13d91305cda8a0f919e6528 /docs
parentc29191b1e1239e931c575a926ec9480e594476d6 (diff)
feat(grasp-05): add read-only mode with auto-enable for archive configs
Implements NGIT_ARCHIVE_READ_ONLY configuration option that defaults to true when archive mode is enabled, allowing relays to operate as read-only syncs of archived repositories. Key changes: - Add NGIT_ARCHIVE_READ_ONLY config option (defaults to true if archive enabled) - NIP-11 advertises GRASP-05 support and includes curation field when read-only - Validation logic rejects non-whitelisted repos in read-only mode - Comprehensive tests for read-only behavior and defaults - Full documentation in config reference, .env.example, and NixOS module Read-only mode enables passive mirroring without being listed in announcements, useful for backup/archive operations while preventing accidental write acceptance.
Diffstat (limited to 'docs')
-rw-r--r--docs/explanation/grasp-05-archive.md25
-rw-r--r--docs/reference/configuration.md71
2 files changed, 91 insertions, 5 deletions
diff --git a/docs/explanation/grasp-05-archive.md b/docs/explanation/grasp-05-archive.md
index e43a87e..45481dd 100644
--- a/docs/explanation/grasp-05-archive.md
+++ b/docs/explanation/grasp-05-archive.md
@@ -35,14 +35,17 @@ Archive mode relaxes the "must list service" requirement for whitelisted reposit
35 35
36**Configuration:** 36**Configuration:**
37```bash 37```bash
38# Specific repos (safest) 38# Specific repos (safest) - read-only by default
39NGIT_ARCHIVE_WHITELIST=npub1torvalds.../linux,npub1satoshi.../bitcoin 39NGIT_ARCHIVE_WHITELIST=npub1torvalds.../linux,npub1satoshi.../bitcoin
40# NGIT_ARCHIVE_READ_ONLY defaults to true
40 41
41# All repos from trusted maintainers 42# All repos from trusted maintainers
42NGIT_ARCHIVE_WHITELIST=npub1alice...,npub1bob... 43NGIT_ARCHIVE_WHITELIST=npub1alice...,npub1bob...
44# NGIT_ARCHIVE_READ_ONLY defaults to true
43 45
44# Archive everything (⚠️ storage risk) 46# Archive everything (⚠️ storage risk)
45NGIT_ARCHIVE_ALL=true 47NGIT_ARCHIVE_ALL=true
48# NGIT_ARCHIVE_READ_ONLY defaults to true
46``` 49```
47 50
48### Validation Priority 51### Validation Priority
@@ -63,11 +66,21 @@ Archived repos use the same directory structure as hosted repos:
63<git_data_path>/ 66<git_data_path>/
64 npub1alice.../ 67 npub1alice.../
65 hosted-repo.git/ # Lists your service (writable) 68 hosted-repo.git/ # Lists your service (writable)
66 archived-repo.git/ # Whitelisted (read-only) 69 archived-repo.git/ # Whitelisted (read-only by default)
67``` 70```
68 71
69**No flags or metadata** - archive status determined dynamically from config + announcement contents. 72**No flags or metadata** - archive status determined dynamically from config + announcement contents.
70 73
74### Read-Only Mode
75
76By default, archive mode operates in read-only mode (`NGIT_ARCHIVE_READ_ONLY=true`):
77- Repository announcements are accepted per whitelist/archive-all configuration
78- The service is **not listed** in accepted announcements (passive sync only)
79- NIP-11 document advertises `GRASP-05` support
80- NIP-11 `curation` field indicates read-only sync scope:
81 - `"Read-only sync of all repositories found on network"` (if `NGIT_ARCHIVE_ALL=true`)
82 - `"Read-only sync of whitelisted repositories and maintainers"` (if whitelist configured)
83
71### Full Sync 84### Full Sync
72 85
73Archived repositories trigger complete GRASP-02 sync: 86Archived repositories trigger complete GRASP-02 sync:
@@ -129,12 +142,14 @@ Watch for:
129 142
130## Comparison: Hosted vs Archived 143## Comparison: Hosted vs Archived
131 144
132| Aspect | Hosted (GRASP-01) | Archived (GRASP-05) | 145| Aspect | Hosted (GRASP-01) | Archived (GRASP-05 Read-Only) |
133|--------|-------------------|---------------------| 146|--------|-------------------|-------------------------------|
134| Announcement must list you | ✅ Required | ❌ Whitelisted instead | 147| Announcement must list you | ✅ Required | ❌ Whitelisted instead |
135| Git pushes | ✅ Accepted | ❌ Rejected (read-only) | 148| Git pushes | ✅ Accepted | ❌ Rejected (read-only) |
136| GRASP-02 sync | ✅ Full sync | ✅ Full sync | 149| GRASP-02 sync | ✅ Full sync | ✅ Full sync |
137| Relay discovery | ✅ Listed | ❌ Not listed | 150| Relay discovery | ✅ Listed in announcements | ❌ Not listed (passive sync) |
151| NIP-11 supported_grasps | `["GRASP-01", "GRASP-02"]` | `["GRASP-01", "GRASP-05", "GRASP-02"]` |
152| NIP-11 curation field | `null` | Describes archive scope |
138| Use case | Hosting workspace | Backup/mirror | 153| Use case | Hosting workspace | Backup/mirror |
139 154
140## Related Documentation 155## Related Documentation
diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md
index 52418ad..4692600 100644
--- a/docs/reference/configuration.md
+++ b/docs/reference/configuration.md
@@ -574,6 +574,77 @@ NGIT_ARCHIVE_WHITELIST=npub1alice23...,npub1bob23.../linux,bitcoin-core
574 574
575--- 575---
576 576
577#### `NGIT_ARCHIVE_READ_ONLY`
578
579**Description:** Configure relay as read-only sync of archived repositories
580**Type:** Boolean
581**Default:** `true` if `NGIT_ARCHIVE_ALL` or `NGIT_ARCHIVE_WHITELIST` is set, `false` otherwise
582**Required:** No
583
584**Examples:**
585
586```bash
587# Explicitly enable (requires archive mode)
588NGIT_ARCHIVE_READ_ONLY=true
589
590# Explicitly disable (writable archive repos)
591NGIT_ARCHIVE_READ_ONLY=false
592
593# Automatic (default behavior)
594# - If NGIT_ARCHIVE_ALL or NGIT_ARCHIVE_WHITELIST is set → true
595# - Otherwise → false
596# NGIT_ARCHIVE_READ_ONLY=
597```
598
599**Behavior:**
600
601- When `true`:
602 - NIP-11 document includes `GRASP-05` in `supported_grasps`
603 - NIP-11 `curation` field describes the archive scope
604 - Repository announcements not listing this service are accepted per whitelist/archive-all
605- When `false`:
606 - Archive mode disabled (standard GRASP-01 operation)
607- When unset (default):
608 - Automatically `true` if archive mode configured
609 - Automatically `false` otherwise
610
611**Error Conditions:**
612
613```bash
614# ERROR: Cannot set read-only without archive config
615NGIT_ARCHIVE_READ_ONLY=true
616NGIT_ARCHIVE_ALL=false
617NGIT_ARCHIVE_WHITELIST=
618# → Server fails to start: "NGIT_ARCHIVE_READ_ONLY=true requires either
619# NGIT_ARCHIVE_ALL=true or NGIT_ARCHIVE_WHITELIST to be set"
620```
621
622**NIP-11 Impact:**
623
624When `NGIT_ARCHIVE_READ_ONLY=true`:
625- `supported_grasps`: includes `"GRASP-05"`
626- `curation`: Set to one of:
627 - `"Read-only sync of all repositories found on network"` (if `NGIT_ARCHIVE_ALL=true`)
628 - `"Read-only sync of whitelisted repositories and maintainers"` (if `NGIT_ARCHIVE_WHITELIST` set)
629
630**Use Cases:**
631
632```bash
633# Public archive of entire ecosystem
634NGIT_ARCHIVE_ALL=true
635NGIT_ARCHIVE_READ_ONLY=true # Default
636
637# Selective backup of critical projects
638NGIT_ARCHIVE_WHITELIST=npub1torvalds.../linux,npub1satoshi.../bitcoin
639NGIT_ARCHIVE_READ_ONLY=true # Default
640
641# Writable mirror (advanced, not typical)
642NGIT_ARCHIVE_WHITELIST=npub1alice...
643NGIT_ARCHIVE_READ_ONLY=false
644```
645
646---
647
577### Logging Configuration 648### Logging Configuration
578 649
579#### `RUST_LOG` 650#### `RUST_LOG`