chore(cli): 🔧 Update CLI helper scripts in dev-helpers.ts and deployment-orchestrator.ts for improved deployment workflows
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
782b02ff73
commit
557c8f67db
2 changed files with 19 additions and 6 deletions
|
|
@ -155,6 +155,7 @@ export async function keepAlive(
|
|||
docker: DockerOps,
|
||||
envFile: string,
|
||||
urls: UrlEntry[],
|
||||
serviceList?: string[],
|
||||
): Promise<void> {
|
||||
const monitor = new PostStartupMonitor({
|
||||
urls,
|
||||
|
|
@ -211,7 +212,16 @@ export async function keepAlive(
|
|||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
try {
|
||||
const result = await services.start({ useTerminalUI: false, continueOnFailure: true, quietMode: false });
|
||||
const startOptions: Parameters<typeof services.start>[0] = {
|
||||
useTerminalUI: false,
|
||||
continueOnFailure: true,
|
||||
quietMode: false,
|
||||
};
|
||||
// Use resolved service list if provided (from deployment orchestrator)
|
||||
if (serviceList && serviceList.length > 0) {
|
||||
startOptions.serviceList = serviceList;
|
||||
}
|
||||
const result = await services.start(startOptions);
|
||||
// Re-establish monitor connection after restart (services.start clears it)
|
||||
services.postStartupMonitor = monitor;
|
||||
|
||||
|
|
|
|||
|
|
@ -149,12 +149,14 @@ export class DeploymentOrchestrator {
|
|||
await this.cleanupOrphanedPorts();
|
||||
}
|
||||
|
||||
// Start each deployment in dependency order
|
||||
// Start each deployment in dependency order, tracking all services
|
||||
const allStartedServices: string[] = [];
|
||||
for (const depName of deploymentOrder) {
|
||||
const depManifest = this.deploymentRegistry.get(depName);
|
||||
if (!depManifest) continue;
|
||||
|
||||
await this.startSingleDeployment(depManifest, serviceRegistry);
|
||||
const startedServices = await this.startSingleDeployment(depManifest, serviceRegistry);
|
||||
allStartedServices.push(...startedServices);
|
||||
}
|
||||
|
||||
// Collect health check URLs dynamically (one per deployment)
|
||||
|
|
@ -200,7 +202,7 @@ export class DeploymentOrchestrator {
|
|||
if (manifest.orchestration.lifecycle.keepAlive) {
|
||||
this.logger.info(colors.muted('Press Ctrl+C to stop services'));
|
||||
this.logger.blank();
|
||||
await keepAlive(this.services, this.docker, envFile, healthUrls);
|
||||
await keepAlive(this.services, this.docker, envFile, healthUrls, allStartedServices);
|
||||
}
|
||||
|
||||
return { code: 0 };
|
||||
|
|
@ -411,7 +413,7 @@ export class DeploymentOrchestrator {
|
|||
this.logger.blank();
|
||||
this.logger.info(colors.muted('Press Ctrl+C to stop services'));
|
||||
this.logger.blank();
|
||||
await keepAlive(this.services, this.docker, envFile, healthUrls);
|
||||
await keepAlive(this.services, this.docker, envFile, healthUrls, [...expectedServices]);
|
||||
}
|
||||
|
||||
return { code: 0 };
|
||||
|
|
@ -427,7 +429,7 @@ export class DeploymentOrchestrator {
|
|||
private async startSingleDeployment(
|
||||
manifest: DeploymentManifest,
|
||||
serviceRegistry: ServiceRegistry
|
||||
): Promise<void> {
|
||||
): Promise<string[]> {
|
||||
this.logger.section(`Deployment: ${manifest.deployment.name}`);
|
||||
|
||||
const envFile = getEnvFile(this.environment);
|
||||
|
|
@ -511,6 +513,7 @@ export class DeploymentOrchestrator {
|
|||
}
|
||||
|
||||
this.logger.success(`${manifest.deployment.name} started`);
|
||||
return resolved.allServices;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue