@aifabrix/builder 2.33.0 → 2.33.3

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.
Files changed (50) hide show
  1. package/README.md +13 -0
  2. package/integration/hubspot/README.md +7 -7
  3. package/lib/api/index.js +6 -2
  4. package/lib/app/deploy-config.js +161 -0
  5. package/lib/app/deploy.js +28 -153
  6. package/lib/app/register.js +6 -5
  7. package/lib/app/run-helpers.js +23 -17
  8. package/lib/cli.js +31 -1
  9. package/lib/commands/logout.js +3 -4
  10. package/lib/commands/up-common.js +72 -0
  11. package/lib/commands/up-dataplane.js +109 -0
  12. package/lib/commands/up-miso.js +134 -0
  13. package/lib/core/config.js +32 -9
  14. package/lib/core/secrets-docker-env.js +88 -0
  15. package/lib/core/secrets.js +142 -115
  16. package/lib/datasource/deploy.js +31 -3
  17. package/lib/datasource/list.js +102 -15
  18. package/lib/infrastructure/helpers.js +82 -1
  19. package/lib/infrastructure/index.js +2 -0
  20. package/lib/schema/env-config.yaml +7 -0
  21. package/lib/utils/api.js +70 -2
  22. package/lib/utils/compose-generator.js +13 -13
  23. package/lib/utils/config-paths.js +13 -0
  24. package/lib/utils/device-code.js +2 -2
  25. package/lib/utils/env-endpoints.js +2 -5
  26. package/lib/utils/env-map.js +4 -5
  27. package/lib/utils/error-formatters/network-errors.js +13 -3
  28. package/lib/utils/parse-image-ref.js +27 -0
  29. package/lib/utils/paths.js +28 -4
  30. package/lib/utils/secrets-generator.js +34 -12
  31. package/lib/utils/secrets-helpers.js +1 -2
  32. package/lib/utils/token-manager-refresh.js +5 -0
  33. package/package.json +1 -1
  34. package/templates/applications/dataplane/Dockerfile +16 -0
  35. package/templates/applications/dataplane/README.md +205 -0
  36. package/templates/applications/dataplane/env.template +143 -0
  37. package/templates/applications/dataplane/rbac.yaml +283 -0
  38. package/templates/applications/dataplane/variables.yaml +143 -0
  39. package/templates/applications/keycloak/Dockerfile +1 -1
  40. package/templates/applications/keycloak/README.md +193 -0
  41. package/templates/applications/keycloak/variables.yaml +5 -6
  42. package/templates/applications/miso-controller/Dockerfile +8 -8
  43. package/templates/applications/miso-controller/README.md +369 -0
  44. package/templates/applications/miso-controller/env.template +114 -6
  45. package/templates/applications/miso-controller/rbac.yaml +74 -0
  46. package/templates/applications/miso-controller/variables.yaml +93 -5
  47. package/templates/github/ci.yaml.hbs +44 -1
  48. package/templates/github/release.yaml.hbs +44 -0
  49. package/templates/infra/compose.yaml.hbs +2 -1
  50. package/templates/applications/miso-controller/test.yaml +0 -1
