158 lines
6.0 KiB
Markdown
158 lines
6.0 KiB
Markdown
# Sub-workflow Deployment Guide
|
|
|
|
## Overview
|
|
|
|
Phase 10.1 (Aggressive Workflow Modularization) reduced the main workflow from 192 nodes to 168 nodes by extracting domain-specific functionality into sub-workflows.
|
|
|
|
**Final State:**
|
|
- Main workflow: 168 nodes (reduced by 24 nodes, -12.5%)
|
|
- Total sub-workflows: 7 (3 pre-existing + 4 new)
|
|
|
|
## Sub-workflows
|
|
|
|
| File | Purpose | Nodes | Status |
|
|
|------|---------|-------|--------|
|
|
| n8n-update.json | Container update operations | 34 | Deployed (ID: `7AvTzLtKXM2hZTio92_mC`) |
|
|
| n8n-actions.json | Container start/stop/restart | 11 | Deployed (ID: `fYSZS5PkH0VSEaT5`) |
|
|
| n8n-logs.json | Container log retrieval | 9 | Deployed (ID: `oE7aO2GhbksXDEIw`) |
|
|
| n8n-batch-ui.json | Batch selection UI | 16 | Deployed |
|
|
| n8n-status.json | Container list/status | 11 | Deployed (ID: `lqpg2CqesnKE2RJQ`) |
|
|
| n8n-confirmation.json | Confirmation dialogs | 16 | Deployed (ID: `fZ1hu8eiovkCk08G`) |
|
|
| n8n-matching.json | Container matching/disambiguation | 23 | Deployed (ID: `kL4BoI8ITSP9Oxek`) |
|
|
|
|
## Deployment Status
|
|
|
|
All sub-workflows have been deployed. The main workflow (`n8n-workflow.json`) contains all correct workflow IDs.
|
|
|
|
To redeploy after changes:
|
|
1. Import the modified sub-workflow JSON to n8n
|
|
2. Re-import `n8n-workflow.json` if main workflow changed
|
|
3. Activate the workflow
|
|
|
|
## Execute Workflow Node Mapping
|
|
|
|
| Node Name | Target Sub-workflow | Workflow ID |
|
|
|-----------|---------------------|-------------|
|
|
| Execute Text Update | n8n-update.json | `7AvTzLtKXM2hZTio92_mC` |
|
|
| Execute Callback Update | n8n-update.json | `7AvTzLtKXM2hZTio92_mC` |
|
|
| Execute Batch Update | n8n-update.json | `7AvTzLtKXM2hZTio92_mC` |
|
|
| Execute Container Action | n8n-actions.json | `fYSZS5PkH0VSEaT5` |
|
|
| Execute Inline Action | n8n-actions.json | `fYSZS5PkH0VSEaT5` |
|
|
| Execute Batch Action Sub-workflow | n8n-actions.json | `fYSZS5PkH0VSEaT5` |
|
|
| Execute Text Logs | n8n-logs.json | `oE7aO2GhbksXDEIw` |
|
|
| Execute Inline Logs | n8n-logs.json | `oE7aO2GhbksXDEIw` |
|
|
| Execute Batch UI | n8n-batch-ui.json | Deployed |
|
|
| Execute Container Status | n8n-status.json | `lqpg2CqesnKE2RJQ` |
|
|
| Execute Select Status | n8n-status.json | `lqpg2CqesnKE2RJQ` |
|
|
| Execute Paginate Status | n8n-status.json | `lqpg2CqesnKE2RJQ` |
|
|
| Execute Batch Cancel Status | n8n-status.json | `lqpg2CqesnKE2RJQ` |
|
|
| Execute Confirmation | n8n-confirmation.json | `fZ1hu8eiovkCk08G` |
|
|
| Execute Action Match | n8n-matching.json | `kL4BoI8ITSP9Oxek` |
|
|
| Execute Update Match | n8n-matching.json | `kL4BoI8ITSP9Oxek` |
|
|
| Execute Batch Match | n8n-matching.json | `kL4BoI8ITSP9Oxek` |
|
|
|
|
## Rollback
|
|
|
|
If issues are encountered, backup files are available:
|
|
|
|
```bash
|
|
# Restore to before batch UI extraction
|
|
cp n8n-workflow.json.backup-batch n8n-workflow.json
|
|
|
|
# Restore to before status extraction
|
|
cp n8n-workflow.json.backup-status n8n-workflow.json
|
|
|
|
# Restore to before confirmation extraction
|
|
cp n8n-workflow.json.backup-confirm n8n-workflow.json
|
|
```
|
|
|
|
Then re-import the restored `n8n-workflow.json` to n8n.
|
|
|
|
## Architecture
|
|
|
|
```
|
|
n8n-workflow.json (168 nodes - orchestrator)
|
|
├── Telegram Trigger (1)
|
|
├── Auth + Error Handling
|
|
├── Keyword Routing (switch/if nodes)
|
|
│
|
|
├── Update Operations
|
|
│ ├── Execute Text Update ──────────┐
|
|
│ ├── Execute Callback Update ──────┼── n8n-update.json (34 nodes)
|
|
│ └── Execute Batch Update ─────────┘
|
|
│
|
|
├── Action Operations
|
|
│ ├── Execute Container Action ─────┐
|
|
│ ├── Execute Inline Action ────────┼── n8n-actions.json (11 nodes)
|
|
│ └── Execute Batch Action ─────────┘
|
|
│
|
|
├── Log Operations
|
|
│ ├── Execute Text Logs ────────────┐
|
|
│ └── Execute Inline Logs ──────────┴── n8n-logs.json (9 nodes)
|
|
│
|
|
├── Batch UI
|
|
│ └── Execute Batch UI ─────────────── n8n-batch-ui.json (16 nodes)
|
|
│ ├── Returns: keyboard/confirmation/execute/cancel/limit
|
|
│ └── Main routes response based on action
|
|
│
|
|
├── Container Status
|
|
│ ├── Execute Container Status ─────┐
|
|
│ ├── Execute Select Status ────────┼── n8n-status.json (11 nodes)
|
|
│ ├── Execute Paginate Status ──────┤ Returns: list/status/paginate
|
|
│ └── Execute Batch Cancel Status ──┘
|
|
│
|
|
└── Confirmation Dialogs
|
|
└── Execute Confirmation ─────────── n8n-confirmation.json (16 nodes)
|
|
├── Returns: show_stop/show_update/confirm_*/cancel/expired
|
|
└── Calls n8n-actions.json for confirmed stop actions
|
|
```
|
|
|
|
## Sub-workflow Input/Output Contracts
|
|
|
|
### n8n-batch-ui.json
|
|
|
|
**Input:**
|
|
- `chatId`, `messageId`, `queryId`
|
|
- `callbackData`, `action`, `batchPage`
|
|
- `selectedCsv`, `toggleName`
|
|
|
|
**Output:**
|
|
- `action`: keyboard | confirmation | execute | cancel | limit_reached
|
|
|
|
### n8n-status.json
|
|
|
|
**Input:**
|
|
- `chatId`, `messageId`, `queryId`
|
|
- `action`, `containerId`, `containerName`
|
|
- `page`, `searchTerm`
|
|
|
|
**Output:**
|
|
- `action`: list | status | paginate | status_direct
|
|
|
|
### n8n-confirmation.json
|
|
|
|
**Input:**
|
|
- `chatId`, `messageId`, `queryId`
|
|
- `action`, `containerId`, `containerName`
|
|
- `confirmAction`, `confirmationToken`
|
|
- `expired`, `responseMode`
|
|
|
|
**Output:**
|
|
- `action`: show_stop | show_update | confirm_stop_result | confirm_update | cancel | expired
|
|
|
|
## Testing Checklist
|
|
|
|
After deployment, verify:
|
|
|
|
- [ ] `/list` - Shows container list
|
|
- [ ] `/status <container>` - Shows container details
|
|
- [ ] `/stop <container>` - Shows confirmation dialog
|
|
- [ ] Confirm stop - Executes stop action
|
|
- [ ] Cancel stop - Returns to status view
|
|
- [ ] `/update <container>` - Shows confirmation dialog
|
|
- [ ] Confirm update - Executes update flow
|
|
- [ ] `/stop` (no args) - Shows batch selection UI
|
|
- [ ] Select multiple containers - Batch selection works
|
|
- [ ] Execute batch - All selected containers processed
|
|
- [ ] `/logs <container>` - Shows container logs
|