add optinal apps

This commit is contained in:
keyhan
2026-04-23 15:26:49 +03:30
parent f481a57d8f
commit 38748b0827
16 changed files with 3091 additions and 144 deletions
@@ -70,13 +70,13 @@ export class AppLifecycleService implements OnModuleInit, OnModuleDestroy {
const saved = await this.appRepo.save(app);
// If the app was suspended, scale it back up
// If the app was suspended, resume it (scale app + database back up)
if (app.latestImageTag) {
try {
await this.kubernetesService.scaleDeployment(app, app.replicas || 1);
this.logger.log(`Reactivated ${app.name}scaled to ${app.replicas} replicas, expires ${expiresAt.toISOString()}`);
await this.kubernetesService.resumeApplication(app);
this.logger.log(`Reactivated ${app.name}resumed with ${app.replicas} replicas, expires ${expiresAt.toISOString()}`);
} catch (e: any) {
this.logger.warn(`Failed to scale up ${app.name} on reactivation: ${e.message}`);
this.logger.warn(`Failed to resume ${app.name} on reactivation: ${e.message}`);
}
}
@@ -136,11 +136,11 @@ export class AppLifecycleService implements OnModuleInit, OnModuleDestroy {
if (renewed) continue;
}
// Suspend: scale to 0
// Suspend: scale app and database to 0
try {
await this.kubernetesService.scaleDeployment(app, 0);
await this.kubernetesService.suspendApplication(app);
} catch (e: any) {
this.logger.warn(`Failed to scale down ${app.name}: ${e.message}`);
this.logger.warn(`Failed to suspend ${app.name} in K8s: ${e.message}`);
}
app.lifecycleStatus = AppLifecycleStatus.SUSPENDED;