@@ -0,0 +1,143 @@
1
+ # Application Metadata
2
+ app:
3
+ key: dataplane
4
+ displayName: "AI Fabrix Dataplane"
5
+ description: "Python microservice for AI processing and bulk operations. Handles document processing, external data management, and Flowise integration with MisoClient SDK authentication."
6
+ type: webapp
7
+ language: python # Explicitly specify Python language
8
+
9
+ # Image Configuration
10
+ # Set tag to match your build (e.g. aifabrix build dataplane -t v1.0.0 then tag: v1.0.0)
11
+ # Registry is required so the controller can pull the image (avoids "docker: not found" on the controller host).
12
+ image:
13
+ name: aifabrix/dataplane
14
+ tag: latest
15
+ registry: devflowiseacr.azurecr.io
16
+ registryMode: acr
17
+
18
+ # Port Configuration
19
+ port: 3001
20
+
21
+ # Azure Requirements
22
+ requires:
23
+ database: true
24
+ databases:
25
+ - name: dataplane # Main database - configuration only
26
+ - name: dataplane-vector # Vector and document store: chunks, embeddings, vector indexes (pgvector)
27
+ - name: dataplane-logs # Logs database - execution, audit, ABAC traces
28
+ - name: dataplane-records # Records database - external records storage
29
+ redis: true
30
+ storage: true
31
+
32
+ # Health Check
33
+ healthCheck:
34
+ path: /health
35
+ interval: 30
36
+ probePath: /health
37
+ probeRequestType: GET
38
+ probeProtocol: Https
39
+ probeIntervalInSeconds: 120
40
+
41
+ # Authentication
42
+ authentication:
43
+ type: azure
44
+ enableSSO: true
45
+ requiredRoles: ["aifabrix-user"]
46
+ endpoints:
47
+ local: "https://dataplane.aifabrix.ai/auth/callback"
48
+
49
+ # Build Configuration
50
+ build:
51
+ context: ../.. # Relative to builder/dataplane/ config location (goes to app root)
52
+ dockerfile: builder/dataplane/Dockerfile
53
+ envOutputPath: ../../.env # Copy to repo root for local dev
54
+ localPort: 3011 # Port for local development (different from Docker port)
55
+
56
+ # =============================================================================
57
+ # Portal Input Configuration (Deployment Wizard)
58
+ # =============================================================================
59
+ # Variables defined in env.template with sensible defaults.
60
+ # portalInput allows admin to override before deployment.
61
+ #
62
+ # NOT included (auto-configured):
63
+ # - Database URLs, Redis → auto-generated during Azure install
64
+ # - MISO_*, KEYCLOAK_* → auto-generated during Azure install
65
+ # - AI params (OPENAI_*, AZURE_OPENAI_*) → from controller config
66
+ # - ENVIRONMENT → set by deployment target
67
+
68
+ configuration:
69
+ # -------------------------------------------------------------------------
70
+ # Operations & Debugging
71
+ # -------------------------------------------------------------------------
72
+ - name: LOG_LEVEL
73
+ portalInput:
74
+ field: select
75
+ label: "Log Level"
76
+ options:
77
+ - DEBUG
78
+ - INFO
79
+ - WARNING
80
+ - ERROR
81
+
82
+ - name: ABAC_AUDIT_DETAIL_LEVEL
83
+ portalInput:
84
+ field: select
85
+ label: "ABAC Audit Detail Level"
86
+ options:
87
+ - summary
88
+ - detailed
89
+
90
+ - name: RBAC_AUDIT_DETAIL_LEVEL
91
+ portalInput:
92
+ field: select
93
+ label: "RBAC Audit Detail Level"
94
+ options:
95
+ - summary
96
+ - detailed
97
+ - explain
98
+
99
+ # -------------------------------------------------------------------------
100
+ # CIP Execution - Resource Limits
101
+ # -------------------------------------------------------------------------
102
+ # Tune based on customer data volumes and external API characteristics
103
+
104
+ - name: CIP_EXECUTION_MAX_RECORDS
105
+ portalInput:
106
+ field: text
107
+ label: "Max Records per CIP Execution"
108
+ placeholder: "100000"
109
+
110
+ - name: CIP_EXECUTION_MAX_RESPONSE_SIZE_MB
111
+ portalInput:
112
+ field: text
113
+ label: "Max Response Size (MB)"
114
+ placeholder: "100.0"
115
+
116
+ - name: CIP_EXECUTION_OPERATION_TIMEOUT
117
+ portalInput:
118
+ field: text
119
+ label: "Operation Timeout (seconds)"
120
+ placeholder: "300.0"
121
+
122
+ - name: CIP_EXECUTION_HTTP_TIMEOUT
123
+ portalInput:
124
+ field: text
125
+ label: "HTTP Request Timeout (seconds)"
126
+ placeholder: "30.0"
127
+
128
+ # -------------------------------------------------------------------------
129
+ # CIP Execution - Rate Limiting
130
+ # -------------------------------------------------------------------------
131
+ # Tune to match external API rate limits
132
+
133
+ - name: CIP_EXECUTION_RATE_LIMIT_REQUESTS_PER_SECOND
134
+ portalInput:
135
+ field: text
136
+ label: "Rate Limit (requests/second)"
137
+ placeholder: "10.0"
138
+
139
+ - name: CIP_EXECUTION_RATE_LIMIT_BURST_SIZE
140
+ portalInput:
141
+ field: text
142
+ label: "Rate Limit Burst Size"
143
+ placeholder: "20"
@@ -34,4 +34,4 @@ EXPOSE 8080
34
34
 
