fix(deploy): stop scales all app workloads and sets status stopped

Use suspendApplication on stop so app, database, Redis, and RabbitMQ
deployments scale to zero. Start uses resumeApplication to bring the
full stack back. Deployment status is updated to stopped/running.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-05-15 00:57:31 +03:30
parent abd8848180
commit 195b3f5bab
2 changed files with 61 additions and 73 deletions
@@ -240,15 +240,15 @@ export class DeploymentsService {
async stopDeployment(applicationId: string, userId: string): Promise<Deployment | null> {
const app = await this.applicationsService.findOne(applicationId, userId);
await this.kubernetesService.scaleDeployment(app, 0);
await this.kubernetesService.suspendApplication(app);
// Update the latest deployment status to stopped
const latest = await this.deploymentsRepository.findOne({
where: { applicationId },
order: { createdAt: 'DESC' },
});
if (latest) {
latest.status = DeploymentStatus.STOPPED;
latest.finishedAt = latest.finishedAt || new Date();
await this.deploymentsRepository.save(latest);
}
return latest;
@@ -256,9 +256,8 @@ export class DeploymentsService {
async startDeployment(applicationId: string, userId: string): Promise<Deployment | null> {
const app = await this.applicationsService.findOne(applicationId, userId);
await this.kubernetesService.scaleDeployment(app, app.replicas || 1);
await this.kubernetesService.resumeApplication(app);
// Update the latest deployment status to running
const latest = await this.deploymentsRepository.findOne({
where: { applicationId },
order: { createdAt: 'DESC' },