@tamyla/clodo-framework 3.1.21 โ 3.1.22
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.
- package/CHANGELOG.md +9 -0
- package/README.md +53 -0
- package/dist/bin/clodo-service.js +47 -15
- package/dist/bin/commands/deploy.js +115 -83
- package/dist/bin/commands/helpers/deployment-ui.js +138 -0
- package/dist/bin/commands/helpers/deployment-verification.js +251 -0
- package/dist/bin/commands/helpers/error-recovery.js +80 -0
- package/dist/bin/commands/helpers/resource-detection.js +113 -0
- package/dist/bin/commands/validate.js +1 -1
- package/dist/bin/security/security-cli.js +1 -1
- package/dist/bin/shared/cache/configuration-cache.js +82 -0
- package/dist/bin/shared/cloudflare/domain-manager.js +1 -1
- package/dist/bin/shared/cloudflare/index.js +1 -1
- package/dist/bin/shared/cloudflare/ops.js +6 -4
- package/dist/bin/shared/config/ConfigurationManager.js +23 -1
- package/dist/bin/shared/config/command-config-manager.js +19 -3
- package/dist/bin/shared/config/index.js +1 -1
- package/dist/bin/shared/deployment/credential-collector.js +30 -7
- package/dist/bin/shared/deployment/index.js +2 -2
- package/dist/bin/shared/deployment/rollback-manager.js +4 -520
- package/dist/bin/shared/deployment/utilities/d1-error-recovery.js +177 -0
- package/dist/bin/shared/deployment/validator.js +40 -10
- package/dist/bin/shared/deployment/workflows/deployment-summary.js +214 -0
- package/dist/bin/shared/deployment/workflows/interactive-confirmation.js +188 -0
- package/dist/bin/shared/deployment/workflows/interactive-database-workflow.js +234 -0
- package/dist/bin/shared/deployment/workflows/interactive-domain-info-gatherer.js +240 -0
- package/dist/bin/shared/deployment/workflows/interactive-secret-workflow.js +228 -0
- package/dist/bin/shared/deployment/workflows/interactive-testing-workflow.js +235 -0
- package/dist/bin/shared/deployment/workflows/interactive-validation.js +218 -0
- package/dist/bin/shared/error-handling/error-classifier.js +46 -0
- package/dist/bin/shared/monitoring/health-checker.js +129 -1
- package/dist/bin/shared/monitoring/memory-manager.js +17 -6
- package/dist/bin/shared/routing/domain-router.js +1 -1
- package/dist/bin/shared/utils/deployment-validator.js +97 -0
- package/dist/bin/shared/utils/formatters.js +10 -0
- package/dist/bin/shared/utils/index.js +13 -1
- package/dist/bin/shared/utils/interactive-prompts.js +34 -18
- package/dist/bin/shared/utils/progress-manager.js +2 -2
- package/dist/bin/shared/utils/progress-spinner.js +53 -0
- package/dist/bin/shared/utils/sensitive-redactor.js +91 -0
- package/dist/bin/shared/validation/ValidationRegistry.js +1 -1
- package/dist/security/index.js +1 -1
- package/dist/security/patterns/insecure-patterns.js +1 -1
- package/dist/utils/constants.js +102 -0
- package/dist/utils/deployment/wrangler-config-manager.js +215 -48
- package/dist/utils/framework-config.js +2 -2
- package/dist/utils/interactive-prompts.js +10 -59
- package/package.json +16 -8
- package/dist/bin/clodo-service-old.js +0 -868
- package/dist/bin/clodo-service-test.js +0 -10
- package/dist/bin/commands/assess.js +0 -91
- package/dist/bin/commands/create.js +0 -77
- package/dist/bin/commands/diagnose.js +0 -83
- package/dist/bin/commands/helpers.js +0 -138
- package/dist/bin/commands/update.js +0 -75
- package/dist/bin/database/deployment-db-manager.js +0 -423
- package/dist/bin/database/enterprise-db-manager.js +0 -457
- package/dist/bin/database/wrangler-d1-manager.js +0 -685
- package/dist/bin/deployment/enterprise-deploy.js +0 -877
- package/dist/bin/deployment/master-deploy.js +0 -1376
- package/dist/bin/deployment/modular-enterprise-deploy.js +0 -466
- package/dist/bin/deployment/modules/DeploymentConfiguration.js +0 -395
- package/dist/bin/deployment/modules/DeploymentOrchestrator.js +0 -492
- package/dist/bin/deployment/modules/EnvironmentManager.js +0 -517
- package/dist/bin/deployment/modules/MonitoringIntegration.js +0 -560
- package/dist/bin/deployment/modules/ValidationManager.js +0 -342
- package/dist/bin/deployment/orchestration/BaseDeploymentOrchestrator.js +0 -426
- package/dist/bin/deployment/orchestration/EnterpriseOrchestrator.js +0 -401
- package/dist/bin/deployment/orchestration/PortfolioOrchestrator.js +0 -273
- package/dist/bin/deployment/orchestration/SingleServiceOrchestrator.js +0 -231
- package/dist/bin/deployment/orchestration/UnifiedDeploymentOrchestrator.js +0 -662
- package/dist/bin/deployment/test-interactive-utils.js +0 -66
- package/dist/bin/portfolio/portfolio-manager.js +0 -487
- package/dist/bin/service-management/create-service.js +0 -122
- package/dist/bin/service-management/init-service.js +0 -79
- package/dist/config/customers.js +0 -623
- package/dist/config/domains.js +0 -186
- package/dist/config/index.js +0 -6
- package/dist/database/database-orchestrator.js +0 -795
- package/dist/database/index.js +0 -4
- package/dist/deployment/index.js +0 -11
- package/dist/deployment/orchestration/BaseDeploymentOrchestrator.js +0 -426
- package/dist/deployment/orchestration/EnterpriseOrchestrator.js +0 -401
- package/dist/deployment/orchestration/PortfolioOrchestrator.js +0 -273
- package/dist/deployment/orchestration/SingleServiceOrchestrator.js +0 -231
- package/dist/deployment/orchestration/UnifiedDeploymentOrchestrator.js +0 -662
- package/dist/deployment/orchestration/index.js +0 -17
- package/dist/deployment/rollback-manager.js +0 -36
- package/dist/deployment/wrangler-deployer.js +0 -640
- package/dist/handlers/GenericRouteHandler.js +0 -532
- package/dist/migration/MigrationAdapters.js +0 -562
- package/dist/modules/ModuleManager.js +0 -668
- package/dist/modules/security.js +0 -96
- package/dist/orchestration/cross-domain-coordinator.js +0 -1083
- package/dist/orchestration/index.js +0 -5
- package/dist/orchestration/modules/DeploymentCoordinator.js +0 -368
- package/dist/orchestration/modules/DomainResolver.js +0 -198
- package/dist/orchestration/modules/StateManager.js +0 -332
- package/dist/orchestration/multi-domain-orchestrator.js +0 -724
- package/dist/routing/EnhancedRouter.js +0 -158
- package/dist/schema/SchemaManager.js +0 -778
- package/dist/service-management/ConfirmationEngine.js +0 -412
- package/dist/service-management/ErrorTracker.js +0 -299
- package/dist/service-management/GenerationEngine.js +0 -447
- package/dist/service-management/InputCollector.js +0 -619
- package/dist/service-management/ServiceCreator.js +0 -265
- package/dist/service-management/ServiceInitializer.js +0 -453
- package/dist/service-management/ServiceOrchestrator.js +0 -633
- package/dist/service-management/generators/BaseGenerator.js +0 -233
- package/dist/service-management/generators/GeneratorRegistry.js +0 -254
- package/dist/service-management/generators/cicd/CiWorkflowGenerator.js +0 -87
- package/dist/service-management/generators/cicd/DeployWorkflowGenerator.js +0 -106
- package/dist/service-management/generators/code/ServiceHandlersGenerator.js +0 -235
- package/dist/service-management/generators/code/ServiceMiddlewareGenerator.js +0 -116
- package/dist/service-management/generators/code/ServiceUtilsGenerator.js +0 -246
- package/dist/service-management/generators/code/WorkerIndexGenerator.js +0 -143
- package/dist/service-management/generators/config/DevelopmentEnvGenerator.js +0 -101
- package/dist/service-management/generators/config/DomainsConfigGenerator.js +0 -175
- package/dist/service-management/generators/config/EnvExampleGenerator.js +0 -178
- package/dist/service-management/generators/config/ProductionEnvGenerator.js +0 -97
- package/dist/service-management/generators/config/StagingEnvGenerator.js +0 -97
- package/dist/service-management/generators/config/WranglerTomlGenerator.js +0 -238
- package/dist/service-management/generators/core/PackageJsonGenerator.js +0 -243
- package/dist/service-management/generators/core/SiteConfigGenerator.js +0 -115
- package/dist/service-management/generators/documentation/ApiDocsGenerator.js +0 -331
- package/dist/service-management/generators/documentation/ConfigurationDocsGenerator.js +0 -294
- package/dist/service-management/generators/documentation/DeploymentDocsGenerator.js +0 -244
- package/dist/service-management/generators/documentation/ReadmeGenerator.js +0 -196
- package/dist/service-management/generators/schemas/ServiceSchemaGenerator.js +0 -190
- package/dist/service-management/generators/scripts/DeployScriptGenerator.js +0 -123
- package/dist/service-management/generators/scripts/HealthCheckScriptGenerator.js +0 -101
- package/dist/service-management/generators/scripts/SetupScriptGenerator.js +0 -88
- package/dist/service-management/generators/service-types/StaticSiteGenerator.js +0 -342
- package/dist/service-management/generators/testing/EslintConfigGenerator.js +0 -85
- package/dist/service-management/generators/testing/IntegrationTestsGenerator.js +0 -237
- package/dist/service-management/generators/testing/JestConfigGenerator.js +0 -72
- package/dist/service-management/generators/testing/UnitTestsGenerator.js +0 -277
- package/dist/service-management/generators/tooling/DockerComposeGenerator.js +0 -71
- package/dist/service-management/generators/tooling/GitignoreGenerator.js +0 -143
- package/dist/service-management/generators/utils/FileWriter.js +0 -179
- package/dist/service-management/generators/utils/PathResolver.js +0 -157
- package/dist/service-management/generators/utils/ServiceManifestGenerator.js +0 -111
- package/dist/service-management/generators/utils/TemplateEngine.js +0 -185
- package/dist/service-management/generators/utils/index.js +0 -18
- package/dist/service-management/handlers/ConfirmationHandler.js +0 -71
- package/dist/service-management/handlers/GenerationHandler.js +0 -80
- package/dist/service-management/handlers/InputHandler.js +0 -59
- package/dist/service-management/handlers/ValidationHandler.js +0 -203
- package/dist/service-management/index.js +0 -14
- package/dist/service-management/routing/DomainRouteMapper.js +0 -311
- package/dist/service-management/routing/RouteGenerator.js +0 -266
- package/dist/service-management/routing/WranglerRoutesBuilder.js +0 -273
- package/dist/service-management/routing/index.js +0 -14
- package/dist/service-management/services/DirectoryStructureService.js +0 -56
- package/dist/service-management/services/GenerationCoordinator.js +0 -208
- package/dist/service-management/services/GeneratorRegistry.js +0 -174
- package/dist/services/GenericDataService.js +0 -501
- package/dist/ui-structures/concepts/second-order-acquisition-strategy.md +0 -286
- package/dist/ui-structures/concepts/service-lifecycle-management.md +0 -150
- package/dist/ui-structures/concepts/service-manifest-guide.md +0 -309
- package/dist/ui-structures/concepts/three-tier-categorization-strategy.md +0 -231
- package/dist/ui-structures/creation/automated-generation-ui.json +0 -246
- package/dist/ui-structures/creation/core-inputs-ui.json +0 -217
- package/dist/ui-structures/creation/smart-confirmable-ui.json +0 -451
- package/dist/ui-structures/reference/absolutely-required-inputs.json +0 -315
- package/dist/ui-structures/reference/service-manifest-template.json +0 -342
- package/dist/version/VersionDetector.js +0 -723
- package/dist/worker/index.js +0 -4
- package/dist/worker/integration.js +0 -351
|
@@ -1,466 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Refactored Enterprise Interactive Deployer
|
|
5
|
-
*
|
|
6
|
-
* Modular deployment system using focused components for maintainability and reusability.
|
|
7
|
-
* Leverages new modular architecture with specialized managers for each deployment aspect.
|
|
8
|
-
*
|
|
9
|
-
* Modular Components:
|
|
10
|
-
* - DeploymentConfiguration: Configuration management and setup
|
|
11
|
-
* - EnvironmentManager: Environment and domain orchestration
|
|
12
|
-
* - ValidationManager: Comprehensive validation orchestration
|
|
13
|
-
* - MonitoringIntegration: Health checking and performance monitoring
|
|
14
|
-
* - DeploymentOrchestrator: Main deployment flow coordination
|
|
15
|
-
*
|
|
16
|
-
* Features:
|
|
17
|
-
* - Clean separation of concerns with focused modules
|
|
18
|
-
* - Interactive deployment flow with comprehensive validation
|
|
19
|
-
* - Enterprise module integration support
|
|
20
|
-
* - Comprehensive monitoring and reporting
|
|
21
|
-
* - Rollback and recovery capabilities
|
|
22
|
-
* - Multi-domain and portfolio management support
|
|
23
|
-
*
|
|
24
|
-
* @version 3.0.0 - Modular Architecture Edition
|
|
25
|
-
*/
|
|
26
|
-
import { askYesNo, closePrompts, startProgress } from '../shared/utils/interactive-utils.js';
|
|
27
|
-
|
|
28
|
-
// Modular architecture components
|
|
29
|
-
import { DeploymentConfiguration } from './modules/DeploymentConfiguration.js';
|
|
30
|
-
import { EnvironmentManager } from './modules/EnvironmentManager.js';
|
|
31
|
-
import { ValidationManager } from './modules/ValidationManager.js';
|
|
32
|
-
import { MonitoringIntegration } from './modules/MonitoringIntegration.js';
|
|
33
|
-
import { DeploymentOrchestrator } from './modules/DeploymentOrchestrator.js';
|
|
34
|
-
|
|
35
|
-
// Enterprise modules (optional)
|
|
36
|
-
import { MultiDomainOrchestrator } from "../../orchestration/multi-domain-orchestrator.js";
|
|
37
|
-
import { CrossDomainCoordinator } from "../../orchestration/cross-domain-coordinator.js";
|
|
38
|
-
import { DeploymentValidator } from '../shared/deployment/validator.js';
|
|
39
|
-
import { DatabaseOrchestrator } from "../../database/database-orchestrator.js";
|
|
40
|
-
import { EnhancedSecretManager } from '../shared/security/secret-generator.js';
|
|
41
|
-
import { ProductionTester } from '../shared/production-tester/index.js';
|
|
42
|
-
import { DeploymentAuditor } from '../shared/deployment/auditor.js';
|
|
43
|
-
import { RollbackManager } from '../shared/deployment/rollback-manager.js';
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Refactored Enterprise Interactive Deployer using modular architecture
|
|
47
|
-
*/
|
|
48
|
-
export class ModularEnterpriseDeployer {
|
|
49
|
-
constructor() {
|
|
50
|
-
this.version = '3.0.0';
|
|
51
|
-
this.deploymentId = `deploy-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
52
|
-
|
|
53
|
-
// Core modular components
|
|
54
|
-
this.components = {
|
|
55
|
-
config: null,
|
|
56
|
-
// DeploymentConfiguration
|
|
57
|
-
environment: null,
|
|
58
|
-
// EnvironmentManager
|
|
59
|
-
validation: null,
|
|
60
|
-
// ValidationManager
|
|
61
|
-
monitoring: null,
|
|
62
|
-
// MonitoringIntegration
|
|
63
|
-
orchestrator: null // DeploymentOrchestrator
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// Enterprise modules (optional)
|
|
67
|
-
this.enterpriseModules = {};
|
|
68
|
-
|
|
69
|
-
// Deployment state
|
|
70
|
-
this.deploymentState = {
|
|
71
|
-
currentPhase: 'initialization',
|
|
72
|
-
startTime: null,
|
|
73
|
-
config: {},
|
|
74
|
-
errors: [],
|
|
75
|
-
warnings: []
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Main deployment execution flow
|
|
81
|
-
*/
|
|
82
|
-
async run() {
|
|
83
|
-
try {
|
|
84
|
-
console.log('\\n๐ Modular Enterprise Deployment System v3.0.0');
|
|
85
|
-
console.log('================================================');
|
|
86
|
-
console.log('Advanced modular architecture with focused components');
|
|
87
|
-
console.log(`Deployment ID: ${this.deploymentId}`);
|
|
88
|
-
|
|
89
|
-
// Initialize core components
|
|
90
|
-
await this.initializeComponents();
|
|
91
|
-
|
|
92
|
-
// Initialize enterprise modules if needed
|
|
93
|
-
await this.initializeEnterpriseModules();
|
|
94
|
-
|
|
95
|
-
// Start deployment monitoring
|
|
96
|
-
this.components.monitoring.startDeploymentMonitoring(this.deploymentId);
|
|
97
|
-
|
|
98
|
-
// Execute deployment phases using modular components
|
|
99
|
-
await this.executeModularDeploymentFlow();
|
|
100
|
-
|
|
101
|
-
// Display success summary
|
|
102
|
-
this.components.monitoring.displaySuccessSummary();
|
|
103
|
-
console.log('\\n๐ Modular deployment completed successfully!');
|
|
104
|
-
} catch (error) {
|
|
105
|
-
console.error(`\\nโ Deployment failed: ${error.message}`);
|
|
106
|
-
|
|
107
|
-
// Attempt rollback if available
|
|
108
|
-
if (this.enterpriseModules.rollbackManager) {
|
|
109
|
-
const shouldRollback = await askYesNo('Attempt automatic rollback?', 'y');
|
|
110
|
-
if (shouldRollback) {
|
|
111
|
-
await this.executeRollback(error);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
process.exit(1);
|
|
115
|
-
} finally {
|
|
116
|
-
// Cleanup resources
|
|
117
|
-
await this.cleanup();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Initialize core modular components
|
|
123
|
-
*/
|
|
124
|
-
async initializeComponents() {
|
|
125
|
-
console.log('\\n๐ง Initializing Modular Components');
|
|
126
|
-
console.log('====================================');
|
|
127
|
-
|
|
128
|
-
// Initialize configuration manager
|
|
129
|
-
this.components.config = new DeploymentConfiguration();
|
|
130
|
-
console.log(' โ
Configuration Manager initialized');
|
|
131
|
-
|
|
132
|
-
// Initialize environment manager
|
|
133
|
-
this.components.environment = new EnvironmentManager(this.deploymentState.config);
|
|
134
|
-
console.log(' โ
Environment Manager initialized');
|
|
135
|
-
|
|
136
|
-
// Initialize validation manager
|
|
137
|
-
this.components.validation = new ValidationManager(this.deploymentState.config, this.enterpriseModules);
|
|
138
|
-
console.log(' โ
Validation Manager initialized');
|
|
139
|
-
|
|
140
|
-
// Initialize monitoring integration
|
|
141
|
-
this.components.monitoring = new MonitoringIntegration(this.deploymentState.config, this.enterpriseModules);
|
|
142
|
-
console.log(' โ
Monitoring Integration initialized');
|
|
143
|
-
|
|
144
|
-
// Initialize deployment orchestrator
|
|
145
|
-
this.components.orchestrator = new DeploymentOrchestrator(this.deploymentState.config);
|
|
146
|
-
console.log(' โ
Deployment Orchestrator initialized');
|
|
147
|
-
console.log('\\nโ
All modular components initialized successfully');
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Initialize enterprise modules for advanced features
|
|
152
|
-
*/
|
|
153
|
-
async initializeEnterpriseModules() {
|
|
154
|
-
console.log('\\n๐ข Initializing Enterprise Modules');
|
|
155
|
-
console.log('====================================');
|
|
156
|
-
try {
|
|
157
|
-
// Initialize enterprise modules
|
|
158
|
-
this.enterpriseModules = {
|
|
159
|
-
validator: new DeploymentValidator({
|
|
160
|
-
validationLevel: 'comprehensive'
|
|
161
|
-
}),
|
|
162
|
-
databaseOrchestrator: new DatabaseOrchestrator({
|
|
163
|
-
enableSafeMode: true
|
|
164
|
-
}),
|
|
165
|
-
secretManager: new EnhancedSecretManager({
|
|
166
|
-
crossDomainCoordination: false
|
|
167
|
-
}),
|
|
168
|
-
productionTester: new ProductionTester({
|
|
169
|
-
comprehensiveTests: true
|
|
170
|
-
}),
|
|
171
|
-
auditor: new DeploymentAuditor({
|
|
172
|
-
auditLevel: 'detailed'
|
|
173
|
-
}),
|
|
174
|
-
rollbackManager: new RollbackManager({
|
|
175
|
-
autoRollbackEnabled: true
|
|
176
|
-
})
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
// Initialize auditing for this deployment
|
|
180
|
-
this.enterpriseModules.auditor.initializeAudit(this.deploymentId, 'modular-interactive-deployment');
|
|
181
|
-
console.log(' โ
Enterprise validation and testing modules loaded');
|
|
182
|
-
console.log(' โ
Enterprise database and security modules loaded');
|
|
183
|
-
console.log(' โ
Enterprise audit and rollback modules loaded');
|
|
184
|
-
|
|
185
|
-
// Update validation manager with enterprise modules
|
|
186
|
-
this.components.validation = new ValidationManager(this.deploymentState.config, this.enterpriseModules);
|
|
187
|
-
|
|
188
|
-
// Update monitoring integration with enterprise modules
|
|
189
|
-
this.components.monitoring = new MonitoringIntegration(this.deploymentState.config, this.enterpriseModules);
|
|
190
|
-
console.log('\\nโ
Enterprise modules initialized successfully');
|
|
191
|
-
} catch (error) {
|
|
192
|
-
console.warn(`\\nโ ๏ธ Enterprise modules initialization failed: ${error.message}`);
|
|
193
|
-
console.log(' Continuing with standard deployment capabilities...');
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Execute modular deployment flow with enhanced progress tracking
|
|
199
|
-
*/
|
|
200
|
-
async executeModularDeploymentFlow() {
|
|
201
|
-
this.deploymentState.startTime = new Date();
|
|
202
|
-
|
|
203
|
-
// Initialize progress tracking for 6 phases
|
|
204
|
-
const progressTracker = startProgress(6, 'Starting Enhanced Modular Deployment');
|
|
205
|
-
|
|
206
|
-
// Phase 1: Environment and Mode Selection
|
|
207
|
-
progressTracker.nextStep('Environment Setup and Mode Selection');
|
|
208
|
-
await this.executeEnvironmentSetup();
|
|
209
|
-
|
|
210
|
-
// Phase 2: Configuration Management
|
|
211
|
-
progressTracker.nextStep('Configuration Generation and Management');
|
|
212
|
-
await this.executeConfigurationSetup();
|
|
213
|
-
|
|
214
|
-
// Phase 3: Comprehensive Validation
|
|
215
|
-
progressTracker.nextStep('Comprehensive Validation Suite');
|
|
216
|
-
await this.executeValidationPhase();
|
|
217
|
-
|
|
218
|
-
// Phase 4: Pre-deployment Preparation
|
|
219
|
-
progressTracker.nextStep('Pre-deployment Preparation');
|
|
220
|
-
await this.executePreDeploymentPhase();
|
|
221
|
-
|
|
222
|
-
// Phase 5: Main Deployment Execution
|
|
223
|
-
progressTracker.nextStep('Main Deployment Execution');
|
|
224
|
-
await this.executeMainDeployment();
|
|
225
|
-
|
|
226
|
-
// Phase 6: Post-deployment Testing and Monitoring
|
|
227
|
-
progressTracker.nextStep('Post-deployment Testing and Monitoring');
|
|
228
|
-
await this.executePostDeploymentPhase();
|
|
229
|
-
console.log('\\nโ
All deployment phases completed successfully!');
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Phase 1: Environment Setup using EnvironmentManager
|
|
234
|
-
*/
|
|
235
|
-
async executeEnvironmentSetup() {
|
|
236
|
-
this.components.monitoring.recordPhase('environment-setup', 'start');
|
|
237
|
-
console.log('\\n๐ Phase 1: Environment Setup');
|
|
238
|
-
console.log('==============================');
|
|
239
|
-
|
|
240
|
-
// Select deployment mode
|
|
241
|
-
const deploymentMode = await this.components.environment.selectDeploymentMode();
|
|
242
|
-
this.deploymentState.config.deploymentMode = deploymentMode;
|
|
243
|
-
|
|
244
|
-
// Initialize environment-specific components
|
|
245
|
-
await this.components.environment.initializeEnvironment();
|
|
246
|
-
|
|
247
|
-
// Gather environment configuration
|
|
248
|
-
const envConfig = await this.components.environment.gatherEnvironmentConfiguration();
|
|
249
|
-
Object.assign(this.deploymentState.config, envConfig);
|
|
250
|
-
this.components.monitoring.recordPhase('environment-setup', 'end', {
|
|
251
|
-
deploymentMode,
|
|
252
|
-
environment: this.deploymentState.config.environment,
|
|
253
|
-
domain: this.deploymentState.config.domain
|
|
254
|
-
});
|
|
255
|
-
console.log(`\\nโ
Environment setup completed - ${deploymentMode} mode`);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Phase 2: Configuration Setup using DeploymentConfiguration
|
|
260
|
-
*/
|
|
261
|
-
async executeConfigurationSetup() {
|
|
262
|
-
this.components.monitoring.recordPhase('configuration-setup', 'start');
|
|
263
|
-
console.log('\\nโ๏ธ Phase 2: Configuration Setup');
|
|
264
|
-
console.log('=================================');
|
|
265
|
-
|
|
266
|
-
// Generate deployment configuration
|
|
267
|
-
const config = await this.components.config.generateDeploymentConfiguration(this.deploymentState.config.domain, this.deploymentState.config.environment, {
|
|
268
|
-
deploymentMode: this.deploymentState.config.deploymentMode,
|
|
269
|
-
interactiveMode: true
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
// Merge configuration
|
|
273
|
-
this.deploymentState.config = {
|
|
274
|
-
...this.deploymentState.config,
|
|
275
|
-
...config
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
// Update all components with final configuration
|
|
279
|
-
this.updateComponentsWithConfig();
|
|
280
|
-
this.components.monitoring.recordPhase('configuration-setup', 'end', {
|
|
281
|
-
configKeys: Object.keys(config).length
|
|
282
|
-
});
|
|
283
|
-
console.log('\\nโ
Configuration setup completed');
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Phase 3: Validation using ValidationManager
|
|
288
|
-
*/
|
|
289
|
-
async executeValidationPhase() {
|
|
290
|
-
this.components.monitoring.recordPhase('validation', 'start');
|
|
291
|
-
console.log('\\n๐ Phase 3: Comprehensive Validation');
|
|
292
|
-
console.log('=====================================');
|
|
293
|
-
|
|
294
|
-
// Execute comprehensive validation
|
|
295
|
-
const validationResult = await this.components.validation.executeComprehensiveValidation();
|
|
296
|
-
if (!validationResult.valid) {
|
|
297
|
-
// Attempt auto-fix for common issues
|
|
298
|
-
if (validationResult.phases.failed.some(f => f.phase === 'Authentication')) {
|
|
299
|
-
const fixed = await this.components.validation.autoFixAuthentication();
|
|
300
|
-
if (fixed) {
|
|
301
|
-
console.log(' โ
Authentication issue auto-fixed');
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// Re-validate after fixes
|
|
306
|
-
const revalidationResult = await this.components.validation.executeComprehensiveValidation();
|
|
307
|
-
if (!revalidationResult.valid) {
|
|
308
|
-
const continueAnyway = await askYesNo('\\nContinue deployment despite validation errors?', 'n');
|
|
309
|
-
if (!continueAnyway) {
|
|
310
|
-
throw new Error('Deployment cancelled due to validation failures');
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
this.components.monitoring.recordPhase('validation', 'end', {
|
|
315
|
-
validationResult: validationResult.valid,
|
|
316
|
-
errors: validationResult.phases.failed.length,
|
|
317
|
-
warnings: validationResult.phases.warnings.length
|
|
318
|
-
});
|
|
319
|
-
console.log('\\nโ
Validation phase completed');
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Phase 4: Pre-deployment Preparation
|
|
324
|
-
*/
|
|
325
|
-
async executePreDeploymentPhase() {
|
|
326
|
-
this.components.monitoring.recordPhase('pre-deployment', 'start');
|
|
327
|
-
console.log('\\n๐ Phase 4: Pre-deployment Preparation');
|
|
328
|
-
console.log('=======================================');
|
|
329
|
-
|
|
330
|
-
// Prepare deployment using orchestrator
|
|
331
|
-
await this.components.orchestrator.prepareDeployment(this.deploymentState.config.domain, this.deploymentState.config.environment, {
|
|
332
|
-
validateConfiguration: true,
|
|
333
|
-
setupDatabase: true,
|
|
334
|
-
generateSecrets: true
|
|
335
|
-
});
|
|
336
|
-
this.components.monitoring.recordPhase('pre-deployment', 'end');
|
|
337
|
-
console.log('\\nโ
Pre-deployment preparation completed');
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Phase 5: Main Deployment Execution
|
|
342
|
-
*/
|
|
343
|
-
async executeMainDeployment() {
|
|
344
|
-
this.components.monitoring.recordPhase('deployment', 'start');
|
|
345
|
-
console.log('\\n๐ Phase 5: Main Deployment Execution');
|
|
346
|
-
console.log('======================================');
|
|
347
|
-
|
|
348
|
-
// Execute deployment using orchestrator
|
|
349
|
-
const deploymentResult = await this.components.orchestrator.executeDeployment(this.deploymentState.config.domain, this.deploymentState.config.environment, {
|
|
350
|
-
enableRollback: true,
|
|
351
|
-
runValidation: true,
|
|
352
|
-
interactiveMode: true
|
|
353
|
-
});
|
|
354
|
-
if (!deploymentResult.success) {
|
|
355
|
-
throw new Error(`Deployment failed: ${deploymentResult.error}`);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
// Update config with deployment results
|
|
359
|
-
this.deploymentState.config.worker = deploymentResult.worker;
|
|
360
|
-
this.deploymentState.config.database = deploymentResult.database;
|
|
361
|
-
this.components.monitoring.recordPhase('deployment', 'end', {
|
|
362
|
-
workerUrl: deploymentResult.worker?.url,
|
|
363
|
-
databaseId: deploymentResult.database?.id
|
|
364
|
-
});
|
|
365
|
-
console.log('\\nโ
Main deployment execution completed');
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* Phase 6: Post-deployment Testing and Monitoring
|
|
370
|
-
*/
|
|
371
|
-
async executePostDeploymentPhase() {
|
|
372
|
-
this.components.monitoring.recordPhase('post-deployment', 'start');
|
|
373
|
-
console.log('\\n๐งช Phase 6: Post-deployment Testing');
|
|
374
|
-
console.log('====================================');
|
|
375
|
-
|
|
376
|
-
// Execute health validation
|
|
377
|
-
await this.components.monitoring.executeHealthValidation();
|
|
378
|
-
|
|
379
|
-
// Execute comprehensive testing
|
|
380
|
-
if (this.enterpriseModules.productionTester) {
|
|
381
|
-
await this.components.monitoring.executeEnterpriseComprehensiveTesting();
|
|
382
|
-
} else {
|
|
383
|
-
await this.components.monitoring.executePostDeploymentTesting();
|
|
384
|
-
}
|
|
385
|
-
this.components.monitoring.recordPhase('post-deployment', 'end');
|
|
386
|
-
console.log('\\nโ
Post-deployment testing completed');
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Update all components with final configuration
|
|
391
|
-
*/
|
|
392
|
-
updateComponentsWithConfig() {
|
|
393
|
-
// Update environment manager
|
|
394
|
-
this.components.environment.config = this.deploymentState.config;
|
|
395
|
-
|
|
396
|
-
// Update validation manager
|
|
397
|
-
this.components.validation.config = this.deploymentState.config;
|
|
398
|
-
|
|
399
|
-
// Update monitoring integration
|
|
400
|
-
this.components.monitoring.config = this.deploymentState.config;
|
|
401
|
-
|
|
402
|
-
// Update deployment orchestrator
|
|
403
|
-
this.components.orchestrator.config = this.deploymentState.config;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Execute rollback in case of deployment failure
|
|
408
|
-
*/
|
|
409
|
-
async executeRollback(error) {
|
|
410
|
-
console.log('\\n๐ Initiating Rollback Process');
|
|
411
|
-
console.log('===============================');
|
|
412
|
-
try {
|
|
413
|
-
const rollbackResult = await this.enterpriseModules.rollbackManager.executeRollback(this.deploymentId, {
|
|
414
|
-
reason: error.message,
|
|
415
|
-
interactiveMode: true
|
|
416
|
-
});
|
|
417
|
-
if (rollbackResult.success) {
|
|
418
|
-
console.log('\\nโ
Rollback completed successfully');
|
|
419
|
-
} else {
|
|
420
|
-
console.error(`\\nโ Rollback failed: ${rollbackResult.error}`);
|
|
421
|
-
}
|
|
422
|
-
} catch (rollbackError) {
|
|
423
|
-
console.error(`\\nโ Rollback process failed: ${rollbackError.message}`);
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Cleanup resources and close connections
|
|
429
|
-
*/
|
|
430
|
-
async cleanup() {
|
|
431
|
-
console.log('\\n๐งน Cleaning up resources...');
|
|
432
|
-
try {
|
|
433
|
-
// Cleanup modular components
|
|
434
|
-
if (this.components.environment) {
|
|
435
|
-
await this.components.environment.cleanup();
|
|
436
|
-
}
|
|
437
|
-
if (this.components.monitoring) {
|
|
438
|
-
this.components.monitoring.cleanup();
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
// Cleanup enterprise modules
|
|
442
|
-
if (this.enterpriseModules.rollbackManager) {
|
|
443
|
-
await this.enterpriseModules.rollbackManager.cleanup();
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
// Close interactive prompts
|
|
447
|
-
closePrompts();
|
|
448
|
-
console.log(' โ
Cleanup completed');
|
|
449
|
-
} catch (error) {
|
|
450
|
-
console.warn(` โ ๏ธ Cleanup warning: ${error.message}`);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
* Main execution entry point
|
|
457
|
-
*/
|
|
458
|
-
async function main() {
|
|
459
|
-
const deployer = new ModularEnterpriseDeployer();
|
|
460
|
-
await deployer.run();
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
// Execute if running directly
|
|
464
|
-
if (process.argv[1] && import.meta.url.includes(process.argv[1].replace(/\\\\/g, '/'))) {
|
|
465
|
-
main().catch(console.error);
|
|
466
|
-
}
|