@aifabrix/builder 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,649 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "AI Fabrix Application Configuration Schema",
4
+ "description": "Schema for AI Fabrix applications deployed via the API-Driven Deployment System",
5
+ "metadata": {
6
+ "key": "application-schema",
7
+ "name": "Application Configuration Schema",
8
+ "description": "JSON schema for validating AI Fabrix application configuration files",
9
+ "version": "1.0.0",
10
+ "type": "schema",
11
+ "category": "infrastructure",
12
+ "author": "AI Fabrix Team",
13
+ "createdAt": "2024-01-01T00:00:00Z",
14
+ "updatedAt": "2024-01-01T00:00:00Z",
15
+ "compatibility": {
16
+ "minVersion": "1.0.0",
17
+ "maxVersion": "2.0.0",
18
+ "deprecated": false
19
+ },
20
+ "tags": ["schema", "application", "validation", "configuration"],
21
+ "dependencies": [],
22
+ "changelog": [
23
+ {
24
+ "version": "1.0.0",
25
+ "date": "2024-01-01T00:00:00Z",
26
+ "changes": [
27
+ "Initial application configuration schema",
28
+ "Added application resource validation",
29
+ "Added database configuration validation",
30
+ "Added environment variable validation"
31
+ ],
32
+ "breaking": false
33
+ }
34
+ ]
35
+ },
36
+ "type": "object",
37
+ "required": ["key", "displayName", "description", "type", "image", "registryMode", "port"],
38
+ "properties": {
39
+ "key": {
40
+ "type": "string",
41
+ "description": "Unique application identifier (cannot be changed after registration)",
42
+ "pattern": "^[a-z0-9-]+$",
43
+ "minLength": 3,
44
+ "maxLength": 40
45
+ },
46
+ "displayName": {
47
+ "type": "string",
48
+ "description": "Human-readable application name",
49
+ "minLength": 1,
50
+ "maxLength": 100
51
+ },
52
+ "description": {
53
+ "type": "string",
54
+ "description": "Application description",
55
+ "minLength": 1,
56
+ "maxLength": 500
57
+ },
58
+ "type": {
59
+ "type": "string",
60
+ "description": "Azure application type",
61
+ "enum": ["webapp", "functionapp", "api", "service"]
62
+ },
63
+ "image": {
64
+ "type": "string",
65
+ "description": "Container image reference",
66
+ "pattern": "^[a-zA-Z0-9._/-]+:[a-zA-Z0-9._-]+$"
67
+ },
68
+ "registryMode": {
69
+ "type": "string",
70
+ "description": "Registry mode for image authentication",
71
+ "enum": ["acr", "external", "public"]
72
+ },
73
+ "port": {
74
+ "type": "number",
75
+ "description": "Application port number",
76
+ "minimum": 1,
77
+ "maximum": 65535
78
+ },
79
+ "requiresDatabase": {
80
+ "type": "boolean",
81
+ "description": "Whether application requires database"
82
+ },
83
+ "databases": {
84
+ "type": "array",
85
+ "description": "Database configurations",
86
+ "items": {
87
+ "type": "object",
88
+ "required": ["name"],
89
+ "properties": {
90
+ "name": {
91
+ "type": "string",
92
+ "description": "Database name",
93
+ "pattern": "^[a-z0-9_]+$"
94
+ }
95
+ },
96
+ "additionalProperties": false
97
+ }
98
+ },
99
+ "requiresRedis": {
100
+ "type": "boolean",
101
+ "description": "Whether application requires Redis"
102
+ },
103
+ "requiresStorage": {
104
+ "type": "boolean",
105
+ "description": "Whether application requires storage.Physical storage is mapped to /mnt/data/. Blob storage is mapped to SMB File share /data/{app-key}/."
106
+ },
107
+ "configuration": {
108
+ "type": "array",
109
+ "description": "Core application configuration",
110
+ "items": {
111
+ "type": "object",
112
+ "required": ["name", "value", "location", "required"],
113
+ "properties": {
114
+ "name": {
115
+ "type": "string",
116
+ "description": "Configuration variable name",
117
+ "pattern": "^[A-Z_][A-Z0-9_]*$"
118
+ },
119
+ "value": {
120
+ "type": "string",
121
+ "description": "Configuration value (literal or ready-made parameter reference)"
122
+ },
123
+ "location": {
124
+ "type": "string",
125
+ "description": "Where the value is stored",
126
+ "enum": ["variable", "keyvault"]
127
+ },
128
+ "required": {
129
+ "type": "boolean",
130
+ "description": "Whether this configuration is required"
131
+ },
132
+ "portalInput": {
133
+ "type": "object",
134
+ "description": "Portal input configuration for user-provided values",
135
+ "properties": {
136
+ "field": {
137
+ "type": "string",
138
+ "enum": ["password", "text", "textarea", "select"]
139
+ },
140
+ "label": {
141
+ "type": "string",
142
+ "description": "Display label for the input field"
143
+ },
144
+ "placeholder": {
145
+ "type": "string",
146
+ "description": "Placeholder text for the input field"
147
+ },
148
+ "masked": {
149
+ "type": "boolean",
150
+ "description": "Whether to mask the input (for passwords)"
151
+ },
152
+ "validation": {
153
+ "type": "object",
154
+ "properties": {
155
+ "minLength": {
156
+ "type": "integer",
157
+ "minimum": 1
158
+ },
159
+ "maxLength": {
160
+ "type": "integer",
161
+ "minimum": 1
162
+ },
163
+ "pattern": {
164
+ "type": "string",
165
+ "description": "Regex pattern for validation"
166
+ },
167
+ "required": {
168
+ "type": "boolean"
169
+ }
170
+ },
171
+ "additionalProperties": false
172
+ },
173
+ "options": {
174
+ "type": "array",
175
+ "description": "Options for select fields",
176
+ "items": {
177
+ "type": "string"
178
+ }
179
+ }
180
+ },
181
+ "required": ["field", "label"],
182
+ "additionalProperties": false
183
+ }
184
+ },
185
+ "additionalProperties": false
186
+ }
187
+ },
188
+ "conditionalConfiguration": {
189
+ "type": "array",
190
+ "description": "Conditional configuration based on service requirements",
191
+ "items": {
192
+ "type": "object",
193
+ "required": ["condition", "configuration"],
194
+ "properties": {
195
+ "condition": {
196
+ "type": "string",
197
+ "description": "Condition for including this configuration",
198
+ "pattern": "^\\{\\{.*\\}\\}$"
199
+ },
200
+ "configuration": {
201
+ "type": "array",
202
+ "description": "Configuration items to include when condition is true",
203
+ "items": {
204
+ "type": "object",
205
+ "required": ["name", "value", "location", "required"],
206
+ "properties": {
207
+ "name": {
208
+ "type": "string",
209
+ "description": "Configuration variable name",
210
+ "pattern": "^[A-Z_][A-Z0-9_]*$"
211
+ },
212
+ "value": {
213
+ "type": "string",
214
+ "description": "Configuration value (literal or ready-made parameter reference)"
215
+ },
216
+ "location": {
217
+ "type": "string",
218
+ "description": "Where the value is stored",
219
+ "enum": ["variable", "keyvault"]
220
+ },
221
+ "required": {
222
+ "type": "boolean",
223
+ "description": "Whether this configuration is required"
224
+ },
225
+ "portalInput": {
226
+ "type": "object",
227
+ "description": "Portal input configuration for user-provided values",
228
+ "properties": {
229
+ "field": {
230
+ "type": "string",
231
+ "enum": ["password", "text", "textarea", "select"]
232
+ },
233
+ "label": {
234
+ "type": "string",
235
+ "description": "Display label for the input field"
236
+ },
237
+ "placeholder": {
238
+ "type": "string",
239
+ "description": "Placeholder text for the input field"
240
+ },
241
+ "masked": {
242
+ "type": "boolean",
243
+ "description": "Whether to mask the input (for passwords)"
244
+ },
245
+ "validation": {
246
+ "type": "object",
247
+ "properties": {
248
+ "minLength": {
249
+ "type": "integer",
250
+ "minimum": 1
251
+ },
252
+ "maxLength": {
253
+ "type": "integer",
254
+ "minimum": 1
255
+ },
256
+ "pattern": {
257
+ "type": "string",
258
+ "description": "Regex pattern for validation"
259
+ },
260
+ "required": {
261
+ "type": "boolean"
262
+ }
263
+ },
264
+ "additionalProperties": false
265
+ },
266
+ "options": {
267
+ "type": "array",
268
+ "description": "Options for select fields",
269
+ "items": {
270
+ "type": "string"
271
+ }
272
+ }
273
+ },
274
+ "required": ["field", "label"],
275
+ "additionalProperties": false
276
+ }
277
+ },
278
+ "additionalProperties": false
279
+ }
280
+ }
281
+ },
282
+ "additionalProperties": false
283
+ }
284
+ },
285
+ "healthCheck": {
286
+ "type": "object",
287
+ "description": "Health check configuration",
288
+ "required": ["path", "interval"],
289
+ "properties": {
290
+ "path": {
291
+ "type": "string",
292
+ "description": "Health check endpoint path",
293
+ "pattern": "^/"
294
+ },
295
+ "interval": {
296
+ "type": "integer",
297
+ "description": "Health check interval in seconds",
298
+ "minimum": 10,
299
+ "maximum": 300
300
+ },
301
+ "probePath": {
302
+ "type": "string",
303
+ "description": "Front Door health probe path (defaults to path if not specified)",
304
+ "pattern": "^/"
305
+ },
306
+ "probeRequestType": {
307
+ "type": "string",
308
+ "description": "HTTP method for Front Door probe",
309
+ "enum": ["GET", "POST", "HEAD", "PUT", "DELETE"]
310
+ },
311
+ "probeProtocol": {
312
+ "type": "string",
313
+ "description": "Protocol for Front Door probe",
314
+ "enum": ["Http", "Https"]
315
+ },
316
+ "probeIntervalInSeconds": {
317
+ "type": "integer",
318
+ "description": "Front Door probe interval in seconds (default 120)",
319
+ "minimum": 60,
320
+ "maximum": 600
321
+ }
322
+ },
323
+ "additionalProperties": false
324
+ },
325
+ "frontDoorRouting": {
326
+ "type": "object",
327
+ "description": "Front Door routing configuration",
328
+ "properties": {
329
+ "pattern": {
330
+ "type": "string",
331
+ "description": "URL pattern for routing (e.g., '/app/*')",
332
+ "pattern": "^/.+"
333
+ },
334
+ "requiresRuleSet": {
335
+ "type": "boolean",
336
+ "description": "Whether URL rewriting rule set is required"
337
+ },
338
+ "ruleSetConditions": {
339
+ "type": "array",
340
+ "description": "Rule set conditions for URL rewriting",
341
+ "items": {
342
+ "type": "object",
343
+ "properties": {
344
+ "type": {
345
+ "type": "string",
346
+ "description": "Condition type (e.g., 'UrlPath')"
347
+ },
348
+ "operator": {
349
+ "type": "string",
350
+ "description": "Condition operator (e.g., 'BeginsWith')"
351
+ },
352
+ "matchValues": {
353
+ "type": "array",
354
+ "items": {
355
+ "type": "string"
356
+ }
357
+ }
358
+ }
359
+ }
360
+ },
361
+ "ruleSetActions": {
362
+ "type": "array",
363
+ "description": "Rule set actions for URL rewriting",
364
+ "items": {
365
+ "type": "object",
366
+ "properties": {
367
+ "type": {
368
+ "type": "string",
369
+ "description": "Action type (e.g., 'UrlRewrite')"
370
+ },
371
+ "sourcePattern": {
372
+ "type": "string",
373
+ "description": "Source URL pattern for rewriting"
374
+ },
375
+ "destination": {
376
+ "type": "string",
377
+ "description": "Destination URL pattern"
378
+ }
379
+ }
380
+ }
381
+ }
382
+ },
383
+ "additionalProperties": false
384
+ },
385
+ "authentication": {
386
+ "type": "object",
387
+ "description": "Authentication configuration",
388
+ "required": ["type", "enableSSO", "requiredRoles"],
389
+ "properties": {
390
+ "type": {
391
+ "type": "string",
392
+ "description": "Authentication type",
393
+ "enum": ["azure", "local", "none"]
394
+ },
395
+ "enableSSO": {
396
+ "type": "boolean",
397
+ "description": "Whether to enable SSO"
398
+ },
399
+ "requiredRoles": {
400
+ "type": "array",
401
+ "description": "Required roles for access",
402
+ "items": {
403
+ "type": "string",
404
+ "pattern": "^[a-z-]+$"
405
+ }
406
+ },
407
+ "endpoints": {
408
+ "type": "object",
409
+ "description": "Authentication endpoints",
410
+ "properties": {
411
+ "local": {
412
+ "type": "string",
413
+ "description": "Local authentication endpoint",
414
+ "pattern": "^(http|https)://.*$"
415
+ },
416
+ "custom": {
417
+ "type": "string",
418
+ "description": "Custom authentication endpoint",
419
+ "pattern": "^(http|https)://.*$"
420
+ }
421
+ },
422
+ "additionalProperties": false
423
+ }
424
+ },
425
+ "additionalProperties": false
426
+ },
427
+ "roles": {
428
+ "type": "array",
429
+ "description": "Application roles for Azure AD group mapping",
430
+ "items": {
431
+ "type": "object",
432
+ "required": ["name", "value", "description"],
433
+ "properties": {
434
+ "name": {
435
+ "type": "string",
436
+ "description": "Human-readable role name",
437
+ "minLength": 1,
438
+ "maxLength": 100
439
+ },
440
+ "value": {
441
+ "type": "string",
442
+ "description": "Role identifier (used in JWT and ACL)",
443
+ "pattern": "^[a-z-]+$"
444
+ },
445
+ "description": {
446
+ "type": "string",
447
+ "description": "Role description",
448
+ "minLength": 1,
449
+ "maxLength": 500
450
+ },
451
+ "Groups": {
452
+ "type": "array",
453
+ "description": "Azure AD groups mapped to this role",
454
+ "items": {
455
+ "type": "string",
456
+ "minLength": 1,
457
+ "maxLength": 100
458
+ }
459
+ }
460
+ },
461
+ "additionalProperties": false
462
+ }
463
+ },
464
+ "permissions": {
465
+ "type": "array",
466
+ "description": "Application permissions with role mappings for access control",
467
+ "items": {
468
+ "type": "object",
469
+ "required": ["name", "roles", "description"],
470
+ "properties": {
471
+ "name": {
472
+ "type": "string",
473
+ "description": "Permission identifier (e.g., 'documentstore:read', 'flowise:dev:access')",
474
+ "pattern": "^[a-z0-9-:]+$",
475
+ "minLength": 1,
476
+ "maxLength": 100
477
+ },
478
+ "roles": {
479
+ "type": "array",
480
+ "description": "Roles that have this permission",
481
+ "items": {
482
+ "type": "string",
483
+ "pattern": "^[a-z-]+$",
484
+ "minLength": 1,
485
+ "maxLength": 50
486
+ },
487
+ "minItems": 1
488
+ },
489
+ "description": {
490
+ "type": "string",
491
+ "description": "Permission description",
492
+ "minLength": 1,
493
+ "maxLength": 500
494
+ }
495
+ },
496
+ "additionalProperties": false
497
+ }
498
+ },
499
+ "repository": {
500
+ "type": "object",
501
+ "description": "Repository deployment configuration",
502
+ "properties": {
503
+ "enabled": {
504
+ "type": "boolean",
505
+ "description": "Whether repository deployment is enabled"
506
+ },
507
+ "repositoryUrl": {
508
+ "type": "string",
509
+ "description": "Full repository URL for deployment validation (same as OAuth callback)",
510
+ "pattern": "^(https://github.com/[^/]+/[^/]+|https://gitlab.com/[^/]+/[^/]+|https://dev.azure.com/[^/]+/[^/]+/[^/]+)$"
511
+ }
512
+ },
513
+ "required": ["enabled"],
514
+ "additionalProperties": false
515
+ },
516
+ "startupCommand": {
517
+ "type": "string",
518
+ "description": "Application startup command (e.g., 'pnpm start', 'python app.py')",
519
+ "minLength": 1,
520
+ "maxLength": 200
521
+ },
522
+ "runtimeVersion": {
523
+ "type": "object",
524
+ "description": "Runtime version configuration",
525
+ "properties": {
526
+ "node": {
527
+ "type": "string",
528
+ "description": "Node.js version (e.g., '18.17.0')",
529
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
530
+ },
531
+ "python": {
532
+ "type": "string",
533
+ "description": "Python version (e.g., '3.11')",
534
+ "pattern": "^[0-9]+\\.[0-9]+$"
535
+ },
536
+ "dotnet": {
537
+ "type": "string",
538
+ "description": ".NET version (e.g., '8.0')",
539
+ "pattern": "^[0-9]+\\.[0-9]+$"
540
+ }
541
+ },
542
+ "additionalProperties": false
543
+ },
544
+ "scaling": {
545
+ "type": "object",
546
+ "description": "Application scaling configuration",
547
+ "properties": {
548
+ "minInstances": {
549
+ "type": "integer",
550
+ "description": "Minimum number of instances",
551
+ "minimum": 1,
552
+ "maximum": 20
553
+ },
554
+ "maxInstances": {
555
+ "type": "integer",
556
+ "description": "Maximum number of instances",
557
+ "minimum": 1,
558
+ "maximum": 20
559
+ },
560
+ "cpuThreshold": {
561
+ "type": "number",
562
+ "description": "CPU threshold for scaling (percentage)",
563
+ "minimum": 10,
564
+ "maximum": 90
565
+ }
566
+ },
567
+ "additionalProperties": false
568
+ },
569
+ "build": {
570
+ "type": "object",
571
+ "description": "Build and local development configuration",
572
+ "properties": {
573
+ "envOutputPath": {
574
+ "type": "string",
575
+ "description": "Path where .env file is copied for local development (relative to builder/)",
576
+ "pattern": "^[^/].*"
577
+ },
578
+ "secrets": {
579
+ "type": "string",
580
+ "description": "Path to secrets file (defaults to ~/.aifabrix/secrets.yaml if empty)",
581
+ "pattern": "^[^/].*"
582
+ },
583
+ "localPort": {
584
+ "type": "integer",
585
+ "description": "Port for local development (different from Docker port)",
586
+ "minimum": 1000,
587
+ "maximum": 65535
588
+ },
589
+ "language": {
590
+ "type": "string",
591
+ "description": "Runtime language for template selection",
592
+ "enum": ["typescript", "python"]
593
+ },
594
+ "context": {
595
+ "type": "string",
596
+ "description": "Docker build context path (relative to builder/)",
597
+ "pattern": "^[^/].*"
598
+ },
599
+ "dockerfile": {
600
+ "type": "string",
601
+ "description": "Dockerfile name (empty or missing = use auto-generated template)",
602
+ "pattern": "^[^/].*"
603
+ }
604
+ },
605
+ "additionalProperties": false
606
+ }
607
+ },
608
+ "additionalProperties": false,
609
+ "allOf": [
610
+ {
611
+ "if": {
612
+ "properties": {
613
+ "requiresDatabase": {
614
+ "const": true
615
+ }
616
+ }
617
+ },
618
+ "then": {
619
+ "required": ["databases"]
620
+ }
621
+ },
622
+ {
623
+ "if": {
624
+ "properties": {
625
+ "registryMode": {
626
+ "const": "external"
627
+ }
628
+ }
629
+ },
630
+ "then": {
631
+ "properties": {
632
+ "configuration": {
633
+ "items": {
634
+ "properties": {
635
+ "name": {
636
+ "enum": [
637
+ "DOCKER_REGISTRY_SERVER_URL",
638
+ "DOCKER_REGISTRY_SERVER_USERNAME",
639
+ "DOCKER_REGISTRY_SERVER_PASSWORD"
640
+ ]
641
+ }
642
+ }
643
+ }
644
+ }
645
+ }
646
+ }
647
+ }
648
+ ]
649
+ }
@@ -0,0 +1,15 @@
1
+ # Environment Configuration
2
+ # Defines host values for different deployment contexts
3
+
4
+ environments:
5
+ docker:
6
+ DB_HOST: postgres
7
+ REDIS_HOST: redis
8
+ MISO_HOST: miso-controller
9
+ KEYCLOAK_HOST: keycloak
10
+
11
+ local:
12
+ DB_HOST: localhost
13
+ REDIS_HOST: localhost
14
+ MISO_HOST: localhost
15
+ KEYCLOAK_HOST: localhost