Commit Graph

62 Commits

Author SHA1 Message Date
keyhan dc9830383b Improve logging recovery, resource scaling, and app deploy logging.
Auto-reconnect Elasticsearch port-forward after cluster or API restarts, poll log status in the UI, and apply storage changes through billing upgrade for all workloads. Add Redis/RabbitMQ PVC resize, Helm ES credentials for Fluent Bit, and fix deploy progress overlay behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 21:41:00 +03:30
keyhan abbe821d91 Improve delete UX and prepaid credit time display.
Show minutes and local expiry for resource credits; add shared delete hook with row/card loading overlays, detail-page deleting modal, and disabled controls to prevent double-delete.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-24 00:33:16 +03:30
keyhan 695e05f948 Add managed databases and services with billing-aligned upgrades.
Introduce product types for managed PostgreSQL, Redis, and RabbitMQ with a dedicated dashboard, Helm-only deploy pipeline, external access, snapshots with progress, and prorated resource or storage upgrades matching application billing rules. PVCs use an expandable StorageClass with automatic migration when legacy disks cannot resize in place.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 19:00:09 +03:30
keyhan 736509708b Add persistent deployment progress bar with minimize support.
Deployments can continue in the background via a dashboard progress bar; tables use truncation and admin migration status for cleaner layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 22:41:31 +03:30
keyhan 18c6abd0e8 Add service credential visibility.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 00:35:01 +03:30
keyhan 41a276d16d Add application migration workflow.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 00:31:29 +03:30
keyhan fda8384a5c Improve cluster allocation strategy.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 23:18:50 +03:30
keyhan 72a1519ea0 Add automatic cluster pool allocation.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 23:08:06 +03:30
keyhan 97e4c865b6 Require paid access before redeploy.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 22:37:13 +03:30
keyhan e4fe8f63cb Hide stop action for failed apps.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 22:31:21 +03:30
keyhan 68d1ccb196 Track cancelled deployments separately.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 22:15:43 +03:30
keyhan d5e6ab0f68 Add invoice PDF download and unified payment.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 22:01:44 +03:30
keyhan 8b197e69bc Add invoice payment management.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 21:34:47 +03:30
keyhan a7293973d5 Add staff password reset, raise code upload limit, and guard restore sizing.
Admins and technical staff can reset passwords via PATCH /users/:id/password with scoped permissions for technical users; deploy/source uploads allow up to 10GiB and block deploy when allocated storage is smaller than uploaded archive or DB dump, with an inline error modal.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-16 01:03:07 +03:30
keyhan 67b41ae311 Align admin optional-services billing UI with runtimes and bill RAM proportionally.
Split optional pricing vs deploy defaults and move custom domain to its own card; parse Mi as decimal GB so fractional memory scales linearly with per-GB rates. Deploy wizard hides env and optional services for WordPress and sanitizes create payloads.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-16 00:39:37 +03:30
keyhan 3a4fffcec4 Reorder deploy wizard: env vars on step 1, app storage on step 3.
Move Environment Variables to Basic Info and Application Data Storage to Resources so users configure them earlier and later in the flow.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 19:30:30 +03:30
keyhan 055e7a7c8d Add optional service pricing matrix and fix admin catalog save.
Users pick per-service CPU/memory/storage at deploy; admins manage unit rates and deploy defaults. PATCH sends only fields accepted by the pricing-catalog DTO.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 19:16:20 +03:30
keyhan bb27c90ae4 Make billing catalog dynamic for all runtimes and bill optional service resources.
Derive admin tabs and addon rows from enums, and add Redis/RabbitMQ/ES CPU/RAM/disk to deploy cost using the app runtime unit rates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 18:22:35 +03:30
keyhan 35235fe0fc Replace billing plans with per-runtime usage pricing catalog.
Store explicit hourly/monthly/yearly rates in pricing_rates and addon_rates, compute deploy costs without cycle conversion, and simplify admin UI and wallet payment to cycle-only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 18:10:54 +03:30
keyhan 5239e8aa94 Add prepaid resource credits with prorated deploy billing.
When users delete an app before plan expiry, remaining resources become credits for a new deploy. The deploy calculator shows covered vs additional charges, prices optional services correctly, and prorates extras to days left on the credit.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 17:37:44 +03:30
keyhan 35dd771f63 Add unified logs platform with Helm-managed central Elasticsearch.
Deploy cloudhost-logging on cluster registration, ship app and optional service logs to ES with owner isolation, and fix Kibana 8.12 auth via kibana_system.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 15:56:33 +03:30
keyhan 2303985d0c Add time-limited external access for optional services and database.
Users can open temporary NodePort access with auto-revoke via Bull jobs and a dashboard UI to manage active grants.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 13:58:08 +03:30
keyhan c7981074d4 fix(ui): keep resource scaling form values while user is editing
Skip syncing form state from the 5s resources poll when the form is
dirty, and reset dirty only after apply or workload tab change.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 01:11:10 +03:30
keyhan cca6cdc1a5 Improve Laravel deploy support and add .env import to deploy wizard.
Set Laravel DB env vars in Helm and Kubernetes, fix default port to 80 with a storage-aware entrypoint, and let users upload a .env file during deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 18:49:40 +03:30
keyhan b24d1505b6 feat: per-workload resources, storage GiB metrics, optional service disks
- Expose DB/Redis/RabbitMQ usage plus sidecars in getResourceUsage
- Storage API: GiB fields, Redis/Rabbit PVC usage, fix du/exec container names
- PATCH /resources accepts workload; persist entity fields only for app
- App detail: workload cards, disk bars, DB expand, scale target select

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 16:28:01 +03:30
keyhan 0c0a6cd5be fix: reliable source upload, build cancel, WordPress port 80 default
- Replace port-forward/netcat PVC upload with kubectl cp for integrity
- Add build cancellation API and session cleanup; deploy catches cancel
- Default port 80 for WordPress, PHP, and Laravel on create
- Build progress modal with cancel; Helm/K8s adjustments for deployments
- Update build and kubernetes specs

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 16:03:45 +03:30
keyhan 3d56a2cc5d feat(logging): add logs dashboard page
Add dashboard UI to browse application logs with filters for app,
level, time range, and full-text search.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 12:42:00 +03:30
keyhan 583c4c4c90 feat(deploy): add DNS verification with modal before proceeding to next step
Add standalone DNS check endpoint and verify DNS on Next click in the
deploy wizard (step 2). Show error modal with CNAME instructions when
DNS is not configured instead of disabling the Next button. Also make
the custom domain clickable in the app detail header.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 01:20:57 +03:30
keyhan e8be7fbf03 fix(deploy): move custom domain toggle from Review to Optional Services step
The custom domain option now lives in Step 2 alongside Redis, RabbitMQ,
and Elasticsearch, styled consistently as a toggle card. The Review step
remains a read-only summary.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 00:53:04 +03:30
keyhan 30ccfa4ee2 fix: update cost estimate on domain toggle, switch to English, fix toggle overflow
- Cost calculation now reads custom domain price from PlatformSetting
  as fallback when no CUSTOM_DOMAIN_ADDON pricing rule exists
- Convert all custom domain UI text from Persian to English
- Fix toggle switch overflow by adding shrink-0, min-w-0, and proper
  absolute positioning

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 00:49:20 +03:30
keyhan 435cf92817 feat: add custom domain support with SSL, DNS verification, and billing
Users can assign a custom domain to their app with automatic SSL via
cert-manager. Includes DNS verification flow (CNAME check), Persian
instructions, admin-configurable pricing via PlatformSetting, and
integration into the deploy wizard cost calculation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 00:36:29 +03:30
keyhan 38748b0827 add optinal apps 2026-04-23 15:26:49 +03:30
keyhan e10f9c5235 feat(frontend): lifecycle status, wallet balance, admin billing UI
- Wallet balance display in dashboard header
- Lifecycle status badges (color-coded) in apps list
- Plan expiry countdown column
- Admin apps: suspended/pending-deletion summary cards
- Admin billing: lifecycle settings management
- Updated TypeScript types for lifecycle and billing
2026-04-22 16:44:58 +03:30
keyhan 2dd882bf34 fix: move useQuery before early returns in DashboardLayout
The useQuery hook for unanswered ticket counts was called after
two conditional early returns (isLoading and not isAuthenticated),
violating React rules of hooks. Moved it before the returns
and added isAuthenticated to the enabled condition.
2026-04-08 13:13:20 +03:30
keyhan cb9320ee15 refactor: add useDebounce hook and replace manual debounce in admin search
- Create reusable useDebounce<T> hook in frontend/src/hooks/useDebounce.ts
- Replace manual setTimeout/clearTimeout + extra state in AdminAppsPage
  with clean useDebounce(search, 400) pattern
