bf9e827f85
Deploy backend, frontend, PostgreSQL, and Redis on Kubernetes with optional Ingress/TLS, SQL migration hooks, and public registry exposure at repo.3fase.ir. Co-authored-by: Cursor <cursoragent@cursor.com>
5.1 KiB
5.1 KiB
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[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.enabledand cert-manager TLS - Post-install migration Job for SQL files in
migrations/ values-production.example.yamlfor production overrides
Helm Chart (backend/helm/cloudhost-app/)
- New Helm chart replacing legacy Handlebars templates for all deployments
deployment.yaml— app deployment withimagePullSecrets,imagePullPolicy: Always, health probesservice.yaml— ClusterIP service (port 80 → app port)ingress.yaml— Nginx ingress with cert-manager TLSsecret.yaml— user env vars as K8s Secretdb-deployment.yaml— PostgreSQL or MySQL with readiness/liveness probesdb-service.yaml— database ClusterIP servicedb-pvc.yaml— database storage withhelm.sh/resource-policy: keepdb-secret.yaml— database credentials withhelm.sh/resource-policy: keepwp-pvc.yaml— WordPress wp-content PVC with keep policyregistry-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 runtimesChart.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
PlatformSettingstable activateApp()andrenewApp()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 BillingServicedeductWallet()method for programmatic wallet deductions- Billing controller integrates lifecycle activation on payment
Application Entity Enhancements
- New fields:
planId,billingCycle,lifecycleStatus,planExpiresAt,suspendedAt,scheduledDeletionAt AppLifecycleStatusenum:active,suspended,pending_deletion,deletedBillingCycleenum: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 scripthelm.service.spec.ts— HelmService chart path, temp files, history parsingkubernetes.service.spec.ts—buildHelmValues()logic, password generationclusters.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.confandsupervisord.confinline (no longer requires user-provided files) - Laravel fix —
composer.lockmade optional (composer.lock*) - ConfigMap cleanup moved to
finallyblock
Kubernetes Service (backend/src/kubernetes/kubernetes.service.ts)
buildHelmValues()now includesregistry.urlfor pull secret generationdeleteApplication()rewritten — runshelm uninstallthen 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
lifecycleconfig section withscanIntervalMsand per-cycledeleteAfterMsdefaults
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