# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ### Added #### Helm Chart (`backend/helm/cloudhost-platform/`) - **Platform chart** — deploy control plane (backend, frontend, PostgreSQL, Redis) on Kubernetes - Ingress with `ingress.enabled` / `ingress.tls.enabled` and cert-manager TLS - Post-install migration Job for SQL files in `migrations/` - `values-production.example.yaml` for production overrides #### Helm Chart (`backend/helm/cloudhost-app/`) - **New Helm chart** replacing legacy Handlebars templates for all deployments - `deployment.yaml` — app deployment with `imagePullSecrets`, `imagePullPolicy: Always`, health probes - `service.yaml` — ClusterIP service (port 80 → app port) - `ingress.yaml` — Nginx ingress with cert-manager TLS - `secret.yaml` — user env vars as K8s Secret - `db-deployment.yaml` — PostgreSQL or MySQL with readiness/liveness probes - `db-service.yaml` — database ClusterIP service - `db-pvc.yaml` — database storage with `helm.sh/resource-policy: keep` - `db-secret.yaml` — database credentials with `helm.sh/resource-policy: keep` - `wp-pvc.yaml` — WordPress wp-content PVC with keep policy - `registry-pull-secret.yaml` — imagePullSecret for insecure registries - `_helpers.tpl` — shared template helpers (name, namespace, labels, DB image, DB port) - `values.yaml` — comprehensive defaults for all runtimes - `Chart.yaml` — chart metadata (v0.1.0) #### Helm Service (`backend/src/kubernetes/helm.service.ts`) - **New HelmService** wrapping Helm CLI for install/upgrade, rollback, uninstall, history, status - Temp file management for kubeconfig and values (mode 0o600, auto-cleanup) - Full error handling with structured logging #### Lifecycle Module (`backend/src/lifecycle/`) - **New AppLifecycleService** — cron-based scanner (configurable interval, default 60s) - State machine: `ACTIVE → SUSPENDED → PENDING_DELETION → DELETED` - Auto-suspend expired apps (scale to 0 replicas) - Auto-renew hourly plans from wallet balance - Admin-configurable grace periods via `PlatformSettings` table - `activateApp()` and `renewApp()` for payment reactivation - **New LifecycleController** — `GET/PATCH /lifecycle/settings` (admin only) - **New LifecycleModule** — wires service, controller, entities #### Billing Enhancements (`backend/src/billing/`) - **PlatformSetting entity** — key-value settings table for admin runtime config - `calculateCostForApp()` method in BillingService - `deductWallet()` method for programmatic wallet deductions - Billing controller integrates lifecycle activation on payment #### Application Entity Enhancements - New fields: `planId`, `billingCycle`, `lifecycleStatus`, `planExpiresAt`, `suspendedAt`, `scheduledDeletionAt` - `AppLifecycleStatus` enum: `active`, `suspended`, `pending_deletion`, `deleted` - `BillingCycle` enum: `hourly`, `monthly`, `yearly` #### Frontend - Wallet balance display in dashboard header (all pages) - Lifecycle status column in user apps list (color-coded badges) - Plan expiry countdown in apps list - Admin apps page: suspended/pending-deletion summary cards - Admin billing page: lifecycle settings management section - Updated TypeScript types for lifecycle and billing fields #### Tests - `build.service.spec.ts` — WordPress Dockerfile generation, PVC race condition, entrypoint script - `helm.service.spec.ts` — HelmService chart path, temp files, history parsing - `kubernetes.service.spec.ts` — `buildHelmValues()` logic, password generation - `clusters.service.spec.ts` — getDefault logic, delete/reassign logic ### Changed #### Build Service (`backend/src/build/build.service.ts`) - **Runtime detection** — `detectRuntime()` now reads parent directory (not zip file itself) - **WordPress support** — full Dockerfile generation with custom entrypoint for wp-content merging - **Laravel fix** — generates `nginx.conf` and `supervisord.conf` inline (no longer requires user-provided files) - **Laravel fix** — `composer.lock` made optional (`composer.lock*`) - ConfigMap cleanup moved to `finally` block #### Kubernetes Service (`backend/src/kubernetes/kubernetes.service.ts`) - `buildHelmValues()` now includes `registry.url` for pull secret generation - `deleteApplication()` rewritten — runs `helm uninstall` then explicitly deletes kept resources (PVCs, secrets, TLS certs) - Added `scaleDeployment()` method for lifecycle suspend/resume #### Applications Controller - Delete endpoint no longer requires `app.clusterId && app.latestImageTag` — always attempts K8s cleanup #### Configuration - Added `lifecycle` config section with `scanIntervalMs` and per-cycle `deleteAfterMs` defaults ### Documentation - **ARCHITECTURE.md** — complete rewrite: added WordPress, Helm charts, billing/lifecycle, all modules - **README.md** — complete rewrite: added WordPress, billing, lifecycle, snapshots, tickets, new API endpoints - **CHANGELOG.md** — created (this file) - **CONTRIBUTING.md** — created with commit conventions, documentation requirements