@aifabrix/builder 2.32.3 → 2.33.1

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 (127) hide show
  1. package/.cursor/rules/project-rules.mdc +8 -0
  2. package/README.md +36 -8
  3. package/bin/aifabrix.js +6 -8
  4. package/integration/hubspot/README.md +12 -11
  5. package/integration/hubspot/companies.json +2048 -0
  6. package/integration/hubspot/create-hubspot.js +665 -0
  7. package/integration/hubspot/{hubspot-deploy-company.json → hubspot-datasource-company.json} +1 -1
  8. package/integration/hubspot/{hubspot-deploy-contact.json → hubspot-datasource-contact.json} +1 -1
  9. package/integration/hubspot/{hubspot-deploy-deal.json → hubspot-datasource-deal.json} +1 -1
  10. package/integration/hubspot/hubspot-deploy.json +832 -81
  11. package/integration/hubspot/hubspot-system.json +99 -0
  12. package/integration/hubspot/test-artifacts/wizard-hubspot-credential-real.yaml +20 -0
  13. package/integration/hubspot/test-artifacts/wizard-hubspot-env-vars.yaml +9 -0
  14. package/integration/hubspot/test-artifacts/wizard-invalid-add-datasource.yaml +5 -0
  15. package/integration/hubspot/test-artifacts/wizard-invalid-app-name.yaml +5 -0
  16. package/integration/hubspot/test-artifacts/wizard-invalid-credential-create.yaml +7 -0
  17. package/integration/hubspot/test-artifacts/wizard-invalid-credential-select.yaml +7 -0
  18. package/integration/hubspot/test-artifacts/wizard-invalid-known-platform.yaml +4 -0
  19. package/integration/hubspot/test-artifacts/wizard-invalid-missing-app.yaml +4 -0
  20. package/integration/hubspot/test-artifacts/wizard-invalid-missing-source.yaml +2 -0
  21. package/integration/hubspot/test-artifacts/wizard-invalid-mode.yaml +5 -0
  22. package/integration/hubspot/test-artifacts/wizard-invalid-openapi-file.yaml +5 -0
  23. package/integration/hubspot/test-artifacts/wizard-invalid-openapi-url.yaml +4 -0
  24. package/integration/hubspot/test-artifacts/wizard-invalid-source.yaml +4 -0
  25. package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-array-test.yaml +5 -0
  26. package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-key-test.yaml +5 -0
  27. package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-path-test.yaml +5 -0
  28. package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-test.yaml +5 -0
  29. package/integration/hubspot/test-artifacts/wizard-valid-for-rbac-test.yaml +5 -0
  30. package/integration/hubspot/test-artifacts/wizard-valid-for-rbac-yaml-test.yaml +5 -0
  31. package/integration/hubspot/test-dataplane-down-helpers.js +246 -0
  32. package/integration/hubspot/test-dataplane-down-tests.js +419 -0
  33. package/integration/hubspot/test-dataplane-down.js +157 -0
  34. package/integration/hubspot/test.js +1517 -0
  35. package/integration/hubspot/variables.yaml +4 -4
  36. package/integration/hubspot/wizard-hubspot-e2e.yaml +16 -0
  37. package/integration/hubspot/wizard-hubspot-platform.yaml +8 -0
  38. package/lib/api/applications.api.js +1 -0
  39. package/lib/api/index.js +6 -2
  40. package/lib/api/types/wizard.types.js +176 -38
  41. package/lib/api/wizard.api.js +161 -23
  42. package/lib/app/deploy.js +116 -54
  43. package/lib/app/display.js +6 -5
  44. package/lib/app/dockerfile.js +2 -1
  45. package/lib/app/list.js +17 -10
  46. package/lib/app/readme.js +41 -112
  47. package/lib/app/register.js +44 -9
  48. package/lib/app/rotate-secret.js +48 -31
  49. package/lib/cli.js +219 -70
  50. package/lib/commands/app.js +4 -9
  51. package/lib/commands/auth-config.js +125 -0
  52. package/lib/commands/auth-status.js +7 -8
  53. package/lib/commands/datasource.js +3 -6
  54. package/lib/commands/login-credentials.js +4 -4
  55. package/lib/commands/login-device.js +26 -17
  56. package/lib/commands/login.js +12 -10
  57. package/lib/commands/wizard-config-normalizer.js +92 -0
  58. package/lib/commands/wizard-core.js +515 -0
  59. package/lib/commands/wizard-dataplane.js +122 -0
  60. package/lib/commands/wizard-headless.js +115 -0
  61. package/lib/commands/wizard.js +110 -332
  62. package/lib/core/config.js +46 -0
  63. package/lib/core/secrets.js +3 -22
  64. package/lib/core/templates-env.js +1 -1
  65. package/lib/datasource/deploy.js +59 -23
  66. package/lib/datasource/list.js +108 -19
  67. package/lib/deployment/deployer.js +25 -0
  68. package/lib/deployment/environment.js +10 -13
  69. package/lib/external-system/delete.js +151 -0
  70. package/lib/external-system/deploy.js +53 -378
  71. package/lib/external-system/download-helpers.js +45 -65
  72. package/lib/external-system/download.js +33 -13
  73. package/lib/external-system/generator.js +11 -7
  74. package/lib/external-system/test-auth.js +4 -3
  75. package/lib/generator/builders.js +3 -1
  76. package/lib/generator/external-controller-manifest.js +157 -0
  77. package/lib/generator/external-schema-utils.js +236 -0
  78. package/lib/generator/external.js +55 -3
  79. package/lib/generator/index.js +22 -10
  80. package/lib/generator/wizard-prompts.js +33 -10
  81. package/lib/generator/wizard.js +69 -86
  82. package/lib/infrastructure/compose.js +100 -0
  83. package/lib/infrastructure/helpers.js +139 -0
  84. package/lib/infrastructure/index.js +52 -311
  85. package/lib/infrastructure/services.js +168 -0
  86. package/lib/schema/application-schema.json +23 -4
  87. package/lib/schema/external-datasource.schema.json +2 -2
  88. package/lib/schema/wizard-config.schema.json +234 -0
  89. package/lib/utils/api.js +102 -52
  90. package/lib/utils/app-existence.js +42 -0
  91. package/lib/utils/app-register-config.js +7 -2
  92. package/lib/utils/auth-config-validator.js +92 -0
  93. package/lib/utils/command-header.js +43 -0
  94. package/lib/utils/compose-generator.js +113 -70
  95. package/lib/utils/controller-url.js +65 -17
  96. package/lib/utils/dataplane-health.js +115 -0
  97. package/lib/utils/dataplane-resolver.js +29 -0
  98. package/lib/utils/dev-config.js +6 -2
  99. package/lib/utils/env-copy.js +2 -1
  100. package/lib/utils/env-ports.js +2 -1
  101. package/lib/utils/env-template.js +1 -1
  102. package/lib/utils/error-formatter.js +49 -0
  103. package/lib/utils/error-formatters/network-errors.js +13 -3
  104. package/lib/utils/external-readme.js +125 -0
  105. package/lib/utils/help-builder.js +190 -0
  106. package/lib/utils/infra-status.js +13 -3
  107. package/lib/utils/paths.js +17 -2
  108. package/lib/utils/port-resolver.js +111 -0
  109. package/lib/utils/secrets-helpers.js +3 -15
  110. package/lib/utils/secrets-utils.js +2 -2
  111. package/lib/utils/token-manager.js +9 -4
  112. package/lib/utils/variable-transformer.js +7 -2
  113. package/lib/validation/external-manifest-validator.js +202 -0
  114. package/lib/validation/validate-display.js +406 -0
  115. package/lib/validation/validate.js +159 -123
  116. package/lib/validation/validator.js +36 -3
  117. package/lib/validation/wizard-config-validator.js +267 -0
  118. package/package.json +4 -2
  119. package/templates/applications/README.md.hbs +18 -16
  120. package/templates/applications/miso-controller/env.template +1 -1
  121. package/templates/applications/miso-controller/rbac.yaml +7 -7
  122. package/templates/external-system/README.md.hbs +99 -0
  123. package/templates/github/ci.yaml.hbs +44 -1
  124. package/templates/github/release.yaml.hbs +44 -0
  125. package/templates/infra/compose.yaml.hbs +35 -0
  126. package/templates/python/docker-compose.hbs +26 -0
  127. package/templates/typescript/docker-compose.hbs +26 -0
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@aifabrix/builder",
3
- "version": "2.32.3",
3
+ "version": "2.33.1",
4
4
  "description": "AI Fabrix Local Fabric & Deployment SDK",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