- Removes timer state and handleSearch wrapper function
2026-04-08 12:40:25 +03:30
keyhan d01a0a5e8c feat: use Kubernetes revision-based rollback for instant app rollback
- Add revisionHistoryLimit: 10 and change-cause annotation to K8s deployments
- Add getDeploymentRevisions() to list ReplicaSet revision history
- Add rollbackDeploymentRevision() using K8s API (instant, no rebuild)
- Refactor snapshot rollback: use K8s revision for app, keep file-based DB/wp-content restore
- Add GET /snapshots/applications/:appId/revisions endpoint
- Add POST /snapshots/applications/:appId/revisions/:rev/rollback endpoint
- Add K8sRevision and K8sRevisionData types to frontend
- Redesign UI with two tabs: K8s Revisions (instant) + File Snapshots (full backup)
- K8s Revisions tab shows deployment history with one-click instant rollback
- File Snapshots tab retains download, DB restore, and wp-content restore
2026-04-08 02:26:51 +03:30
keyhan d3a5240528 feat: add snapshot/rollback system with download capability
- Add AppSnapshot entity with type (pre_deploy/manual), status tracking, and file paths
- Add SnapshotsService with create, capture, rollback, prune (max 10), and download logic
- Add SnapshotsController with REST endpoints for CRUD, rollback, and file downloads
- Add K8s methods: exportDatabaseDump, archiveWpContent, restoreWpContent
- Auto-create pre-deploy snapshots before each deployment for rollback safety
- Support downloading current live state (source, wp-content, database) without snapshots
- Add snapshot management UI in app detail page with create, rollback, download, delete
- Wire circular dependencies with forwardRef between Deployments and Snapshots modules
2026-04-08 01:55:00 +03:30
keyhan ac5278d73b feat: replace native confirm() dialogs with custom modal component
- Add ModalProvider context and useConfirm hook (confirm-modal.tsx)
- Support danger/warning/info variants with icons and colors
- Animated backdrop and dialog with CSS keyframes
- Accessible: aria-modal, role=dialog, ESC to close, auto-focus
- Replace all 6 native confirm() calls across dashboard pages
- Integrate ModalProvider in app providers
2026-04-07 23:38:55 +03:30
keyhan 5979b48a61 feat: WordPress migration support — upload existing site files
- Add two deployment modes for WordPress: Fresh Install vs Migrate Existing Site
- Fresh Install: vanilla WordPress from official image (existing behavior)
- Migrate: upload ZIP with wp-content/ (themes, plugins, uploads), wp-config.php, .htaccess
- Custom entrypoint merges staged wp-content into PVC on first container run
- Add init container for fresh WordPress builds (empty source context for Kaniko)
- Increase upload limit to 200MB for WordPress sites
- Add PHP upload limits (64MB) and memory config in WordPress Dockerfile
- Update deploy page review step to show WordPress mode info
- All UI in English
2026-04-07 23:12:25 +03:30
keyhan c2c6a32ae8 feat: billing v2 — runtime-based plans, English UI, payment flow
- ServicePlan now has 'runtime' field (nodejs/laravel/wordpress)
- Admin billing page: Application Type dropdown, English UI, Toman prices
- calculateCost filters active plans by matching runtime
- Wallet page: English UI, payment gateway integration (Pay Now button)
- Deploy page Review step: billing cycle selector (hourly/monthly/yearly),
  payment method choice (wallet or payment gateway), Pay & Deploy button
- Payment gateway endpoints: POST /billing/gateway/initiate + /verify
  (simulated — ready for Zarinpal/IDPay integration)
- Deploy requires payment: wallet deduction or gateway charge before deploy
2026-04-07 02:05:58 +03:30
keyhan 4974f88e8c feat: billing system — service plans, wallet, cost calculation
- Backend: billing module with ServicePlan, PricingRule, Wallet, WalletTransaction entities
- Admin can CRUD service plans with hourly/monthly/yearly billing cycles
- Each plan has flexible pricing rules (base_fee, cpu, memory, storage, db addon)
- Wallet system: auto-created per user, charge, deduct, refund, transaction history
- Cost calculation endpoint: cross-cycle conversion (hourly*720=monthly, monthly*12=yearly)
- Frontend: admin billing management page (/dashboard/admin/billing)
- Frontend: user wallet page with balance, quick-charge, transaction history
- Deploy page: cost breakdown shown in Review step (hourly/monthly/yearly)
- Navigation: Wallet link for users, Billing Plans link for admins
2026-04-07 01:45:45 +03:30
keyhan ac489c88d8 feat: dynamic database storage size with PVC expansion
- Add dbStorageSize column to Application entity (default: 1Gi)
- Add dbStorageSize to CreateApplicationDto, frontend types
- Use dynamic storage size in K8s deployDatabase instead of hardcoded 5Gi
- Deploy page: storage size selector with +/- buttons (min 1GB, max 100GB)
- Auto-suggest storage based on DB dump file size (3x dump size, min 1GB)
- Show DB storage in Review step
- App detail: Database Storage section with expand button
- GET /applications/:id/db-storage — read current PVC size from K8s
- PATCH /applications/:id/db-storage — expand PVC (only increase, no shrink)
- PVC resize uses JSON patch on K8s API
2026-04-07 01:28:01 +03:30
keyhan e775b57421 feat: move runtime selection to Step 0, hide source code for WordPress
- Move Application Type (Node.js/Laravel/WordPress) cards from Step 1 to Step 0 (Basic Info)
- Hide source code upload/git section when WordPress is selected
- Show WordPress info box explaining official Docker image usage
- Rename Step 1 heading to 'Versions & Database'
- Update Review step to show 'WordPress (Official Image)' as source
- Hide git branch/token review lines for WordPress
2026-04-07 00:47:42 +03:30
keyhan 762657f9ed feat: version selection for runtimes and databases
Backend:
- Add runtimeVersion, phpVersion, dbVersion columns to Application entity
- Add version fields to CreateApplicationDto with validation
- Node.js Dockerfile: use selected version (22/20/18/16) instead of hardcoded 20
- Laravel Dockerfile: use selected PHP version (8.4/8.3/8.2/8.1) instead of 8.3
- WordPress Dockerfile: use selected WP version (6.7/6.6/6.5/6.4) + PHP version
- K8s deployDatabase(): use selected DB version instead of hardcoded postgres:16/mysql:8.0
- K8s restoreDatabaseDump(): match DB image version for restore jobs
- Add dbVersion to ManifestContext interface

Frontend:
- Add runtimeVersion, phpVersion, dbVersion to Application and CreateApplicationDto
- Deploy page: Node.js version dropdown (22/20/18/16)
- Deploy page: Laravel PHP version dropdown (8.4/8.3/8.2/8.1)
- Deploy page: WordPress version + PHP version dropdowns
- Deploy page: PostgreSQL version dropdown (17/16/15/14)
- Deploy page: MySQL version dropdown (9.0/8.4/8.0/5.7)
- Deploy page: auto-set default versions on runtime/DB selection
- Review step: show selected versions
- App detail page: display runtime + DB versions in config and header
2026-04-06 23:38:23 +03:30
keyhan c411c5873e feat: add WordPress as runtime — Dockerfile, K8s env vars, wp-content PVC, frontend UI
Backend:
- Add WORDPRESS to AppRuntime enum
- Add wordpressDockerfile() using wordpress:6-php8.3-apache base image
  with custom theme/plugin/wp-content merge support
- Add WordPress-specific K8s env vars (WORDPRESS_DB_HOST, WORDPRESS_DB_USER,
  WORDPRESS_DB_PASSWORD, WORDPRESS_DB_NAME, WORDPRESS_TABLE_PREFIX)
- Create wp-content PersistentVolumeClaim (2Gi) for WordPress deployments
- Mount wp-content PVC in deployment container at /var/www/html/wp-content

Frontend:
- Add 'wordpress' to runtime type unions (Application, CreateApplicationDto)
- Add WordPress runtime card in deploy page (port 80, blue icon)
- Auto-select MySQL database when WordPress is chosen, disable other DB options
- Show Persian hint 'وردپرس به MySQL نیاز دارد' when WordPress selected
- Update all runtime icon colors across dashboard, apps, admin/apps pages
  to show blue-600 for WordPress
2026-04-06 23:13:39 +03:30
keyhan ea86acf2ab feat(ui): allow uploading DB dump at app creation — deploy page accepts optional SQL dump and uploads it after app creation 2026-04-06 22:53:47 +03:30
keyhan 9e3347cb71 feat: database management — custom credentials, dump upload/restore
Backend:
- Add dbUsername/dbPassword columns to Application entity
- Add optional DB credential fields to CreateApplicationDto
- Auto-generate dbPassword (crypto.randomBytes) and default dbUsername='appuser'
  when databaseType != 'none' on app creation
- Store both username and password in K8s DB secret (was password-only)
- Read DB_USER/POSTGRES_USER/MYSQL_USER from secretKeyRef instead of hardcoded
- New restoreDatabaseDump() in KubernetesService: creates K8s Job with
  psql/mysql client to restore uploaded SQL dump, waits for completion,
  returns logs
- New POST /applications/:id/db-upload endpoint with 500MB file limit

Frontend:
- Add dbUsername/dbPassword to Application and CreateApplicationDto types
- Deploy page: show username/password fields when database is selected,
  with generate-random-password button and show/hide toggle
- App detail page: new Database section with connection info (host, port,
  db name, username, password with copy-to-clipboard), SQL dump upload
  area with drag-and-drop, and restore output logs display

Security:
- Database remains ClusterIP only (no external exposure)
- Credentials stored in K8s Secrets (base64-encoded)
- Dump file uploaded as temporary K8s Secret, auto-cleaned after restore
2026-04-06 22:47:41 +03:30
keyhan 3c3e0e48fa refactor: migrate from react-hot-toast to react-toastify and replace all emoji icons with Lucide React
- Replaced react-hot-toast with react-toastify (ToastContainer in providers.tsx)
- Removed @heroicons/react dependency
- Added lucide-react for consistent SVG icon system
- Migrated all 18 frontend pages from emoji icons to Lucide components
- Updated sidebar navigation, login/register, dashboard, apps, deploy,
  tickets, admin users/clusters/pools pages
- All emoji indicators (status, runtime, actions) now use proper SVG icons
- Build passes with zero TypeScript errors
2026-04-06 17:20:56 +03:30
keyhan 5d281b85d6 feat: add status summary cards to All Applications page
- Show running, deploying, pending, stopped, failed counts as color-coded cards
- Cards displayed at top of All Applications page for quick status overview
- Skeleton loading state includes card placeholders
2026-04-06 14:44:57 +03:30
keyhan 8243ac7df2 feat: technical role can view all applications with search, separate /all route
- Add GET /applications/all endpoint for admin/technical with search by user name/email/ID
- GET /applications now always returns only the current user's apps (fix for technical seeing all apps)
- Technical role can view/edit/delete any application (same as admin)
- Add 'All Applications' page with search bar, user info columns, status badges
- Add 'All Applications' link to admin and technical sidebar navigation
- Add user relation to Application TypeScript interface
2026-04-06 14:43:46 +03:30