35
35
  # Default Keycloak command (can be overridden in docker-compose.yaml)
36
36
  # Health checks are enabled via the build step above
37
- CMD ["start-dev"]
37
+ CMD ["start-dev"]
@@ -0,0 +1,193 @@
1
+ # Keycloak Builder
2
+
3
+ Build, run, and deploy Keycloak using `@aifabrix/builder`.
4
+
5
+ ---
6
+
7
+ ## Quick Start
8
+
9
+ ### 1. Install
10
+
11
+ ```bash
12
+ pnpm install -g @aifabrix/builder
13
+ ```
14
+
15
+ ### 2. First Time Setup
16
+
17
+ ```bash
18
+ # Check your environment
19
+ aifabrix doctor
20
+
21
+ # Login to controller
22
+ aifabrix login --method device --environment dev --controller http://localhost:3100 --offline
23
+
24
+ # Register your application (gets you credentials automatically)
25
+ aifabrix app register keycloak --environment dev
26
+ ```
27
+
28
+ ### 3. Build & Run Locally
29
+
30
+ ```bash
31
+ # Build the Docker image
32
+ aifabrix build keycloak
33
+
34
+ # Generate environment variables
35
+ aifabrix resolve keycloak
36
+
37
+ # Run locally
38
+ aifabrix run keycloak
39
+ ```
40
+
41
+ **Access your app:** <http://dev.aifabrix:8082>
42
+
43
+ **View logs:**
44
+
45
+ ```bash
46
+ docker logs aifabrix-keycloak -f
47
+ ```
48
+
49
+ **Stop:**
50
+
51
+ ```bash
52
+ docker stop aifabrix-keycloak
53
+ ```
54
+
55
+ ### 4. Deploy to Azure
56
+
57
+ ```bash
58
+ # Build with version tag
59
+ aifabrix build keycloak --tag v1.0.0
60
+
61
+ # Push to registry
62
+ aifabrix push keycloak --registry myacr.azurecr.io --tag "v1.0.0,latest"
63
+
64
+ # Deploy to miso-controller
65
+ aifabrix deploy keycloak --controller https://controller.aifabrix.ai --environment dev
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Using miso-client
71
+
72
+ > [miso-client](https://github.com/esystemsdev/aifabrix-miso-client)
73
+
74
+ After registering your app, you automatically get credentials in your secret file. Use miso-client for login, RBAC, audit logs, etc.
75
+
76
+ **Rotate credentials if needed:**
77
+
78
+ ```bash
79
+ aifabrix app rotate-secret keycloak --environment dev
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Reference
85
+
86
+ ### Common Commands
87
+
88
+ ```bash
89
+ # Development
90
+ aifabrix build keycloak # Build app
91
+ aifabrix run keycloak # Run locally
92
+ aifabrix dockerfile keycloak --force # Generate Dockerfile
93
+ aifabrix resolve keycloak # Generate .env file
94
+
95
+ # Deployment
96
+ aifabrix json keycloak # Preview deployment JSON
97
+ aifabrix genkey keycloak # Generate deployment key
98
+ aifabrix push keycloak --registry myacr.azurecr.io # Push to ACR
99
+ aifabrix deploy keycloak --controller <url> # Deploy to Azure
100
+
101
+ # Management
102
+ aifabrix app register keycloak --environment dev
103
+ aifabrix app list --environment dev
104
+ aifabrix app rotate-secret keycloak --environment dev
105
+
106
+ # Utilities
107
+ aifabrix doctor # Check environment
108
+ aifabrix login --method device --environment dev # Login
109
+ aifabrix --help # Get help
110
+ ```
111
+
112
+ ### Build Options
113
+
114
+ ```bash
115
+ aifabrix build keycloak --tag v1.0.0 # Custom tag
116
+ aifabrix build keycloak --force-template # Force template regeneration
117
+ aifabrix build keycloak --language typescript # Override language detection
118
+ ```
119
+
120
+ ### Run Options
121
+
122
+ ```bash
123
+ aifabrix run keycloak --port 8082 # Custom port
124
+ aifabrix run keycloak --debug # Debug output
125
+ ```
126
+
127
+ ### Push Options
128
+
129
+ ```bash
130
+ aifabrix push keycloak --registry myacr.azurecr.io --tag v1.0.0
131
+ aifabrix push keycloak --registry myacr.azurecr.io --tag "v1.0.0,latest,stable"
132
+ ```
133
+
134
+ ### Deploy Options
135
+
136
+ ```bash
137
+ aifabrix deploy keycloak --controller <url> --environment dev
138
+ aifabrix deploy keycloak --controller <url> --environment dev --no-poll
139
+ ```
140
+
141
+ ### Login Methods
142
+
143
+ ```bash
144
+ # Device code flow
145
+ aifabrix login --method device --environment dev
146
+
147
+ # Credentials (reads from secrets.local.yaml)
148
+ aifabrix login --method credentials --app keycloak --environment dev
149
+
150
+ # Explicit credentials
151
+ aifabrix login --method credentials --app keycloak --client-id $CLIENT_ID --client-secret $CLIENT_SECRET --environment dev
152
+ ```
153
+
154
+ ### Environment Variables
155
+
156
+ ```bash
157
+ export AIFABRIX_HOME=/custom/path
158
+ export AIFABRIX_SECRETS=/path/to/secrets.yaml
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Troubleshooting
164
+
165
+ - **"Docker not running"** → Start Docker Desktop
166
+ - **"Not logged in"** → Run `aifabrix login` first
167
+ - **"Port already in use"** → Use `--port` flag or change `build.localPort` in `variables.yaml` (default: 8082)
168
+ - **"Authentication failed"** → Run `aifabrix login` again
169
+ - **"Build fails"** → Check Docker is running and `variables.yaml` → `build.secrets` path is correct
170
+ - **"Can't connect"** → Verify infrastructure is running and PostgreSQL is accessible
171
+
172
+ **Regenerate files:**
173
+
174
+ ```bash
175
+ aifabrix resolve keycloak --force
176
+ aifabrix json keycloak
177
+ aifabrix genkey keycloak
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Prerequisites
183
+
184
+ - `@aifabrix/builder` installed globally
185
+ - Docker Desktop running
186
+ - Azure CLI installed (for push command)
187
+ - Authenticated with controller (for deploy command)
188
+ - PostgreSQL database (ensure infrastructure is running)
189
+ - Authentication/RBAC configured
190
+
191
+ ---
192
+
193
+ **Application**: keycloak | **Port**: 8082 | **Registry**: myacr.azurecr.io | **Image**: aifabrix/keycloak:latest
@@ -38,9 +38,8 @@ authentication:
38
38
 