7
- "aifabrix": "bin/aifabrix.js"
7
+ "aifabrix": "bin/aifabrix.js",
8
+ "aifx": "bin/aifabrix.js"
8
9
  },
9
10
  "scripts": {
10
11
  "test": "node tests/scripts/test-wrapper.js",
12
+ "test:ci": "bash tests/scripts/ci-simulate.sh",
11
13
  "test:coverage": "jest --config jest.config.coverage.js --coverage --runInBand",
12
14
  "test:coverage:nyc": "nyc --reporter=text --reporter=lcov --reporter=html jest --config jest.config.coverage.js --runInBand",
13
15
  "test:watch": "jest --watch",
@@ -18,11 +18,11 @@ npm install -g @aifabrix/builder
18
18
  # Check your environment
19
19
  aifabrix doctor
20
20
 
21
- # Login to controller (offline tokens are default)
21
+ # Login to controller (offline tokens are default; sets controller and environment in config)
22
22
  aifabrix login --method device --environment dev --controller http://localhost:3000
23
23
 
24
- # Register your application (gets you credentials automatically)
25
- aifabrix app register {{appName}} --environment dev
24
+ # Register your application (gets you credentials; uses controller and environment from config)
25
+ aifabrix app register {{appName}}
26
26
  ```
27
27
 
28
28
  ### 3. Build & Run Locally
@@ -38,7 +38,7 @@ aifabrix resolve {{appName}}
38
38
  aifabrix run {{appName}}
39
39
  ```
40
40
 
41
- **Access your app:** http://localhost:{{port}}
41
+ **Access your app:** http://localhost:{{localPort}}
42
42
 
43
43
  **View logs:**
44
44
  ```bash
@@ -60,8 +60,8 @@ aifabrix build {{appName}} --tag v1.0.0
60
60
  # Push to registry
61
61
  aifabrix push {{appName}} --registry {{registry}} --tag "v1.0.0,latest"
62
62
 
63
- # Deploy to miso-controller
64
- aifabrix deploy {{appName}} --controller https://controller.aifabrix.ai --environment dev
63
+ # Deploy (controller and environment from config; set via aifabrix login or aifabrix auth config)
64
+ aifabrix deploy {{appName}}
65
65
  ```
66
66
 
67
67
  ---
@@ -74,7 +74,7 @@ After registering your app, you automatically get credentials in your secret fil
74
74
 
75
75
  **Rotate credentials if needed:**
76
76
  ```bash
77
- aifabrix app rotate-secret {{appName}} --environment dev
77
+ aifabrix app rotate-secret {{appName}}
78
78
  ```
79
79
 
80
80
  ---
@@ -95,12 +95,12 @@ aifabrix resolve {{appName}} # Generate .env file
95
95
  aifabrix json {{appName}} # Preview deployment JSON
96
96
  aifabrix genkey {{appName}} # Generate deployment key
97
97
  aifabrix push {{appName}} --registry {{registry}} # Push to ACR
98
- aifabrix deploy {{appName}} --controller <url> # Deploy to Azure
98
+ aifabrix deploy {{appName}} # Deploy (controller/env from config)
99
99
 
100
100
  # Management
101
- aifabrix app register {{appName}} --environment dev
102
- aifabrix app list --environment dev
103
- aifabrix app rotate-secret {{appName}} --environment dev
101
+ aifabrix app register {{appName}}
102
+ aifabrix app list
103
+ aifabrix app rotate-secret {{appName}}
104
104
 
105
105
  # Utilities
106
106
  aifabrix doctor # Check environment
@@ -119,7 +119,7 @@ aifabrix build {{appName}} --language typescript # Override language detection
119
119
  ### Run Options
120
120
 
121
121
  ```bash
122
- aifabrix run {{appName}} --port {{port}} # Custom port
122
+ aifabrix run {{appName}} --port {{localPort}} # Override local port
123
123
  aifabrix run {{appName}} --debug # Debug output
124
124
  ```
125
125
 
@@ -133,8 +133,8 @@ aifabrix push {{appName}} --registry {{registry}} --tag "v1.0.0,latest,stable"
133
133
  ### Deploy Options
134
134
 
135
135
  ```bash
136
- aifabrix deploy {{appName}} --controller <url> --environment dev
137
- aifabrix deploy {{appName}} --controller <url> --environment dev --no-poll
136
+ aifabrix deploy {{appName}} # Uses controller and environment from config
137
+ aifabrix deploy {{appName}} --no-poll # Deploy without polling for status
138
138
  ```
139
139
 
140
140
  ### Login Methods
@@ -159,13 +159,15 @@ aifabrix-home: "/custom/path"
159
159
  aifabrix-secrets: "/path/to/secrets.yaml"
160
160
  ```
161
161
 
162
+ Controller URL and environment (for `deploy`, `app register`, etc.) are set via `aifabrix login` or `aifabrix auth config --set-controller <url> --set-environment <env>`.
163
+
162
164
  ---
163
165
 
164
166
  ## Troubleshooting
165
167
 
166
168
  - **"Docker not running"** → Start Docker Desktop
167
169
  - **"Not logged in"** → Run `aifabrix login` first
168
- - **"Port already in use"** → Use `--port` flag or change `build.localPort` in `variables.yaml` (default: {{port}})
170
+ - **"Port already in use"** → Use `aifabrix run {{appName}} --port <port>` or set `build.localPort` in `variables.yaml` (default: {{localPort}})
169
171
  - **"Authentication failed"** → Run `aifabrix login` again
170
172
  - **"Build fails"** → Check Docker is running and `aifabrix-secrets` in `config.yaml` is configured correctly
171
173
  - **"Can't connect"** → Verify infrastructure is running{{#if hasDatabase}} and PostgreSQL is accessible{{/if}}
@@ -203,4 +205,4 @@ aifabrix genkey {{appName}}
203
205
 
204
206
  ---
205
207
 
206
- **Application**: {{appName}} | **Port**: {{port}} | **Registry**: {{registry}} | **Image**: {{imageName}}:latest
208
+ **Application**: {{appName}} | **Port**: {{localPort}} | **Registry**: {{registry}} | **Image**: {{imageName}}:latest
@@ -21,7 +21,7 @@ ONBOARDING_INFRASTRUCTURE_NAME=
21
21
  # Password for the initial administrator user (username: admin)
22
22
  ONBOARDING_ADMIN_PASSWORD=kv://miso-controller-admin-passwordKeyVault
23
23
 
24
- # Optional admin email for onboarding (default: admin@aifabrix.ai)
24
+ # Optional admin email for onboarding (default: admin@aifabrix.dev)
25
25
  ONBOARDING_ADMIN_EMAIL=kv://miso-controller-admin-emailKeyVault
26
26
 
27
27
  # =============================================================================
@@ -2,37 +2,37 @@ roles:
2
2
  - name: 'AI Fabrix Platform Admin'
3
3
  value: 'aifabrix-platform-admin'
4
4
  description: 'Full platform infrastructure management and enterprise controller access'
5
- Groups: ['AI-Fabrix-Platform-Admins']
5
+ groups: ['AI-Fabrix-Platform-Admins']
6
6
 
7
7
  - name: 'AI Fabrix Security Admin'
8
8
  value: 'aifabrix-security-admin'
9
9
  description: 'Security and compliance management for enterprise controller'
10
- Groups: ['AI-Fabrix-Security-Admins']
10
+ groups: ['AI-Fabrix-Security-Admins']
11
11
 
12
12
  - name: 'AI Fabrix Infrastructure Admin'
13
13
  value: 'aifabrix-infrastructure-admin'
14
14
  description: 'Infrastructure deployment and management across environments'
15
- Groups: ['AI-Fabrix-Infrastructure-Admins']
15
+ groups: ['AI-Fabrix-Infrastructure-Admins']
16
16
 
17
17
  - name: 'AI Fabrix Deployment Admin'
18
18
  value: 'aifabrix-deployment-admin'
19
19
  description: 'Application deployment orchestration and environment management'
20
- Groups: ['AI-Fabrix-Deployment-Admins']
20
+ groups: ['AI-Fabrix-Deployment-Admins']
21
21
 
22
22
  - name: 'AI Fabrix Compliance Admin'
23
23
  value: 'aifabrix-compliance-admin'
24
24
  description: 'ISO 27001 compliance monitoring and audit management'
25
- Groups: ['AI-Fabrix-Compliance-Admins']
25
+ groups: ['AI-Fabrix-Compliance-Admins']
26
26
 
27
27
  - name: 'AI Fabrix Developer'
28
28
  value: 'aifabrix-developer'
29
29
  description: 'Developer access to deploy applications via GitHub Actions'
30
- Groups: ['AI-Fabrix-Developers']
30
+ groups: ['AI-Fabrix-Developers']
31
31
 
32
32
  - name: 'AI Fabrix Observer'
33
33
  value: 'aifabrix-observer'
34
34
  description: 'Read-only access to monitoring, logs, and compliance reports'
35
- Groups: ['AI-Fabrix-Observers']
35
+ groups: ['AI-Fabrix-Observers']
36
36
 
37
37
  permissions:
38
38
  # Service User Management
@@ -0,0 +1,99 @@
1
+ # {{displayName}}
2
+
3
+ {{description}}
4
+
5
+ ## System Information
6
+
7
+ - **System Key**: `{{systemKey}}`
8
+ - **System Type**: `{{systemType}}`
9
+ - **Datasources**: {{datasourceCount}}
10
+
11
+ ## Files
12
+
13
+ - `variables.yaml` – Application configuration with `app` and `externalIntegration` blocks
14
+ - `{{systemKey}}-system.json` – External system definition (authentication, OpenAPI/MCP, RBAC)
15
+ {{#each datasources}}
16
+ - `{{fileName}}` – Datasource: {{displayName}}
17
+ {{/each}}
18
+ - `env.template` – Environment variables template (secrets, API keys)
19
+ - `{{systemKey}}-deploy.json` – Deployment manifest (generated by `aifabrix json`)
20
+
21
+ Optional: `rbac.yaml` – Roles and permissions merged into the system when present.
22
+
23
+ ## Quick Start
24
+
25
+ ### 1. Create External System
26
+
27
+ ```bash
28
+ aifabrix create {{appName}} --type external
29
+ ```
30
+
31
+ Or use the interactive wizard:
32
+
33
+ ```bash
34
+ aifabrix wizard --app {{appName}}
35
+ ```
36
+
37
+ ### 2. Configure Authentication and Datasources
38
+
39
+ Edit files in `integration/{{appName}}/`:
40
+
41
+ - **Authentication**: `{{systemKey}}-system.json` (auth type, credentials placeholders)
42
+ - **Field mappings**: `{{systemKey}}-datasource-*.json` (dimensions, attributes, operations)
43
+
44
+ ### 3. Validate Configuration
45
+
46
+ ```bash
47
+ aifabrix validate {{appName}} --type external
48
+ ```
49
+
50
+ ### 4. Generate Deployment Manifest
51
+
52
+ ```bash
53
+ aifabrix json {{appName}} --type external
54
+ ```
55
+
56
+ This creates `{{systemKey}}-deploy.json` in `integration/{{appName}}/`.
57
+
58
+ ### 5. Deploy
59
+
60
+ Controller URL and environment are read from config. Configure and log in first:
61
+
62
+ ```bash
63
+ aifabrix auth config --set-controller <url> --set-environment dev
64
+ aifabrix login
65
+ ```
66
+
67
+ Then deploy:
68
+
69
+ ```bash
70
+ aifabrix deploy {{appName}}
71
+ ```
72
+
73
+ ## Testing
74
+
75
+ ### Unit Tests (Local Validation, No API)
76
+
77
+ ```bash
78
+ aifabrix test {{appName}}
79
+ ```
80
+
81
+ ### Integration Tests (Via Dataplane)
82
+
83
+ ```bash
84
+ aifabrix test-integration {{appName}}
85
+ ```
86
+
87
+ ## Deployment
88
+
89
+ Deploy via miso-controller pipeline (same as regular apps). Auth and controller come from `aifabrix login` and `aifabrix auth config`:
90
+
91
+ ```bash
92
+ aifabrix deploy {{appName}}
93
+ ```
94
+
95
+ ## Troubleshooting
96
+
97
+ - **Validation errors**: Run `aifabrix validate {{appName}} --type external` to see schema and manifest errors.
98
+ - **Deployment / auth**: Run `aifabrix auth config --set-controller <url> --set-environment <env>` and `aifabrix login` before `aifabrix deploy`.
99
+ - **File not found**: Run commands from the project root (where `package.json` and `integration/` live).
@@ -12,4 +12,47 @@ jobs:
12
12
  with:
13
13
  node-version: '20'
14
14
  - name: Run tests
15
- run: npm test
15
+ run: npm test
16
+
17
+ deploy:
18
+ name: Deploy to AI Fabrix
19
+ runs-on: ubuntu-latest
20
+ needs: test
21
+ # Note: This workflow deploys to ACR (Azure Container Registry) and Azure
22
+ # For local deployment, use 'aifabrix deploy {{appName}}' directly from your machine
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - name: Setup Node.js
27
+ uses: actions/setup-node@v4
28
+ with:
29
+ node-version: '20'
30
+
31
+ - name: Install AI Fabrix Builder
32
+ run: npm install -g @aifabrix/builder
33
+
34
+ - name: Authenticate with Controller
35
+ run: |
36
+ set -e
37
+ aifabrix login \
38
+ --method credentials \
39
+ --app {{appName}} \
40
+ --client-id ${{ secrets.DEV_MISO_CLIENTID }} \
41
+ --client-secret ${{ secrets.DEV_MISO_CLIENTSECRET }} \
42
+ --controller ${{ secrets.MISO_CONTROLLER_URL }} \
43
+ --environment dev
44
+
45
+ - name: Validate Application Manifest
46
+ run: |
47
+ set -e
48
+ aifabrix validate {{appName}}
49
+
50
+ - name: Build Docker Image
51
+ run: |
52
+ set -e
53
+ aifabrix build {{appName}} --tag ${{ github.sha }}
54
+
55
+ - name: Deploy Application
56
+ run: |
57
+ set -e
58
+ aifabrix deploy {{appName}}
@@ -56,3 +56,47 @@ jobs:
56
56
  body: Release {{appName}} ${{ github.ref }}
57
57
  draft: false
58
58
  prerelease: false
59
+
60
+ deploy:
61
+ name: Deploy to AI Fabrix
62
+ runs-on: ubuntu-latest
63
+ needs: create-release
64
+ # Note: This workflow deploys to ACR (Azure Container Registry) and Azure
65
+ # For local deployment, use 'aifabrix deploy {{appName}}' directly from your machine
66
+ steps:
67
+ - uses: actions/checkout@v4
68
+
69
+ - name: Setup Node.js
70
+ uses: actions/setup-node@v4
71
+ with:
72
+ node-version: '20'
73
+
74
+ - name: Install AI Fabrix Builder
75
+ run: npm install -g @aifabrix/builder
76
+
77
+ - name: Authenticate with Controller
78
+ run: |
79
+ set -e
80
+ aifabrix login \
81
+ --method credentials \
82
+ --app {{appName}} \
83
+ --client-id ${{ secrets.PRO_MISO_CLIENTID }} \
84
+ --client-secret ${{ secrets.PRO_MISO_CLIENTSECRET }} \
85
+ --controller ${{ secrets.MISO_CONTROLLER_URL }} \
86
+ --environment pro
87
+
88
+ - name: Validate Application Manifest
89
+ run: |
90
+ set -e
91
+ aifabrix validate {{appName}}
92
+
93
+ - name: Build Docker Image
94
+ run: |
95
+ set -e
96
+ TAG_VERSION=${GITHUB_REF#refs/tags/v}
97
+ aifabrix build {{appName}} --tag $TAG_VERSION
98
+
99
+ - name: Deploy Application
100
+ run: |
101
+ set -e
102
+ aifabrix deploy {{appName}}
@@ -96,6 +96,41 @@ services:
96
96
  networks:
97
97
  - {{networkName}}
98
98
 
99
+ {{#if traefik.enabled}}
100
+ # Traefik Reverse Proxy
101
+ traefik:
102
+ image: traefik:v3.6
103
+ container_name: {{#if (eq devId 0)}}aifabrix-traefik{{else}}aifabrix-dev{{devId}}-traefik{{/if}}
104
+ command:
105
+ - "--providers.docker=true"
106
+ - "--providers.docker.exposedbydefault=false"
107
+ - "--providers.docker.network={{networkName}}"
108
+ - "--entrypoints.web.address=:80"
109
+ - "--entrypoints.websecure.address=:443"
110
+ {{#if traefik.certStore}}
111
+ {{#if traefik.certFile}}
112
+ - "--certificatesstores.{{traefik.certStore}}.defaultcertificate.certfile={{traefik.certFile}}"
113
+ {{/if}}
114
+ {{#if traefik.keyFile}}
115
+ - "--certificatesstores.{{traefik.certStore}}.defaultcertificate.keyfile={{traefik.keyFile}}"
116
+ {{/if}}
117
+ {{/if}}
118
+ ports:
119
+ - "{{traefikHttpPort}}:80"
120
+ - "{{traefikHttpsPort}}:443"
121
+ volumes:
122
+ - /var/run/docker.sock:/var/run/docker.sock:ro
123
+ {{#if traefik.certFile}}
124
+ - {{traefik.certFile}}:{{traefik.certFile}}:ro
125
+ {{/if}}
126
+ {{#if traefik.keyFile}}
127
+ - {{traefik.keyFile}}:{{traefik.keyFile}}:ro
128
+ {{/if}}
129
+ networks:
130
+ - {{networkName}}
131
+ restart: unless-stopped
132
+ {{/if}}
133
+
99
134
  volumes:
100
135
  {{#if (eq devId 0)}}postgres_data{{else}}dev{{devId}}_postgres_data{{/if}}:
101
136
  name: {{#if (eq devId 0)}}infra_postgres_data{{else}}infra_dev{{devId}}_postgres_data{{/if}}
@@ -6,6 +6,32 @@ services:
6
6
  {{app.key}}:
7
7
  image: {{image.name}}:{{image.tag}}
8
8
  container_name: {{containerName}}
9
+ {{#if traefik.enabled}}
10
+ labels:
11
+ - "traefik.enable=true"
12
+ - "traefik.http.routers.{{app.key}}.rule=Host(`{{traefik.host}}`) && PathPrefix(`{{traefik.path}}`)"
13
+ {{#if traefik.tls}}
14
+ - "traefik.http.routers.{{app.key}}.entrypoints=websecure"
15
+ - "traefik.http.routers.{{app.key}}.tls=true"
16
+ {{#if traefik.certStore}}
17
+ - "traefik.http.routers.{{app.key}}.tls.certstore={{traefik.certStore}}"
18
+ {{/if}}
19
+ {{else}}
20
+ - "traefik.http.routers.{{app.key}}.entrypoints=web"
21
+ {{/if}}
22
+ - "traefik.http.services.{{app.key}}.loadbalancer.server.port={{containerPort}}"
23
+ {{#unless (eq traefik.path "/")}}
24
+ - "traefik.http.middlewares.{{app.key}}-stripprefix.stripprefix.prefixes={{traefik.path}}"
25
+ - "traefik.http.routers.{{app.key}}.middlewares={{app.key}}-stripprefix"
26
+ {{/unless}}
27
+ {{/if}}
28
+ {{#if traefik.enabled}}
29
+ {{#unless (eq traefik.path "/")}}
30
+ environment:
31
+ - BASE_PATH={{traefik.path}}
32
+ - X_FORWARDED_PREFIX={{traefik.path}}
33
+ {{/unless}}
34
+ {{/if}}
9
35
  env_file:
10
36
  - {{envFile}}
11
37
  ports:
@@ -6,6 +6,32 @@ services:
6
6
  {{app.key}}:
7
7
  image: {{image.name}}:{{image.tag}}
8
8
  container_name: {{containerName}}
9
+ {{#if traefik.enabled}}
10
+ labels:
11
+ - "traefik.enable=true"
12
+ - "traefik.http.routers.{{app.key}}.rule=Host(`{{traefik.host}}`) && PathPrefix(`{{traefik.path}}`)"
13
+ {{#if traefik.tls}}
14
+ - "traefik.http.routers.{{app.key}}.entrypoints=websecure"
15
+ - "traefik.http.routers.{{app.key}}.tls=true"
16
+ {{#if traefik.certStore}}
17
+ - "traefik.http.routers.{{app.key}}.tls.certstore={{traefik.certStore}}"
18
+ {{/if}}
19
+ {{else}}
20
+ - "traefik.http.routers.{{app.key}}.entrypoints=web"
21
+ {{/if}}
22
+ - "traefik.http.services.{{app.key}}.loadbalancer.server.port={{containerPort}}"
23
+ {{#unless (eq traefik.path "/")}}
24
+ - "traefik.http.middlewares.{{app.key}}-stripprefix.stripprefix.prefixes={{traefik.path}}"
25
+ - "traefik.http.routers.{{app.key}}.middlewares={{app.key}}-stripprefix"
26
+ {{/unless}}
27
+ {{/if}}
28
+ {{#if traefik.enabled}}
29
+ {{#unless (eq traefik.path "/")}}
30
+ environment:
31
+ - BASE_PATH={{traefik.path}}
32
+ - X_FORWARDED_PREFIX={{traefik.path}}
33
+ {{/unless}}
34
+ {{/if}}
9
35
  env_file:
10
36
  - {{envFile}}
11
37
  ports: