mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-05 06:04:49 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0bfe03898 | ||
|
|
177ec6368c | ||
|
|
e7f410831f |
@@ -0,0 +1,482 @@
|
||||
# Maestro ↔ In-Factory Migration Map
|
||||
|
||||
This document maps all integration points between Maestro and In-Factory that need to be addressed to remove the dependency.
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
```mermaid
|
||||
graph TD;
|
||||
Frontend<-->Maestro;
|
||||
Maestro<-->DUC;
|
||||
Maestro<-->pi-factory;
|
||||
Maestro<-->in-factory;
|
||||
```
|
||||
|
||||
Maestro connects to **3 external microservices**:
|
||||
- **DUC** (`DUC_URL`) - User management, authentication, permissions
|
||||
- **PI-Factory** (`PIFACTORY_URL`) - Pipelines, Catalog services
|
||||
- **IN-Factory** (`INFACTORY_URL`) - Connections, Connectors, Inputs, Network Config, Transformations
|
||||
|
||||
---
|
||||
|
||||
## Summary Table
|
||||
|
||||
| Category | Count | Impact Level |
|
||||
|----------|-------|--------------|
|
||||
| gRPC Client Configurations | 6 | HIGH |
|
||||
| NestJS Modules | 6 | HIGH |
|
||||
| REST Controllers/Endpoints | 6 | HIGH |
|
||||
| Service Classes | 6 | HIGH |
|
||||
| Configuration Files | 5 | MEDIUM |
|
||||
| Proto Package Dependencies | 2 | HIGH |
|
||||
| Environment Variables | 2 | LOW |
|
||||
|
||||
---
|
||||
|
||||
## 1. gRPC CLIENT CONFIGURATIONS (Files to Migrate)
|
||||
|
||||
These files configure gRPC connections to In-Factory services:
|
||||
|
||||
### 1.1 Connection Client (`INFACTORY_URL`)
|
||||
**File:** `src/modules/connection/client.config.ts`
|
||||
```typescript
|
||||
// Lines 10-11, 18
|
||||
process.env.INFACTORY_URL.startsWith('in-factory:')
|
||||
process.env.INFACTORY_URL.includes('0.0.0.0')
|
||||
url: process.env.INFACTORY_URL
|
||||
```
|
||||
**Proto Services Used:**
|
||||
- `ConnectionManager.ProtoPackages.WritePackage`
|
||||
- `ConnectionManager.ProtoPackages.ReadPackage`
|
||||
|
||||
### 1.2 Connector Client (`INFACTORY_URL`)
|
||||
**File:** `src/modules/connector/client.config.ts`
|
||||
```typescript
|
||||
// Lines 10-11, 18
|
||||
url: process.env.INFACTORY_URL
|
||||
```
|
||||
**Proto Services Used:**
|
||||
- `ConnectorManager.ProtoPackages.WritePackage`
|
||||
- `ConnectorManager.ProtoPackages.ReadPackage`
|
||||
|
||||
### 1.3 Inputs Client (`INFACTORY_URL`)
|
||||
**File:** `src/modules/inputs/inputs-client.config.ts`
|
||||
```typescript
|
||||
// Lines 10-11, 17
|
||||
url: process.env.INFACTORY_URL
|
||||
```
|
||||
**Proto Services Used:**
|
||||
- `Input.ProtoPackages.WritePackage`
|
||||
- `Input.ProtoPackages.ReadPackage`
|
||||
|
||||
### 1.4 Network Config Client (`INFACTORY_URL`)
|
||||
**File:** `src/modules/network-config/network-config-client.config.ts`
|
||||
```typescript
|
||||
// Lines 10-11, 19
|
||||
url: process.env.INFACTORY_URL
|
||||
```
|
||||
**Proto Services Used:**
|
||||
- `NetworkConfig.ProtoPackages.WritePackage`
|
||||
- `NetworkConfig.ProtoPackages.ReadPackage`
|
||||
|
||||
### 1.5 Connection Test Client (`INFACTORY_URL`)
|
||||
**File:** `src/modules/connection-test/connection-test-client.config.ts`
|
||||
```typescript
|
||||
// Lines 10-11, 17
|
||||
url: process.env.INFACTORY_URL
|
||||
```
|
||||
**Proto Services Used:**
|
||||
- `ConnectionTest.ProtoPackages.ReadPackage`
|
||||
|
||||
### 1.6 Transformations Client (`INFACTORY_URL`)
|
||||
**File:** `src/modules/transformations/transformations-client.ts`
|
||||
```typescript
|
||||
// Lines 10-11, 18
|
||||
url: process.env.INFACTORY_URL
|
||||
```
|
||||
**Proto Services Used:**
|
||||
- `Transformation.ProtoPackages.WritePackage`
|
||||
|
||||
---
|
||||
|
||||
## 2. SERVICE CLASSES (Business Logic to Migrate)
|
||||
|
||||
### 2.1 Connection Client Service
|
||||
**File:** `src/modules/connection/client.service.ts`
|
||||
|
||||
**gRPC Methods Called:**
|
||||
| Method | Service | Direction |
|
||||
|--------|---------|-----------|
|
||||
| `CreateConnection()` | ConnectionManagerWriteServices | Write |
|
||||
| `UpdateConnection()` | ConnectionManagerWriteServices | Write |
|
||||
| `DeleteConnection()` | ConnectionManagerWriteServices | Write |
|
||||
| `GetConnectionDetails()` | ConnectionManagerReadServices | Read |
|
||||
| `GetAllConnections()` | ConnectionManagerReadServices | Read |
|
||||
| `GetConnectorAvailableConnectionsByCustomer()` | ConnectionManagerReadServices | Read |
|
||||
| `ValidatePlatformConnections()` | ConnectionManagerReadServices | Read |
|
||||
|
||||
**Key Methods:**
|
||||
- `createConnection()`
|
||||
- `updateConnection()`
|
||||
- `deleteConnection()`
|
||||
- `getConnections()`
|
||||
- `getConnectionDetails()`
|
||||
- `validatePlatformConnections()`
|
||||
|
||||
### 2.2 Connector Client Service
|
||||
**File:** `src/modules/connector/client.service.ts`
|
||||
|
||||
**gRPC Methods Called:**
|
||||
| Method | Service | Direction |
|
||||
|--------|---------|-----------|
|
||||
| `RegisterConnector()` | ConnectorManagerWriteServices | Write |
|
||||
| `UploadFile()` | ConnectorManagerWriteServices | Write |
|
||||
| `RegisterMultipleConnectorsWithoutImage()` | ConnectorManagerWriteServices | Write |
|
||||
| `UpdateConnectorByID()` | ConnectorManagerWriteServices | Write |
|
||||
| `DeleteConnectorById()` | ConnectorManagerWriteServices | Write |
|
||||
| `GetConnectors()` | ConnectorManagerReadServices | Read |
|
||||
|
||||
### 2.3 Inputs Service
|
||||
**File:** `src/modules/inputs/inputs.service.ts`
|
||||
|
||||
**gRPC Methods Called:**
|
||||
| Method | Service | Direction |
|
||||
|--------|---------|-----------|
|
||||
| `CreateInput()` | InputWriteService | Write |
|
||||
| `UpdateInput()` | InputWriteService | Write |
|
||||
| `DeleteInput()` | InputWriteService | Write |
|
||||
| `GetAvailableEntities()` | InputReadService | Read |
|
||||
|
||||
### 2.4 Network Config Service
|
||||
**File:** `src/modules/network-config/network-config.service.ts`
|
||||
|
||||
**gRPC Methods Called:**
|
||||
| Method | Service | Direction |
|
||||
|--------|---------|-----------|
|
||||
| `NetworkConfigCreate()` | NetworkConfigWriteService | Write |
|
||||
| `NetworkConfigUpdate()` | NetworkConfigWriteService | Write |
|
||||
| `NetworkConfigDelete()` | NetworkConfigWriteService | Write |
|
||||
| `NetworkConfigFindAll()` | NetworkConfigReadService | Read |
|
||||
| `NetworkConfigFindOneById()` | NetworkConfigReadService | Read |
|
||||
|
||||
### 2.5 Connection Test Service
|
||||
**File:** `src/modules/connection-test/connection-test.service.ts`
|
||||
|
||||
**gRPC Methods Called:**
|
||||
| Method | Service | Direction |
|
||||
|--------|---------|-----------|
|
||||
| `TestConnection()` | ConnectionTestReadService | Read |
|
||||
|
||||
### 2.6 Transformations Service
|
||||
**File:** `src/modules/transformations/client.service.ts`
|
||||
|
||||
**gRPC Methods Called:**
|
||||
| Method | Service | Direction |
|
||||
|--------|---------|-----------|
|
||||
| `CreateTransformation()` | TransformationWriteService | Write |
|
||||
| `UpdateTransformation()` | TransformationWriteService | Write |
|
||||
| `DeleteTransformation()` | TransformationWriteService | Write |
|
||||
| Various read operations | TransformationReadService | Read |
|
||||
|
||||
---
|
||||
|
||||
## 3. NESTJS MODULES (Module Registration)
|
||||
|
||||
These modules register the gRPC clients and export services:
|
||||
|
||||
| Module | File | Imports | Exports |
|
||||
|--------|------|---------|---------|
|
||||
| ConnectionModule | `src/modules/connection/connection.module.ts` | ConnectionClientConfiguration | ConnectionClientService |
|
||||
| ConnectorModule | `src/modules/connector/connector.module.ts` | ConnectorClientConfiguration | ConnectorClientService |
|
||||
| InputsModule | `src/modules/inputs/inputs.module.ts` | InputsGrpcClient | InputsService |
|
||||
| NetworkConfigModule | `src/modules/network-config/network-config.module.ts` | NetworkConfigGrpcClient | NetworkConfigService |
|
||||
| ConnectionTestModule | `src/modules/connection-test/connection-test.module.ts` | ConnectionTestClientConfiguration | ConnectionTestService |
|
||||
| TransformationsModule | `src/modules/transformations/transformations.module.ts` | TransformationsClientConfiguration | TransformationsService |
|
||||
|
||||
**App Module Registration:** `src/app.module.ts` (Lines 15-21, 50-60)
|
||||
|
||||
---
|
||||
|
||||
## 4. REST CONTROLLERS (API Endpoints to Migrate)
|
||||
|
||||
### 4.1 Connection Controller
|
||||
**File:** `src/modules/connection/connection.controller.ts`
|
||||
|
||||
| HTTP Method | Endpoint | Description |
|
||||
|-------------|----------|-------------|
|
||||
| POST | `/connections` | Create a new connection |
|
||||
| PUT | `/connections/:id` | Update an existing connection |
|
||||
| DELETE | `/connections/:id` | Delete a connection |
|
||||
| GET | `/connections` | Get all connections |
|
||||
| GET | `/connections/:id` | Get connection details |
|
||||
| GET | `/connections/available/:connector_id` | Get available connections by connector |
|
||||
|
||||
### 4.2 Connector Controller
|
||||
**File:** `src/modules/connector/connector.controller.ts`
|
||||
|
||||
| HTTP Method | Endpoint | Description |
|
||||
|-------------|----------|-------------|
|
||||
| POST | `/connectors` | Register a new connector |
|
||||
| POST | `/connectors/uploads` | Upload multiple connector files |
|
||||
| GET | `/connectors` | List all connectors |
|
||||
| PUT | `/connectors/:id` | Update a connector |
|
||||
| DELETE | `/connectors/:id` | Delete a connector |
|
||||
|
||||
### 4.3 Inputs Controller
|
||||
**File:** `src/modules/inputs/inputs.controller.ts`
|
||||
|
||||
| HTTP Method | Endpoint | Description |
|
||||
|-------------|----------|-------------|
|
||||
| GET | `/inputs/available-entities/:plugin` | Get available entities for a plugin |
|
||||
| POST | `/inputs` | Create an input |
|
||||
| PATCH | `/inputs` | Update an input |
|
||||
| DELETE | `/inputs/:id` | Delete an input |
|
||||
|
||||
### 4.4 Network Config Controller
|
||||
**File:** `src/modules/network-config/network-config.controller.ts`
|
||||
|
||||
| HTTP Method | Endpoint | Description |
|
||||
|-------------|----------|-------------|
|
||||
| GET | `/network-configs` | Get all network configurations |
|
||||
| GET | `/network-configs/:id` | Get network config by ID |
|
||||
| POST | `/network-configs` | Create network configuration |
|
||||
| PUT | `/network-configs/:id` | Update network configuration |
|
||||
| DELETE | `/network-configs/:id` | Delete network configuration |
|
||||
|
||||
### 4.5 Connection Test Controller
|
||||
**File:** `src/modules/connection-test/connection-test.controller.ts`
|
||||
|
||||
| HTTP Method | Endpoint | Description |
|
||||
|-------------|----------|-------------|
|
||||
| POST | `/connection-test` | Test a connection |
|
||||
|
||||
### 4.6 Transformations Controller
|
||||
**File:** `src/modules/transformations/transformations.controller.ts`
|
||||
|
||||
| HTTP Method | Endpoint | Description |
|
||||
|-------------|----------|-------------|
|
||||
| POST | `/transformations` | Create transformation |
|
||||
| GET | `/transformations` | Get transformations |
|
||||
| PUT | `/transformations/:id` | Update transformation |
|
||||
| DELETE | `/transformations/:id` | Delete transformation |
|
||||
|
||||
---
|
||||
|
||||
## 5. CONFIGURATION FILES
|
||||
|
||||
### 5.1 Helm Chart Values (Production)
|
||||
**File:** `deploy/helm-chart/values.yaml`
|
||||
```yaml
|
||||
# Lines 32, 42
|
||||
maestro:
|
||||
in_factory_url: in-factory.dadosfera.ai
|
||||
tr_factory_url: in-factory.dadosfera.ai # Transformation factory also uses in-factory
|
||||
```
|
||||
|
||||
### 5.2 Helm Chart Values (Staging)
|
||||
**File:** `deploy/helm-chart/values-stg.yaml`
|
||||
```yaml
|
||||
# Lines 5-6
|
||||
maestro:
|
||||
in_factory_url: in-factory.stg.dadosfera.ai
|
||||
tr_factory_url: in-factory.stg.dadosfera.ai
|
||||
```
|
||||
|
||||
### 5.3 Helmfiles (Production)
|
||||
**File:** `deploy/helmfiles/prd.yaml`
|
||||
```yaml
|
||||
# Lines 15-18, 39-42 (for both maestro and maestro-unimed releases)
|
||||
maestro.in_factory_url: in-factory.dadosfera.ai
|
||||
maestro.tr_factory_url: in-factory.dadosfera.ai
|
||||
```
|
||||
|
||||
### 5.4 Deployment Template
|
||||
**File:** `deploy/helm-chart/templates/deployment.yaml`
|
||||
```yaml
|
||||
# Lines 71-72
|
||||
- name: INFACTORY_URL
|
||||
value: {{ .Values.maestro.in_factory_url }}
|
||||
```
|
||||
|
||||
### 5.5 Environment Type Definition
|
||||
**File:** `environment.d.ts`
|
||||
```typescript
|
||||
// Line 9
|
||||
INFACTORY_URL: string;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. PROTO PACKAGE DEPENDENCIES
|
||||
|
||||
### 6.1 Package.json
|
||||
**File:** `package.json`
|
||||
```json
|
||||
{
|
||||
"@dadosfera/protospack": "2.5.3",
|
||||
"@dadosfera/protospack-v2": "3.38.0-beta.14"
|
||||
}
|
||||
```
|
||||
|
||||
### 6.2 Proto Imports from `@dadosfera/protospack-v2` (In-Factory related)
|
||||
|
||||
| Import Path | Used In |
|
||||
|-------------|---------|
|
||||
| `ConnectionManager` | connection/client.config.ts, connection/client.service.ts |
|
||||
| `ConnectionManager/interfaces/messages` | connection/client.service.ts, connection/dtos/connection.ts |
|
||||
| `ConnectionManager/interfaces/entities` | connection/dtos/connection.ts |
|
||||
| `ConnectorManager` | connector/client.config.ts, connector/client.service.ts |
|
||||
| `Input` | inputs/inputs-client.config.ts, inputs/inputs.service.ts |
|
||||
| `Input/interfaces/messages` | inputs/inputs.service.ts |
|
||||
| `Input/interfaces/entities` | inputs/inputs.controller.ts, inputs/inputs.service.ts |
|
||||
| `NetworkConfig` | network-config/network-config-client.config.ts, network-config/network-config.service.ts |
|
||||
| `NetworkConfig/interfaces/entities` | network-config/dto/network-config.ts |
|
||||
| `ConnectionTest` | connection-test/connection-test-client.config.ts, connection-test/connection-test.service.ts |
|
||||
| `Transformation` | transformations/transformations-client.ts, transformations/client.service.ts |
|
||||
|
||||
---
|
||||
|
||||
## 7. MIGRATION STRATEGY OPTIONS
|
||||
|
||||
### Option A: Move In-Factory functionality INTO Maestro
|
||||
**Pros:**
|
||||
- Single service to maintain
|
||||
- No network latency for these operations
|
||||
- Simpler deployment
|
||||
|
||||
**Cons:**
|
||||
- Increases Maestro's responsibility/complexity
|
||||
- Requires database access from Maestro
|
||||
- May require significant refactoring
|
||||
|
||||
**Files to create/migrate:**
|
||||
1. Database models for connections, connectors, inputs, network-configs, transformations
|
||||
2. Repository layer for database operations
|
||||
3. Convert gRPC services to internal services
|
||||
4. Remove all gRPC client configurations
|
||||
|
||||
### Option B: Create REST API wrapper in In-Factory
|
||||
**Pros:**
|
||||
- Minimal changes to Maestro
|
||||
- Can migrate incrementally
|
||||
|
||||
**Cons:**
|
||||
- Still maintains dependency
|
||||
- Additional REST→gRPC translation layer
|
||||
|
||||
### Option C: Direct database access from Maestro
|
||||
**Pros:**
|
||||
- Removes runtime dependency
|
||||
- Better performance
|
||||
|
||||
**Cons:**
|
||||
- Shared database coupling
|
||||
- Complex migration
|
||||
|
||||
---
|
||||
|
||||
## 8. FILES TO MODIFY/DELETE (Summary)
|
||||
|
||||
### High Priority - Core Integration Files
|
||||
```
|
||||
src/modules/connection/client.config.ts → DELETE or REPLACE
|
||||
src/modules/connection/client.service.ts → REPLACE with local implementation
|
||||
src/modules/connector/client.config.ts → DELETE or REPLACE
|
||||
src/modules/connector/client.service.ts → REPLACE with local implementation
|
||||
src/modules/inputs/inputs-client.config.ts → DELETE or REPLACE
|
||||
src/modules/inputs/inputs.service.ts → REPLACE with local implementation
|
||||
src/modules/network-config/network-config-client.config.ts → DELETE or REPLACE
|
||||
src/modules/network-config/network-config.service.ts → REPLACE with local implementation
|
||||
src/modules/connection-test/connection-test-client.config.ts → DELETE or REPLACE
|
||||
src/modules/connection-test/connection-test.service.ts → REPLACE with local implementation
|
||||
src/modules/transformations/transformations-client.ts → DELETE or REPLACE
|
||||
src/modules/transformations/client.service.ts → REPLACE with local implementation
|
||||
```
|
||||
|
||||
### Medium Priority - Module Registration
|
||||
```
|
||||
src/modules/connection/connection.module.ts → UPDATE imports
|
||||
src/modules/connector/connector.module.ts → UPDATE imports
|
||||
src/modules/inputs/inputs.module.ts → UPDATE imports
|
||||
src/modules/network-config/network-config.module.ts → UPDATE imports
|
||||
src/modules/connection-test/connection-test.module.ts → UPDATE imports
|
||||
src/modules/transformations/transformations.module.ts → UPDATE imports
|
||||
src/app.module.ts → UPDATE if module structure changes
|
||||
```
|
||||
|
||||
### Low Priority - Configuration
|
||||
```
|
||||
deploy/helm-chart/values.yaml → REMOVE in_factory_url, tr_factory_url
|
||||
deploy/helm-chart/values-stg.yaml → REMOVE in_factory_url, tr_factory_url
|
||||
deploy/helmfiles/prd.yaml → REMOVE in_factory_url references
|
||||
deploy/helm-chart/templates/deployment.yaml → REMOVE INFACTORY_URL env var
|
||||
environment.d.ts → REMOVE INFACTORY_URL type
|
||||
README.md → UPDATE architecture diagram
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. DEPENDENCY COUNT BY MODULE
|
||||
|
||||
| Module | Files | gRPC Calls | REST Endpoints |
|
||||
|--------|-------|------------|----------------|
|
||||
| Connection | 4 | 7 | 6 |
|
||||
| Connector | 3 | 6 | 5 |
|
||||
| Inputs | 3 | 4 | 4 |
|
||||
| Network Config | 3 | 5 | 5 |
|
||||
| Connection Test | 3 | 1 | 1 |
|
||||
| Transformations | 4 | 4+ | 4 |
|
||||
| **TOTAL** | **20** | **27+** | **25** |
|
||||
|
||||
---
|
||||
|
||||
## 10. DATA MODELS (Proto Messages Used)
|
||||
|
||||
### Connection Manager
|
||||
- `CreateConnectionRequest` / `CreateConnectionResponse`
|
||||
- `UpdateConnectionRequest` / `UpdateConnectionResponse`
|
||||
- `DeleteConnectionRequest` / `DeleteConnectionResponse`
|
||||
- `GetConnectionDetailsRequest` / `GetConnectionDetailsResponse`
|
||||
- `GetAllConnectionsRequest` / `GetAllConnectionsResponse`
|
||||
- `Connection` (entity)
|
||||
- `ConnectionCredential` (entity)
|
||||
|
||||
### Connector Manager
|
||||
- `RegisterConnectorRequest` / `RegisterConnectorResponse`
|
||||
- `UploadFileRequest` / `UploadFileResponse`
|
||||
- `GetConnectorsRequest` / `GetConnectorsResponse`
|
||||
- `Connector` (entity)
|
||||
|
||||
### Input
|
||||
- `CreateInputRequest` / `CreateInputResponse`
|
||||
- `UpdateInputRequest` / `UpdateInputResponse`
|
||||
- `DeleteInputRequest` / `DeleteInputResponse`
|
||||
- `GetAvailableEntitiesRequest` / `GetAvailableEntitiesResponse`
|
||||
- `Info` (entity)
|
||||
|
||||
### Network Config
|
||||
- `NetworkConfigCreateRequest` / `NetworkConfigCreateResponse`
|
||||
- `NetworkConfigUpdateRequest` / `NetworkConfigUpdateResponse`
|
||||
- `NetworkConfigDeleteRequest` / `NetworkConfigDeleteResponse`
|
||||
- `NetworkConfigFindAllRequest` / `NetworkConfigFindAllResponse`
|
||||
- `NetworkConfig` (entity)
|
||||
|
||||
### Connection Test
|
||||
- `TestConnectionRequest` / `TestConnectionResponse`
|
||||
|
||||
### Transformation
|
||||
- `CreateTransformationRequest` / `CreateTransformationResponse`
|
||||
- `UpdateTransformationRequest` / `UpdateTransformationResponse`
|
||||
- `DeleteTransformationRequest` / `DeleteTransformationResponse`
|
||||
|
||||
---
|
||||
|
||||
## NEXT STEPS
|
||||
|
||||
1. **Decide on migration strategy** (Option A, B, or C)
|
||||
2. **Prioritize modules** - Recommend starting with Connection Test (smallest), then Inputs, Network Config, Transformations, Connection, Connector (largest)
|
||||
3. **Create database schema** if moving to Option A
|
||||
4. **Implement local services** one module at a time
|
||||
5. **Update tests** for each migrated module
|
||||
6. **Update deployment configs** to remove INFACTORY_URL
|
||||
7. **Coordinate with In-Factory team** for data migration
|
||||
@@ -0,0 +1,320 @@
|
||||
# In-Factory Side - Migration Requirements
|
||||
|
||||
This document outlines what needs to be addressed in the **In-Factory** service to remove its coupling with Maestro.
|
||||
|
||||
> **Note:** This analysis is based on the Maestro codebase. For a complete analysis, the In-Factory repository should also be reviewed.
|
||||
|
||||
---
|
||||
|
||||
## Current Architecture (In-Factory → Maestro)
|
||||
|
||||
Based on the Maestro codebase analysis, **In-Factory** exposes the following gRPC services that Maestro consumes:
|
||||
|
||||
```mermaid
|
||||
graph LR;
|
||||
Maestro -->|gRPC| InFactory;
|
||||
subgraph InFactory Services
|
||||
CM[ConnectionManager]
|
||||
ConM[ConnectorManager]
|
||||
IN[Input]
|
||||
NC[NetworkConfig]
|
||||
CT[ConnectionTest]
|
||||
TR[Transformation]
|
||||
end
|
||||
Maestro --> CM;
|
||||
Maestro --> ConM;
|
||||
Maestro --> IN;
|
||||
Maestro --> NC;
|
||||
Maestro --> CT;
|
||||
Maestro --> TR;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## gRPC Services Exposed by In-Factory
|
||||
|
||||
### 1. ConnectionManager Service
|
||||
|
||||
**Package:** `ConnectionManager` from `@dadosfera/protospack-v2`
|
||||
|
||||
#### Write Services (`ConnectionManagerWriteServices`)
|
||||
| gRPC Method | Description | Called By |
|
||||
|-------------|-------------|-----------|
|
||||
| `CreateConnection` | Create a new data connection | Maestro POST /connections |
|
||||
| `UpdateConnection` | Update an existing connection | Maestro PUT /connections/:id |
|
||||
| `DeleteConnection` | Delete a connection | Maestro DELETE /connections/:id |
|
||||
|
||||
#### Read Services (`ConnectionManagerReadServices`)
|
||||
| gRPC Method | Description | Called By |
|
||||
|-------------|-------------|-----------|
|
||||
| `GetConnectionDetails` | Get details of a single connection | Maestro GET /connections/:id |
|
||||
| `GetAllConnections` | List all connections for a customer | Maestro GET /connections |
|
||||
| `GetConnectorAvailableConnectionsByCustomer` | Get available connections by connector | Maestro GET /connections/available/:connector_id |
|
||||
| `ValidatePlatformConnections` | Validate connections against platform | Maestro internal |
|
||||
|
||||
---
|
||||
|
||||
### 2. ConnectorManager Service
|
||||
|
||||
**Package:** `ConnectorManager` from `@dadosfera/protospack-v2`
|
||||
|
||||
#### Write Services (`ConnectorManagerWriteServices`)
|
||||
| gRPC Method | Description | Called By |
|
||||
|-------------|-------------|-----------|
|
||||
| `RegisterConnector` | Register a new connector | Maestro POST /connectors |
|
||||
| `UploadFile` | Upload connector files | Maestro POST /connectors/uploads |
|
||||
| `RegisterMultipleConnectorsWithoutImage` | Bulk register connectors | Maestro internal |
|
||||
| `UpdateConnectorByID` | Update a connector | Maestro PUT /connectors/:id |
|
||||
| `DeleteConnectorById` | Delete a connector | Maestro DELETE /connectors/:id |
|
||||
|
||||
#### Read Services (`ConnectorManagerReadServices`)
|
||||
| gRPC Method | Description | Called By |
|
||||
|-------------|-------------|-----------|
|
||||
| `GetConnectors` | List all connectors | Maestro GET /connectors |
|
||||
|
||||
---
|
||||
|
||||
### 3. Input Service
|
||||
|
||||
**Package:** `Input` from `@dadosfera/protospack-v2`
|
||||
|
||||
#### Write Services (`InputWriteService`)
|
||||
| gRPC Method | Description | Called By |
|
||||
|-------------|-------------|-----------|
|
||||
| `CreateInput` | Create a new input configuration | Maestro POST /inputs |
|
||||
| `UpdateInput` | Update input configuration | Maestro PATCH /inputs |
|
||||
| `DeleteInput` | Delete an input | Maestro DELETE /inputs/:id |
|
||||
|
||||
#### Read Services (`InputReadService`)
|
||||
| gRPC Method | Description | Called By |
|
||||
|-------------|-------------|-----------|
|
||||
| `GetAvailableEntities` | Get available entities for a plugin | Maestro GET /inputs/available-entities/:plugin |
|
||||
|
||||
---
|
||||
|
||||
### 4. NetworkConfig Service
|
||||
|
||||
**Package:** `NetworkConfig` from `@dadosfera/protospack-v2`
|
||||
|
||||
#### Write Services (`NetworkConfigWriteService`)
|
||||
| gRPC Method | Description | Called By |
|
||||
|-------------|-------------|-----------|
|
||||
| `NetworkConfigCreate` | Create network configuration | Maestro POST /network-configs |
|
||||
| `NetworkConfigUpdate` | Update network configuration | Maestro PUT /network-configs/:id |
|
||||
| `NetworkConfigDelete` | Delete network configuration | Maestro DELETE /network-configs/:id |
|
||||
|
||||
#### Read Services (`NetworkConfigReadService`)
|
||||
| gRPC Method | Description | Called By |
|
||||
|-------------|-------------|-----------|
|
||||
| `NetworkConfigFindAll` | List all network configs | Maestro GET /network-configs |
|
||||
| `NetworkConfigFindOneById` | Get network config by ID | Maestro GET /network-configs/:id |
|
||||
|
||||
---
|
||||
|
||||
### 5. ConnectionTest Service
|
||||
|
||||
**Package:** `ConnectionTest` from `@dadosfera/protospack-v2`
|
||||
|
||||
#### Read Services (`ConnectionTestReadService`)
|
||||
| gRPC Method | Description | Called By |
|
||||
|-------------|-------------|-----------|
|
||||
| `TestConnection` | Test a connection's connectivity | Maestro POST /connection-test |
|
||||
|
||||
---
|
||||
|
||||
### 6. Transformation Service
|
||||
|
||||
**Package:** `Transformation` from `@dadosfera/protospack-v2`
|
||||
|
||||
#### Write Services (`TransformationWriteService`)
|
||||
| gRPC Method | Description | Called By |
|
||||
|-------------|-------------|-----------|
|
||||
| `CreateTransformation` | Create a transformation | Maestro POST /transformations |
|
||||
| `UpdateTransformation` | Update a transformation | Maestro PUT /transformations/:id |
|
||||
| `DeleteTransformation` | Delete a transformation | Maestro DELETE /transformations/:id |
|
||||
|
||||
#### Read Services (`TransformationReadService`)
|
||||
| gRPC Method | Description | Called By |
|
||||
|-------------|-------------|-----------|
|
||||
| Various read operations | Get transformation details | Maestro GET /transformations |
|
||||
|
||||
---
|
||||
|
||||
## Proto Package Ownership
|
||||
|
||||
The proto definitions are managed in `@dadosfera/protospack-v2`:
|
||||
|
||||
```
|
||||
@dadosfera/protospack-v2/
|
||||
├── dist/lib/
|
||||
│ ├── ConnectionManager/
|
||||
│ │ ├── interfaces/messages.ts
|
||||
│ │ └── interfaces/entities.ts
|
||||
│ ├── ConnectorManager/
|
||||
│ │ ├── interfaces/messages.ts
|
||||
│ │ └── interfaces/entities.ts
|
||||
│ ├── Input/
|
||||
│ │ ├── interfaces/messages.ts
|
||||
│ │ └── interfaces/entities.ts
|
||||
│ ├── NetworkConfig/
|
||||
│ │ ├── interfaces/messages.ts
|
||||
│ │ └── interfaces/entities.ts
|
||||
│ ├── ConnectionTest/
|
||||
│ │ ├── interfaces/messages.ts
|
||||
│ │ └── interfaces/entities.ts
|
||||
│ └── Transformation/
|
||||
│ ├── interfaces/messages.ts
|
||||
│ └── interfaces/entities.ts
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## In-Factory Migration Options
|
||||
|
||||
### Option 1: Expose REST API (Keep In-Factory, Add REST Layer)
|
||||
|
||||
**Changes Required in In-Factory:**
|
||||
1. Add REST controllers for all services
|
||||
2. Implement HTTP endpoints mirroring gRPC methods
|
||||
3. Update deployment to expose HTTP port
|
||||
4. Create OpenAPI documentation
|
||||
|
||||
**Pros:**
|
||||
- Minimal architectural changes
|
||||
- Can run both gRPC and REST in parallel during migration
|
||||
- Maestro can switch to REST calls gradually
|
||||
|
||||
**Cons:**
|
||||
- Still maintains service dependency
|
||||
- Adds another communication layer
|
||||
|
||||
---
|
||||
|
||||
### Option 2: Move Logic to Maestro (Deprecate In-Factory for these features)
|
||||
|
||||
**Changes Required in In-Factory:**
|
||||
1. Export database schema/migrations
|
||||
2. Document all business logic
|
||||
3. Provide data migration scripts
|
||||
4. Deprecate gRPC endpoints after migration
|
||||
|
||||
**Changes Required in Maestro:**
|
||||
1. Create database models
|
||||
2. Implement repositories
|
||||
3. Create service layer with same business logic
|
||||
4. Run data migration
|
||||
|
||||
**Pros:**
|
||||
- Removes runtime dependency completely
|
||||
- Simplifies architecture
|
||||
- One less service to maintain
|
||||
|
||||
**Cons:**
|
||||
- Significant development effort
|
||||
- Risk of business logic divergence during migration
|
||||
- Database sharing concerns
|
||||
|
||||
---
|
||||
|
||||
### Option 3: Merge Services (Combine In-Factory into a larger service)
|
||||
|
||||
**Changes Required:**
|
||||
1. Create new combined service
|
||||
2. Migrate both In-Factory and relevant Maestro code
|
||||
3. Update all clients
|
||||
|
||||
**Pros:**
|
||||
- Clean architectural redesign
|
||||
- Opportunity to optimize
|
||||
|
||||
**Cons:**
|
||||
- Largest effort
|
||||
- Risk of disruption
|
||||
|
||||
---
|
||||
|
||||
## Data Migration Considerations
|
||||
|
||||
### Entities Managed by In-Factory
|
||||
|
||||
Based on proto definitions, In-Factory manages:
|
||||
|
||||
1. **Connections**
|
||||
- Connection credentials
|
||||
- Connection metadata
|
||||
- Customer associations
|
||||
|
||||
2. **Connectors**
|
||||
- Connector definitions
|
||||
- Connector images/files
|
||||
- Plugin configurations
|
||||
|
||||
3. **Inputs**
|
||||
- Input configurations
|
||||
- Entity mappings
|
||||
|
||||
4. **Network Configs**
|
||||
- Network configuration settings
|
||||
- Security settings
|
||||
|
||||
5. **Transformations**
|
||||
- Transformation definitions
|
||||
- Transformation scripts
|
||||
|
||||
### Migration Steps
|
||||
1. Export database schema from In-Factory
|
||||
2. Create equivalent schema in target database
|
||||
3. Write data migration scripts
|
||||
4. Validate data integrity
|
||||
5. Switch traffic
|
||||
6. Decommission old service
|
||||
|
||||
---
|
||||
|
||||
## Recommended Investigation for In-Factory Team
|
||||
|
||||
1. **Check for Maestro dependencies in In-Factory**
|
||||
- Does In-Factory call any Maestro APIs?
|
||||
- Are there any shared databases?
|
||||
- Any shared message queues?
|
||||
|
||||
2. **Document database schema**
|
||||
- All tables related to connections, connectors, inputs, network-configs, transformations
|
||||
- Foreign key relationships
|
||||
- Indexes and constraints
|
||||
|
||||
3. **List all consumers**
|
||||
- Besides Maestro, who else calls In-Factory?
|
||||
- Are there other internal services?
|
||||
- Any external integrations?
|
||||
|
||||
4. **Business logic documentation**
|
||||
- Validation rules
|
||||
- Business constraints
|
||||
- Side effects (events, notifications, etc.)
|
||||
|
||||
---
|
||||
|
||||
## Timeline Considerations
|
||||
|
||||
| Phase | Description | Dependencies |
|
||||
|-------|-------------|--------------|
|
||||
| Phase 1 | Analysis & Planning | Both teams available |
|
||||
| Phase 2 | Schema/API Design | Proto definitions finalized |
|
||||
| Phase 3 | Implementation | Development resources |
|
||||
| Phase 4 | Data Migration | Database access, downtime window |
|
||||
| Phase 5 | Testing | QA resources, test environments |
|
||||
| Phase 6 | Cutover | Deployment coordination |
|
||||
| Phase 7 | Decommission | Monitoring, rollback plan |
|
||||
|
||||
---
|
||||
|
||||
## Questions for In-Factory Team
|
||||
|
||||
1. What database does In-Factory use? (PostgreSQL, MongoDB, etc.)
|
||||
2. Are there any async operations? (message queues, event sourcing)
|
||||
3. What is the current data volume for each entity type?
|
||||
4. Are there any scheduled jobs or background processes?
|
||||
5. What monitoring/alerting is in place?
|
||||
6. Are there any data retention policies?
|
||||
7. What is the backup/recovery strategy?
|
||||
@@ -0,0 +1,486 @@
|
||||
# Maestro ↔ PI-Factory Migration Map
|
||||
|
||||
This document maps all integration points between Maestro and PI-Factory that need to be addressed to remove the dependency.
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
```mermaid
|
||||
graph TD;
|
||||
Frontend<-->Maestro;
|
||||
Maestro<-->DUC;
|
||||
Maestro<-->pi-factory;
|
||||
Maestro<-->in-factory;
|
||||
```
|
||||
|
||||
PI-Factory (`PIFACTORY_URL`) is responsible for:
|
||||
- **Pipeline Management** - Create, read, update, delete pipelines
|
||||
- **Catalog Services** - Data asset management, metadata, previews
|
||||
- **Platform Interfaces** - Dataset cataloging operations
|
||||
|
||||
---
|
||||
|
||||
## Summary Table
|
||||
|
||||
| Category | Count | Impact Level |
|
||||
|----------|-------|--------------|
|
||||
| gRPC Client Configurations | 3 | HIGH |
|
||||
| NestJS Modules | 3 | HIGH |
|
||||
| REST Controllers/Endpoints | 3 (~50 endpoints) | HIGH |
|
||||
| Service Classes | 4 | HIGH |
|
||||
| Configuration Files | 4 | MEDIUM |
|
||||
| Proto Package Dependencies | 2 | HIGH |
|
||||
| Environment Variables | 1 | LOW |
|
||||
|
||||
---
|
||||
|
||||
## 1. gRPC CLIENT CONFIGURATIONS (Files to Migrate)
|
||||
|
||||
These files configure gRPC connections to PI-Factory services:
|
||||
|
||||
### 1.1 Catalog Client (`PIFACTORY_URL`)
|
||||
**File:** `src/modules/catalog/catalog-client.ts`
|
||||
```typescript
|
||||
// Lines 11-12, 19
|
||||
process.env.PIFACTORY_URL.startsWith('pi-factory:')
|
||||
process.env.PIFACTORY_URL.includes('0.0.0.0')
|
||||
url: process.env.PIFACTORY_URL
|
||||
```
|
||||
**Proto Services Used:**
|
||||
- `Catalog.ProtoPackages.ReadPackage`
|
||||
- `Catalog.ProtoPackages.WritePackage`
|
||||
- `PlatformInterfaces.ProtoPackages.WritePackage`
|
||||
|
||||
### 1.2 Pipelines V2 Client (`PIFACTORY_URL`)
|
||||
**File:** `src/modules/pipelinesV2/pipelines-client.ts`
|
||||
```typescript
|
||||
// Lines 13-14, 21
|
||||
url: process.env.PIFACTORY_URL
|
||||
```
|
||||
**Proto Services Used:**
|
||||
- `PipelineV2.ProtoPackages.ReadPackage`
|
||||
- `PipelineV2.ProtoPackages.WritePackage`
|
||||
|
||||
### 1.3 Pipelines Client (Legacy) (`PIFACTORY_URL`)
|
||||
**File:** `src/modules/pipelines/pipelines-client.ts`
|
||||
```typescript
|
||||
// Lines 10-11, 18
|
||||
url: process.env.PIFACTORY_URL
|
||||
```
|
||||
**Proto Services Used:**
|
||||
- `PipelinePackages` from `@dadosfera/protospack`
|
||||
|
||||
---
|
||||
|
||||
## 2. SERVICE CLASSES (Business Logic to Migrate)
|
||||
|
||||
### 2.1 Catalog Service
|
||||
**File:** `src/modules/catalog/catalog.service.ts`
|
||||
|
||||
**gRPC Services Initialized:**
|
||||
- `CatalogReadServices` (from `Catalog.ReadService`)
|
||||
- `CatalogWriteServices` (from `Catalog.WriteService`)
|
||||
- `PlatformInterfacesWriteServices` (from `PlatformInterfaces.WriteService`)
|
||||
|
||||
**gRPC Methods Called:**
|
||||
|
||||
| Method | Service | Description |
|
||||
|--------|---------|-------------|
|
||||
| `GetAllDataAssets()` | CatalogReadServices | Search/list data assets |
|
||||
| `GetOneDataAsset()` | CatalogReadServices | Get single data asset by ID |
|
||||
| `GetOneDataAssetByPipelineAndObject()` | CatalogReadServices | Get asset by pipeline/object |
|
||||
| `GetDatasetDoc()` | CatalogReadServices | Get dataset documentation |
|
||||
| `GetDatasetPreview()` | CatalogReadServices | Get data preview |
|
||||
| `GetDatasetColumnsMetadata()` | CatalogReadServices | Get column metadata |
|
||||
| `GetCustomerTags()` | CatalogReadServices | Get all tags for customer |
|
||||
| `GetDatasetCatalogTask()` | CatalogReadServices | Get catalog task status |
|
||||
| `GetRlsRules()` | CatalogReadServices | Get RLS rules |
|
||||
| `GetOneRlsRule()` | CatalogReadServices | Get single RLS rule |
|
||||
| `GetNimbusDashboards()` | CatalogReadServices | Get Nimbus dashboards |
|
||||
| `CreateDataAsset()` | CatalogWriteServices | Create new data asset |
|
||||
| `UpdateDataAsset()` | CatalogWriteServices | Update existing data asset |
|
||||
| `DeleteDataAsset()` | CatalogWriteServices | Delete data asset |
|
||||
| `ManagePermission()` | CatalogWriteServices | Manage asset permissions |
|
||||
| `RevokePermission()` | CatalogWriteServices | Revoke asset permissions |
|
||||
| `MakeAComment()` | CatalogWriteServices | Add comment to asset |
|
||||
| `UpdateAComment()` | CatalogWriteServices | Update/delete comment |
|
||||
| `TriggerDatasetCataloging()` | CatalogWriteServices | Trigger catalog process |
|
||||
| `AddRlsRule()` | CatalogWriteServices | Add RLS rule |
|
||||
| `RemoveRlsRule()` | CatalogWriteServices | Remove RLS rule |
|
||||
| `RemoveRlsRulesByRlsId()` | CatalogWriteServices | Batch remove by RLS ID |
|
||||
| `RemoveRlsRulesByDashboardId()` | CatalogWriteServices | Batch remove by dashboard |
|
||||
| `GetPiiReporter()` | CatalogWriteServices | Get PII report data |
|
||||
| `CatalogDataAssets()` | PlatformInterfacesWriteServices | Catalog datasets |
|
||||
|
||||
**Additional HTTP Calls to Nimbus:**
|
||||
- `POST ${nimbusUrl}/api/catalog/data-docs/` - Create data docs
|
||||
- `POST ${nimbusUrl}/api/catalog/table-metadata/` - Create table metadata
|
||||
- `POST ${nimbusUrl}/api/catalog/column-metadata/` - Create column metadata
|
||||
- `POST ${nimbusUrl}/api/catalog/data-preview/` - Create data preview
|
||||
|
||||
### 2.2 Pipelines V2 Service
|
||||
**File:** `src/modules/pipelinesV2/pipelines.service.ts`
|
||||
|
||||
**gRPC Services Initialized:**
|
||||
- `PipelineV2ReadService` (from `PipelineV2.ReadService`)
|
||||
- `PipelineV2WriteService` (from `PipelineV2.WriteService`)
|
||||
|
||||
**gRPC Methods Called:**
|
||||
|
||||
| Method | Service | Description |
|
||||
|--------|---------|-------------|
|
||||
| `PipelineV2Create()` | PipelineV2WriteService | Create new pipeline |
|
||||
| `PipelineV2Update()` | PipelineV2WriteService | Update pipeline |
|
||||
| `PipelineV2Remove()` | PipelineV2WriteService | Delete pipeline |
|
||||
| `PipelineV2UploadFile()` | PipelineV2WriteService | Initialize file upload |
|
||||
| `PipelineV2CompleteUploadFile()` | PipelineV2WriteService | Complete file upload |
|
||||
| `PipelineV2FindAll()` | PipelineV2ReadService | List all pipelines |
|
||||
| `PipelineV2FindOne()` | PipelineV2ReadService | Get single pipeline |
|
||||
| `PipelineV2FindObjects()` | PipelineV2ReadService | Get pipeline objects |
|
||||
| `PipelineV2DownloadLogs()` | PipelineV2ReadService | Download pipeline logs |
|
||||
| `PipelineV2GetDashboardUrl()` | PipelineV2ReadService | Get monitoring dashboard URL |
|
||||
|
||||
### 2.3 Pipelines Service (Legacy)
|
||||
**File:** `src/modules/pipelines/pipelines.service.ts`
|
||||
|
||||
**Uses:** `PipelinesClientService`
|
||||
|
||||
**Methods:**
|
||||
- `getPipelineStatus()` - Get pipeline execution status
|
||||
- `runPipeline()` - Trigger pipeline execution
|
||||
|
||||
### 2.4 Pipelines Client Service (Legacy)
|
||||
**File:** `src/modules/pipelines/client.service.ts`
|
||||
|
||||
**gRPC Methods Called:**
|
||||
| Method | Service | Description |
|
||||
|--------|---------|-------------|
|
||||
| `getPipelineStatus()` | PipelineService | Get pipeline status |
|
||||
| `triggerPipeline()` | PipelineService | Trigger pipeline run |
|
||||
|
||||
---
|
||||
|
||||
## 3. NESTJS MODULES (Module Registration)
|
||||
|
||||
| Module | File | Client Configuration | Exports |
|
||||
|--------|------|---------------------|---------|
|
||||
| CatalogModule | `src/modules/catalog/catalog.module.ts` | CatalogClientConfiguration | CatalogService |
|
||||
| PipelinesV2Module | `src/modules/pipelinesV2/pipelines.module.ts` | PipelinesClientConfiguration | PipelinesService |
|
||||
| PipelinesModule | `src/modules/pipelines/pipelines.module.ts` | PipelinesClientConfiguration | PipelinesService, PipelinesClientService |
|
||||
|
||||
**App Module Registration:** `src/app.module.ts` (Lines 20, 23, 25, 53-54, 59)
|
||||
|
||||
---
|
||||
|
||||
## 4. REST CONTROLLERS (API Endpoints to Migrate)
|
||||
|
||||
### 4.1 Catalog Controller
|
||||
**File:** `src/modules/catalog/catalog.controller.ts`
|
||||
**Base Path:** `/catalog`
|
||||
|
||||
| HTTP Method | Endpoint | Description |
|
||||
|-------------|----------|-------------|
|
||||
| GET | `/catalog` | Search data assets |
|
||||
| GET | `/catalog/download` | Download assets as CSV |
|
||||
| GET | `/catalog/data-asset` | Get asset by pipeline/object |
|
||||
| GET | `/catalog/data-asset/:id` | Get single data asset |
|
||||
| GET | `/catalog/data-asset/rls/:id` | Get data asset RLS info |
|
||||
| GET | `/catalog/data-asset/:id/columns-metadata` | Get column metadata |
|
||||
| GET | `/catalog/data-asset/:id/preview` | Get data preview |
|
||||
| GET | `/catalog/data-asset/:id/docs` | Get documentation |
|
||||
| GET | `/catalog/tags` | Get all tags |
|
||||
| PUT | `/catalog/data-asset/:id` | Update data asset |
|
||||
| PUT | `/catalog/data-asset/:id/manage-permissions` | Manage permissions |
|
||||
| PUT | `/catalog/data-asset/:id/revoke-permissions` | Revoke permissions |
|
||||
| POST | `/catalog` | Create data asset |
|
||||
| POST | `/catalog/data-asset/:id/docs` | Create documentation |
|
||||
| POST | `/catalog/data-asset/:id/comment` | Add comment |
|
||||
| POST | `/catalog/dataset-catalog-task` | Trigger catalog task |
|
||||
| POST | `/catalog/rls-rule` | Add RLS rule |
|
||||
| POST | `/catalog/register-dataset` | Register dataset with metadata |
|
||||
| DELETE | `/catalog/data-asset/:id` | Delete data asset |
|
||||
| DELETE | `/catalog/data-asset/:id/comment` | Delete comment |
|
||||
| DELETE | `/catalog/rls-rule/:id` | Remove RLS rule |
|
||||
| DELETE | `/catalog/rls-rule` | Batch remove RLS rules |
|
||||
| GET | `/catalog/dataset-catalog-task/:session` | Get catalog task status |
|
||||
| GET | `/catalog/rls-rule/:id` | Get single RLS rule |
|
||||
| GET | `/catalog/rls-rule` | Get RLS rules |
|
||||
| GET | `/catalog/nimbus-dashboards` | Get Nimbus dashboards |
|
||||
| GET | `/catalog/pii-reporter` | Get PII report |
|
||||
|
||||
**Total: 27 endpoints**
|
||||
|
||||
### 4.2 Pipelines V2 Controller
|
||||
**File:** `src/modules/pipelinesV2/pipelines.controller.ts`
|
||||
**Base Path:** `/pipelinesV2`
|
||||
|
||||
| HTTP Method | Endpoint | Description |
|
||||
|-------------|----------|-------------|
|
||||
| GET | `/pipelinesV2/monitoring-dashboard` | Get monitoring dashboard URL |
|
||||
| GET | `/pipelinesV2` | List all pipelines |
|
||||
| GET | `/pipelinesV2/download-logs` | Download pipeline logs |
|
||||
| GET | `/pipelinesV2/:id` | Get single pipeline |
|
||||
| GET | `/pipelinesV2/:id/config` | Get pipeline properties |
|
||||
| GET | `/pipelinesV2/:id/objects` | Get pipeline objects |
|
||||
| GET | `/pipelinesV2/:id/status` | Get pipeline status (legacy) |
|
||||
| POST | `/pipelinesV2` | Create pipeline |
|
||||
| POST | `/pipelinesV2/init-upload` | Initialize file upload |
|
||||
| POST | `/pipelinesV2/complete-upload` | Complete file upload |
|
||||
| POST | `/pipelinesV2/file` | Upload file pipeline |
|
||||
| POST | `/pipelinesV2/start/:id` | Start pipeline |
|
||||
| PATCH | `/pipelinesV2/:id` | Update pipeline |
|
||||
| PUT | `/pipelinesV2/:id` | Update pipeline (deprecated) |
|
||||
| DELETE | `/pipelinesV2/:id` | Delete pipeline |
|
||||
|
||||
**Total: 15 endpoints**
|
||||
|
||||
### 4.3 Pipelines Controller (Legacy)
|
||||
**File:** `src/modules/pipelines/pipelines.controller.ts`
|
||||
**Base Path:** `/pipelines`
|
||||
|
||||
| HTTP Method | Endpoint | Description |
|
||||
|-------------|----------|-------------|
|
||||
| POST | `/pipelines/start/:id` | Start pipeline (deprecated) |
|
||||
| GET | `/pipelines/:id/status` | Get pipeline status (deprecated) |
|
||||
|
||||
**Total: 2 endpoints (deprecated)**
|
||||
|
||||
---
|
||||
|
||||
## 5. CONFIGURATION FILES
|
||||
|
||||
### 5.1 Helm Chart Values (Production)
|
||||
**File:** `deploy/helm-chart/values.yaml`
|
||||
```yaml
|
||||
# Line 40
|
||||
maestro:
|
||||
pi_factory_url: pi-factory.dadosfera.ai
|
||||
```
|
||||
|
||||
### 5.2 Helm Chart Values (Staging)
|
||||
**File:** `deploy/helm-chart/values-stg.yaml`
|
||||
```yaml
|
||||
# Line 4
|
||||
maestro:
|
||||
pi_factory_url: pi-factory.stg.dadosfera.ai
|
||||
```
|
||||
|
||||
### 5.3 Helmfiles (Production)
|
||||
**File:** `deploy/helmfiles/prd.yaml`
|
||||
```yaml
|
||||
# Lines 14, 38
|
||||
maestro.pi_factory_url: pi-factory.dadosfera.ai
|
||||
```
|
||||
|
||||
### 5.4 Deployment Template
|
||||
**File:** `deploy/helm-chart/templates/deployment.yaml`
|
||||
```yaml
|
||||
# Line 85
|
||||
- name: PIFACTORY_URL
|
||||
value: {{ .Values.maestro.pi_factory_url }}
|
||||
```
|
||||
|
||||
### 5.5 Environment Type Definition
|
||||
**File:** `environment.d.ts`
|
||||
```typescript
|
||||
// Line 10
|
||||
PIFACTORY_URL: string;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. PROTO PACKAGE DEPENDENCIES
|
||||
|
||||
### 6.1 Package.json
|
||||
**File:** `package.json`
|
||||
```json
|
||||
{
|
||||
"@dadosfera/protospack": "2.5.3", // Legacy pipelines
|
||||
"@dadosfera/protospack-v2": "3.38.0-beta.14" // PipelineV2, Catalog, PlatformInterfaces
|
||||
}
|
||||
```
|
||||
|
||||
### 6.2 Proto Imports from `@dadosfera/protospack-v2` (PI-Factory related)
|
||||
|
||||
| Import Path | Used In |
|
||||
|-------------|---------|
|
||||
| `Catalog` | catalog/catalog-client.ts, catalog/catalog.service.ts |
|
||||
| `Catalog/interfaces/messages` | catalog/catalog.service.ts, catalog/catalog.controller.ts, catalog/dtos |
|
||||
| `PlatformInterfaces` | catalog/catalog-client.ts, catalog/catalog.service.ts |
|
||||
| `PipelineV2` | pipelinesV2/pipelines-client.ts, pipelinesV2/pipelines.service.ts |
|
||||
| `PipelineV2/interfaces/messages` | pipelinesV2/pipelines.service.ts, pipelinesV2/pipelines.controller.ts |
|
||||
|
||||
### 6.3 Proto Imports from `@dadosfera/protospack` (Legacy)
|
||||
|
||||
| Import Path | Used In |
|
||||
|-------------|---------|
|
||||
| `PipelinePackages` | pipelines/pipelines-client.ts |
|
||||
| `PipelineProtoFilePath` | pipelines/pipelines-client.ts |
|
||||
| `PipelineServicesNames` | pipelines/client.service.ts |
|
||||
| `PipelinesServiceInterface` | pipelines/client.service.ts |
|
||||
|
||||
---
|
||||
|
||||
## 7. FILES TO MODIFY/DELETE (Summary)
|
||||
|
||||
### High Priority - Core Integration Files
|
||||
```
|
||||
src/modules/catalog/catalog-client.ts → DELETE or REPLACE
|
||||
src/modules/catalog/catalog.service.ts → REPLACE with local implementation
|
||||
src/modules/pipelinesV2/pipelines-client.ts → DELETE or REPLACE
|
||||
src/modules/pipelinesV2/pipelines.service.ts → REPLACE with local implementation
|
||||
src/modules/pipelines/pipelines-client.ts → DELETE or REPLACE
|
||||
src/modules/pipelines/client.service.ts → REPLACE with local implementation
|
||||
src/modules/pipelines/pipelines.service.ts → REPLACE with local implementation
|
||||
```
|
||||
|
||||
### Medium Priority - Module Registration
|
||||
```
|
||||
src/modules/catalog/catalog.module.ts → UPDATE imports
|
||||
src/modules/pipelinesV2/pipelines.module.ts → UPDATE imports
|
||||
src/modules/pipelines/pipelines.module.ts → UPDATE imports
|
||||
src/app.module.ts → UPDATE if module structure changes
|
||||
```
|
||||
|
||||
### Low Priority - Configuration
|
||||
```
|
||||
deploy/helm-chart/values.yaml → REMOVE pi_factory_url
|
||||
deploy/helm-chart/values-stg.yaml → REMOVE pi_factory_url
|
||||
deploy/helmfiles/prd.yaml → REMOVE pi_factory_url references
|
||||
deploy/helm-chart/templates/deployment.yaml → REMOVE PIFACTORY_URL env var
|
||||
environment.d.ts → REMOVE PIFACTORY_URL type
|
||||
README.md → UPDATE architecture diagram
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8. DEPENDENCY COUNT BY MODULE
|
||||
|
||||
| Module | Files | gRPC Calls | REST Endpoints |
|
||||
|--------|-------|------------|----------------|
|
||||
| Catalog | 3 | 24+ | 27 |
|
||||
| PipelinesV2 | 3 | 10 | 15 |
|
||||
| Pipelines (Legacy) | 3 | 2 | 2 |
|
||||
| **TOTAL** | **9** | **36+** | **44** |
|
||||
|
||||
---
|
||||
|
||||
## 9. COMPARISON: PI-Factory vs In-Factory
|
||||
|
||||
| Aspect | PI-Factory | In-Factory |
|
||||
|--------|------------|------------|
|
||||
| Environment Variable | `PIFACTORY_URL` | `INFACTORY_URL` |
|
||||
| Modules | 3 | 6 |
|
||||
| gRPC Calls | 36+ | 27+ |
|
||||
| REST Endpoints | 44 | 25 |
|
||||
| Complexity | HIGH | MEDIUM-HIGH |
|
||||
| Domain | Pipelines, Catalog | Connections, Connectors, Inputs |
|
||||
|
||||
---
|
||||
|
||||
## 10. DATA MODELS (Proto Messages Used)
|
||||
|
||||
### Catalog Messages
|
||||
- `CreateDataAssetRequest` / `CreateDataAssetResponse`
|
||||
- `GetAllDataAssetsRequest` / `GetAllDataAssetsResponse`
|
||||
- `GetOneDataAssetRequest` / Response
|
||||
- `UpdateDataAssetRequest` / Response
|
||||
- `DeleteDataAssetRequest` / Response
|
||||
- `ManagePermissionRequest` / Response
|
||||
- `RevokePermissionRequest` / Response
|
||||
- `MakeACommentRequest` / Response
|
||||
- `UpdateACommentRequest` / Response
|
||||
- `TriggerDatasetCatalogingRequest` / Response
|
||||
- `GetDatasetCatalogTaskRequest` / Response
|
||||
- `AddRlsRuleRequest` / Response
|
||||
- `RemoveRlsRuleRequest` / Response
|
||||
- `GetRlsRulesRequest` / Response
|
||||
- `GetNimbusDashboardsRequest` / Response
|
||||
- `PiiMetadata`
|
||||
- `RegisterDatasetWithMetatadaRequest`
|
||||
|
||||
### PipelineV2 Messages
|
||||
- `PipelineV2CreateRequest` / `PipelineV2CreateResponse`
|
||||
- `PipelineV2FindAllRequest` / `PipelineV2FindAllResponse`
|
||||
- `PipelineV2FindOneRequest` / `PipelineV2FindOneResponse`
|
||||
- `PipelineV2UpdateRequest` / `PipelineV2UpdateResponse`
|
||||
- `PipelineV2RemoveRequest` / Response
|
||||
- `PipelineV2UploadFileRequest` / Response
|
||||
- `PipelineV2CompleteUploadFileRequest` / Response
|
||||
- `PipelineV2FindObjectsRequest` / Response
|
||||
- `PipelineV2DownloadLogsRequest` / Response
|
||||
- `PipelineV2GetDashboardUrlRequest` / Response
|
||||
|
||||
### Platform Interfaces Messages
|
||||
- `CatalogDataAssetsRequest` / Response
|
||||
|
||||
---
|
||||
|
||||
## 11. MIGRATION STRATEGY OPTIONS
|
||||
|
||||
### Option A: Move PI-Factory functionality INTO Maestro
|
||||
**Pros:**
|
||||
- Single service to maintain
|
||||
- No network latency for these operations
|
||||
- Simpler deployment
|
||||
|
||||
**Cons:**
|
||||
- Significantly increases Maestro's responsibility
|
||||
- Requires database access from Maestro
|
||||
- Large refactoring effort (44 endpoints)
|
||||
|
||||
### Option B: Create REST API wrapper in PI-Factory
|
||||
**Pros:**
|
||||
- Minimal changes to Maestro
|
||||
- Can migrate incrementally
|
||||
|
||||
**Cons:**
|
||||
- Still maintains dependency
|
||||
- Additional REST→gRPC translation layer
|
||||
|
||||
### Option C: Direct database access from Maestro
|
||||
**Pros:**
|
||||
- Removes runtime dependency
|
||||
- Better performance
|
||||
|
||||
**Cons:**
|
||||
- Shared database coupling
|
||||
- Complex migration
|
||||
|
||||
---
|
||||
|
||||
## 12. RECOMMENDED MIGRATION ORDER
|
||||
|
||||
Given the complexity, we recommend migrating in this order:
|
||||
|
||||
1. **Legacy Pipelines** (2 endpoints, deprecated) - Lowest risk
|
||||
2. **PipelinesV2** (15 endpoints) - Core pipeline functionality
|
||||
3. **Catalog** (27 endpoints) - Most complex, migrate last
|
||||
|
||||
### Phase 1: Legacy Pipelines (Deprecated)
|
||||
- Remove `/pipelines/start/:id`
|
||||
- Remove `/pipelines/:id/status`
|
||||
- Update all clients to use `/pipelinesV2/*` endpoints
|
||||
|
||||
### Phase 2: PipelinesV2
|
||||
- Migrate pipeline CRUD operations
|
||||
- Migrate file upload functionality
|
||||
- Migrate monitoring dashboard
|
||||
|
||||
### Phase 3: Catalog
|
||||
- Migrate data asset CRUD
|
||||
- Migrate permissions management
|
||||
- Migrate RLS rules
|
||||
- Migrate dataset registration
|
||||
- Migrate PII reporting
|
||||
|
||||
---
|
||||
|
||||
## NEXT STEPS
|
||||
|
||||
1. **Decide on migration strategy** (Option A, B, or C)
|
||||
2. **Deprecate legacy pipelines module** first
|
||||
3. **Create database schema** if moving to Option A
|
||||
4. **Implement local services** one module at a time
|
||||
5. **Update tests** for each migrated module
|
||||
6. **Update deployment configs** to remove PIFACTORY_URL
|
||||
7. **Coordinate with PI-Factory team** for data migration
|
||||
Reference in New Issue
Block a user