39
39
  # Build Configuration
40
40
  build:
41
- context: .. # Docker build context (relative to builder/)
42
- dockerfile: builder/Dockerfile # Dockerfile name (empty = use template)
43
- envOutputPath: .env # Copy .env to repo root for local dev
44
- localPort: 8082 # Port for local development (different from Docker port)
45
- containerPort: 8080 # Container port (different from local port)
46
- language: typescript # Runtime language for template selection
41
+ context: .. # Docker build context (relative to builder/)
42
+ dockerfile: builder/Dockerfile # Dockerfile name (empty = use template)
43
+ localPort: 8082 # Port for local development (different from Docker port)
44
+ containerPort: 8080 # Container port (different from local port)
45
+ language: typescript # Runtime language for template selection
@@ -1,16 +1,16 @@
1
1
  # AI Fabrix Miso Controller - Build from base image
2
- FROM aifabrix/miso-controller:latest
2
+ # This repo has no application source; use the published image as baseline.
3
+ # Build: docker build -t aifabrix/miso-controller:local .
4
+ # Or use the image directly: docker run aifabrix/miso-controller:latest
3
5
 
4
- # Set default data paths (can be overridden by environment variables)
5
- ENV LOG_PATH=/mnt/data/logs
6
- ENV DATA_PATH=/mnt/data/data
7
- ENV BACKUP_PATH=/mnt/data/backup
8
- ENV CONFIG_PATH=/mnt/data/config
6
+ FROM aifabrix/miso-controller:latest
9
7
 
10
- # Expose port
8
+ # Expose port (documentation; base image may already set this)
11
9
  EXPOSE 3000
12
10
 
13
- # Health check
11
+ # Health check (documentation; base image may already set this)
14
12
  HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
15
13
  CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
16
14
 
15
+ # CMD inherited from base image; override only if needed
16
+ # CMD inherited: node -r tsconfig-paths/register dist/src/server.js