-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfig-root.schema.json
More file actions
639 lines (625 loc) · 23.1 KB
/
config-root.schema.json
File metadata and controls
639 lines (625 loc) · 23.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
{
"$schema": "https://json-schema.org/draft-06/schema",
"$id": "https://harper.fast/schema/config-root.schema.json",
"title": "HarperDB Root Configuration",
"description": "JSON Schema for harperdb-config.yaml as documented in docs.html. This focuses on the primary, documented configuration sections and keys. Unknown properties are allowed for forward compatibility.",
"type": "object",
"properties": {
"rootPath": {
"type": "string",
"description": "Root folder where Harper persists data, config, logs, and components. Default: user's home directory"
},
"componentsRoot": {
"type": "string",
"description": "Path to the folder containing local component files. Default: <ROOTPATH>/components"
},
"http": {
"type": "object",
"description": "HTTP server configuration for the main component server.",
"additionalProperties": true,
"properties": {
"sessionAffinity": {
"description": "Route multiple requests from the same client to the same thread. Use 'ip' or a header name.",
"type": ["string", "null"]
},
"compressionThreshold": {
"type": "integer",
"minimum": 0,
"description": "Responses larger than this threshold (bytes) will be compressed for clients that accept compression. Default: 1200"
},
"cors": { "type": "boolean", "description": "Enable Cross Origin Resource Sharing. Default: true" },
"corsAccessList": {
"type": ["array", "null"],
"description": "List of allowed origins for CORS.",
"items": { "type": "string" }
},
"corsAccessControlAllowHeaders": {
"type": "string",
"description": "Comma-separated list of header keys for Access-Control-Allow-Headers on OPTIONS requests. Default: 'Accept, Content-Type, Authorization'"
},
"headersTimeout": {
"type": "integer",
"description": "Milliseconds to wait for complete HTTP headers. Default: 60000"
},
"maxHeaderSize": {
"type": "integer",
"description": "Maximum allowed size of HTTP headers in bytes. Default: 16394"
},
"requestQueueLimit": {
"type": "integer",
"description": "Max estimated request queue time (ms) before rejecting with 503. Default: 20000"
},
"keepAliveTimeout": { "type": "integer", "description": "Keep-alive inactivity timeout in ms. Default: 30000" },
"port": { "type": "integer", "description": "HTTP port. Default: 9926" },
"securePort": { "type": ["integer", "null"], "description": "HTTPS port. Requires valid certificate + key." },
"http2": { "type": "boolean", "description": "Enable HTTP/2. Default: false" },
"timeout": { "type": "integer", "description": "Request timeout (ms). Default: 120000" },
"mtls": {
"description": "Enable and configure mTLS authentication for HTTP.",
"oneOf": [
{ "type": "boolean" },
{
"type": "object",
"additionalProperties": false,
"properties": {
"user": {
"type": ["string", "null"],
"description": "Authenticate all authorized mTLS connections as this user. Default: common name from certificate or null to not auto-auth."
},
"required": {
"type": "boolean",
"description": "Require client certificates for all HTTP connections. Default: false"
},
"certificateVerification": {
"description": "Enable certificate revocation checking (CRL/OCSP).",
"oneOf": [
{ "type": "boolean" },
{
"type": "object",
"additionalProperties": false,
"properties": {
"failureMode": {
"type": "string",
"enum": ["fail-open", "fail-closed"],
"description": "Global behavior when verification fails. Default: 'fail-closed'"
},
"crl": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": { "type": "boolean", "description": "Enable CRL checking. Default: true" },
"timeout": {
"type": "number",
"description": "Max ms to wait for CRL download. Default: 10000"
},
"cacheTtl": { "type": "number", "description": "CRL cache TTL (ms). Default: 86400000" },
"gracePeriod": {
"type": "number",
"description": "Grace period after CRL nextUpdate (ms). Default: 86400000"
},
"failureMode": {
"type": "string",
"enum": ["fail-open", "fail-closed"],
"description": "CRL-specific failure mode. Default: 'fail-closed'"
}
}
},
"ocsp": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": { "type": "boolean", "description": "Enable OCSP checking. Default: true" },
"timeout": {
"type": "number",
"description": "Max ms to wait for OCSP response. Default: 5000"
},
"cacheTtl": {
"type": "number",
"description": "Cache TTL for successful OCSP (ms). Default: 3600000"
},
"errorCacheTtl": {
"type": "number",
"description": "Cache TTL for OCSP errors (ms). Default: 300000"
},
"failureMode": {
"type": "string",
"enum": ["fail-open", "fail-closed"],
"description": "OCSP-specific failure mode. Default: 'fail-closed'"
}
}
}
}
}
]
}
}
}
]
},
"logging": {
"allOf": [{ "$ref": "#/definitions/loggerConfig" }],
"properties": {
"timing": { "type": "boolean", "description": "Log timing information for HTTP requests." },
"headers": { "type": "boolean", "description": "Log HTTP headers (verbose)." },
"id": { "type": "boolean", "description": "Assign/log unique id per request." }
}
}
}
},
"threads": {
"type": "object",
"description": "Harper worker thread configuration.",
"additionalProperties": true,
"properties": {
"count": { "type": "number", "description": "Number of worker threads. Default: logical CPU count minus one" },
"debug": {
"oneOf": [
{ "type": "boolean" },
{
"type": "object",
"additionalProperties": false,
"properties": {
"port": { "type": "integer", "description": "Port for debugging the main thread (default 9229)" },
"startingPort": {
"type": "integer",
"description": "Starting port to assign unique debugging ports per thread"
},
"host": { "type": "string", "description": "Debug host interface (default 127.0.0.1)" },
"waitForDebugger": { "type": "boolean", "description": "Wait for debugger before starting" }
}
}
]
},
"maxHeapMemory": { "type": "number", "description": "Heap memory limit per thread (MB)." },
"heapSnapshotNearLimit": { "type": "boolean", "description": "Take a heap snapshot when near the heap limit." }
}
},
"replication": {
"type": "object",
"description": "Harper replication configuration for clustering and data replication.",
"additionalProperties": true,
"properties": {
"hostname": { "type": "string", "description": "Hostname of this Harper instance." },
"url": { "type": "string", "description": "URL of this Harper instance." },
"databases": {
"description": "Databases to replicate. '*' for all, array of names, or array with objects to mark sharded databases.",
"oneOf": [
{ "type": "string" },
{
"type": "array",
"items": {
"oneOf": [
{ "type": "string" },
{
"type": "object",
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"sharded": { "type": "boolean" }
},
"required": ["name"]
}
]
}
}
]
},
"routes": {
"type": "array",
"description": "Routes to connect to other nodes. Each route can be a string or an object with hostname, port, and optional startTime.",
"items": {
"oneOf": [
{ "type": "string" },
{
"type": "object",
"additionalProperties": false,
"properties": {
"hostname": { "type": "string" },
"port": { "type": "integer" },
"startTime": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 UTC start time to begin replication."
}
},
"required": ["hostname", "port"]
}
]
}
},
"startTime": { "type": "string", "format": "date-time", "description": "Start replication from this time." },
"revokedCertificates": {
"type": "array",
"items": { "type": "string" },
"description": "Array of revoked certificate serial numbers."
},
"port": { "type": "integer", "description": "Replication insecure port." },
"securePort": { "type": "integer", "description": "Replication secure port. Default: 9933" },
"enableRootCAs": {
"type": "boolean",
"description": "Verify certificates against Node.js bundled CA store. Default: true"
},
"mtls": {
"type": "object",
"description": "mTLS settings for replication connections (always required).",
"additionalProperties": true,
"properties": {
"certificateVerification": {
"description": "Enable certificate revocation checking (CRL/OCSP) for peer certificates.",
"oneOf": [
{ "type": "boolean" },
{
"type": "object",
"additionalProperties": false,
"properties": {
"failureMode": { "type": "string", "enum": ["fail-open", "fail-closed"] },
"crl": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": { "type": "boolean" },
"timeout": { "type": "number" },
"cacheTtl": { "type": "number" },
"gracePeriod": { "type": "number" },
"failureMode": { "type": "string", "enum": ["fail-open", "fail-closed"] }
}
},
"ocsp": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": { "type": "boolean" },
"timeout": { "type": "number" },
"cacheTtl": { "type": "number" },
"errorCacheTtl": { "type": "number" },
"failureMode": { "type": "string", "enum": ["fail-open", "fail-closed"] }
}
}
}
}
]
}
}
},
"blobTimeout": { "type": "number", "description": "Max time (ms) to wait for blob transfer. Default: 120000" },
"failOver": {
"type": "boolean",
"description": "Attempt fail-over to different node when unreachable. Default: true"
},
"shard": { "type": "integer", "description": "Shard id for this instance." },
"logging": { "$ref": "#/definitions/loggerConfig" }
}
},
"localStudio": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": { "type": "boolean", "description": "Enable local Harper Studio GUI. Default: false" }
}
},
"logging": {
"type": "object",
"description": "Logging configuration for Harper.",
"additionalProperties": true,
"properties": {
"auditLog": { "type": "boolean", "description": "Enable structured table transaction logging. Default: false" },
"file": { "type": "boolean", "description": "Log to file. Default: true" },
"auditRetention": {
"type": ["string", "number"],
"description": "Retention of audit logs (e.g. '3d'). Default: 3d"
},
"level": {
"type": "string",
"enum": ["trace", "debug", "info", "warn", "error", "fatal", "notify"],
"description": "Verbosity of text event logs. Default: warn"
},
"console": { "type": "boolean", "description": "Log console.* output to log file. Default: true" },
"root": { "type": "string", "description": "Directory where log files are written. Default: <ROOTPATH>/log" },
"path": { "type": "string", "description": "Log file path. Default: <ROOTPATH>/log/hdb.log" },
"rotation": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": { "type": "boolean", "description": "Enable log rotation. Default: true" },
"compress": { "type": "boolean", "description": "Compress rotated logs with gzip. Default: false" },
"interval": { "type": ["string", "null"], "description": "Time between rotations (e.g. '1D','6H','30M')." },
"maxSize": { "type": ["string", "null"], "description": "Max size before rotation (e.g. '100M', '1G')." },
"path": { "type": "string", "description": "Directory to store rotated logs. Default: <ROOTPATH>/log" }
}
},
"stdStreams": { "type": "boolean", "description": "Log to stdout/stderr. Default: false" },
"auditAuthEvents": {
"type": "object",
"additionalProperties": false,
"properties": {
"logFailed": { "type": "boolean", "description": "Log failed authentication events. Default: false" },
"logSuccessful": {
"type": "boolean",
"description": "Log successful authentication events. Default: false"
}
}
},
"external": {
"$ref": "#/definitions/loggerConfig",
"description": "Logging configuration for external components that use the logger API."
}
}
},
"authentication": {
"type": "object",
"description": "Default authentication settings.",
"additionalProperties": true,
"properties": {
"authorizeLocal": {
"type": "boolean",
"description": "Automatically authorize requests from loopback IP as superuser. Default: true"
},
"cacheTTL": { "type": "number", "description": "Milliseconds an authentication can be cached. Default: 30000" },
"enableSessions": { "type": "boolean", "description": "Enable cookie-based sessions. Default: true" },
"operationTokenTimeout": {
"type": "string",
"description": "Operation token expiry duration (e.g. '1d'). Default: 1d"
},
"refreshTokenTimeout": {
"type": "string",
"description": "Refresh token expiry duration (e.g. '1d'). Default: 1d"
},
"logging": { "$ref": "#/definitions/loggerConfig" }
}
},
"operationsApi": {
"type": "object",
"description": "Operations API configuration. Values default to http configuration when not provided.",
"additionalProperties": true,
"properties": {
"network": {
"type": "object",
"additionalProperties": true,
"properties": {
"cors": { "type": "boolean" },
"corsAccessList": { "type": ["array", "null"], "items": { "type": "string" } },
"domainSocket": {
"type": "string",
"description": "Unix domain socket path for CLI access. Default: <ROOTPATH>/hdb/operations-server"
},
"headersTimeout": { "type": "integer" },
"keepAliveTimeout": { "type": "integer" },
"port": { "type": "integer", "description": "Operations API HTTP port. Default: 9925" },
"securePort": { "type": ["integer", "null"] },
"timeout": { "type": "integer" }
}
},
"tls": {
"$ref": "#/definitions/tlsConfig",
"description": "TLS configuration overriding root TLS for Operations API"
}
}
},
"storage": {
"type": "object",
"description": "Storage engine configuration.",
"additionalProperties": true,
"properties": {
"writeAsync": {
"type": "boolean",
"description": "Disable fsync for faster writes (risk of data loss on crash). Default: false"
},
"caching": { "type": "boolean", "description": "Enable in-memory caching of records. Default: true" },
"compression": {
"oneOf": [
{ "type": "boolean" },
{
"type": "object",
"additionalProperties": false,
"properties": {
"dictionary": { "type": ["string", "null"], "description": "Path to compression dictionary file." },
"threshold": {
"type": "number",
"description": "Only entries larger than this many bytes will be compressed."
}
}
}
],
"description": "Enable/Configure compression (LZ4). Default: true"
},
"compactOnStart": { "type": "boolean", "description": "Compact non-system databases on start. Default: false" },
"compactOnStartKeepBackup": {
"type": "boolean",
"description": "Keep backups created by compactOnStart. Default: false"
},
"maxTransactionQueueTime": {
"type": "string",
"description": "Max write queue time before rejecting (e.g. '45s')."
},
"noReadAhead": { "type": "boolean", "description": "Advise OS to not read ahead. Default: false" },
"prefetchWrites": { "type": "boolean", "description": "Load data prior to write transactions. Default: true" },
"path": { "type": "string", "description": "Directory for all database files. Default: <rootPath>/database" },
"blobPaths": {
"oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }],
"description": "Path or array of paths for blob storage. Default: <rootPath>/blobs"
},
"pageSize": { "type": "number", "description": "Database page size (bytes). Default: OS default" },
"reclamation": {
"type": "object",
"description": "Reclamation process configuration.",
"additionalProperties": true
},
"logging": { "$ref": "#/definitions/loggerConfig" }
}
},
"tls": {
"description": "TLS certificates/keys/settings for HTTPS and MQTT. Can be a single object or an array (SNI).",
"oneOf": [
{ "$ref": "#/definitions/tlsConfig" },
{ "type": "array", "items": { "$ref": "#/definitions/tlsConfig" } }
]
},
"mqtt": {
"type": "object",
"description": "MQTT server configuration.",
"additionalProperties": true,
"properties": {
"port": { "type": "number", "description": "Insecure MQTT port. Default: 1883" },
"securePort": { "type": "number", "description": "Secure MQTT port. Default: 8883" },
"webSocket": { "type": "boolean", "description": "Enable MQTT over WebSockets (on http port). Default: true" },
"requireAuthentication": {
"type": "boolean",
"description": "Require authentication for MQTT connections. Default: true"
},
"mtls": {
"oneOf": [
{ "type": "boolean" },
{
"type": "object",
"additionalProperties": false,
"properties": {
"user": {
"type": ["string", "null"],
"description": "Authenticate all authorized mTLS connections as this user (or null for none). Default: Common Name"
},
"required": {
"type": "boolean",
"description": "Require client certificates for all MQTT connections. Default: false"
},
"certificateAuthority": {
"type": "string",
"description": "Override CA path for MQTT. Default: tls.certificateAuthority"
},
"certificateVerification": {
"oneOf": [
{ "type": "boolean" },
{
"type": "object",
"additionalProperties": false,
"properties": {
"timeout": {
"type": "number",
"description": "Max ms to wait for OCSP response. Default: 5000"
},
"cacheTtl": {
"type": "number",
"description": "Cache TTL (ms) for verification results. Default: 3600000"
},
"failureMode": {
"type": "string",
"enum": ["fail-open", "fail-closed"],
"description": "Behavior on verification failure. Default: 'fail-open'"
}
}
}
]
}
}
}
]
},
"logging": { "$ref": "#/definitions/loggerConfig" }
}
},
"databases": {
"type": "object",
"description": "Optional mapping of databases and tables to file system paths.",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"path": { "type": "string", "description": "Path for all files of this database." },
"auditPath": { "type": "string", "description": "Path for audit log database files for this database." },
"tables": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"path": { "type": "string", "description": "Path for this table's files." }
},
"required": ["path"]
}
}
}
}
},
"analytics": {
"type": "object",
"additionalProperties": false,
"properties": {
"aggregatePeriod": {
"type": "number",
"description": "Seconds between aggregation of raw analytics. Default: 60"
},
"replicate": {
"type": "boolean",
"description": "Replicate aggregated analytics across cluster. Default: false"
},
"logging": { "$ref": "#/definitions/loggerConfig" }
}
}
},
"additionalProperties": true,
"definitions": {
"loggerConfig": {
"type": "object",
"additionalProperties": true,
"properties": {
"path": { "type": "string" },
"root": { "type": "string" },
"level": { "type": "string", "enum": ["trace", "debug", "info", "warn", "error", "fatal", "notify"] },
"tag": { "type": "string" },
"stdStreams": { "type": "boolean" }
}
},
"tlsConfig": {
"type": "object",
"additionalProperties": false,
"properties": {
"certificate": {
"type": "string",
"description": "Path to certificate file. Default: <ROOTPATH>/keys/certificate.pem"
},
"certificateAuthority": { "type": "string", "description": "Path to CA file. Default: <ROOTPATH>/keys/ca.pem" },
"privateKey": {
"type": "string",
"description": "Path to private key file. Default: <ROOTPATH>/keys/privateKey.pem"
},
"ciphers": { "type": "string", "description": "Optional explicit cipher list." },
"host": { "type": "string", "description": "Optional SNI host this certificate applies to." }
}
}
},
"examples": [
{
"rootPath": "~/hdb",
"componentsRoot": "~/hdb/components",
"http": {
"port": 9926,
"cors": true,
"compressionThreshold": 1200,
"mtls": {
"required": false,
"certificateVerification": {
"failureMode": "fail-closed",
"crl": { "enabled": true, "timeout": 10000, "cacheTtl": 86400000, "gracePeriod": 86400000 },
"ocsp": { "enabled": true, "timeout": 5000, "cacheTtl": 3600000, "errorCacheTtl": 300000 }
}
}
},
"threads": { "count": 8, "maxHeapMemory": 300 },
"authentication": { "authorizeLocal": true, "enableSessions": true },
"operationsApi": { "network": { "port": 9925 } },
"logging": {
"level": "warn",
"file": true,
"rotation": { "enabled": true, "interval": "1D", "maxSize": "100M" }
},
"storage": { "path": "~/hdb/database", "blobPaths": ["~/hdb/blobs"] },
"tls": {
"certificate": "~/hdb/keys/certificate.pem",
"privateKey": "~/hdb/keys/privateKey.pem",
"certificateAuthority": "~/hdb/keys/ca.pem"
},
"mqtt": { "port": 1883, "securePort": 8883, "webSocket": true },
"analytics": { "aggregatePeriod": 60, "replicate": false },
"my-app": { "package": "git+https://github.com/example/my-app.git", "port": 4000 }
}
]
}