Skip to content

Instantly share code, notes, and snippets.

@lexfrei
Created March 20, 2026 10:49
Show Gist options
  • Select an option

  • Save lexfrei/3a4d5ccf61a2ae018b3d6cfe7fa3e1d9 to your computer and use it in GitHub Desktop.

Select an option

Save lexfrei/3a4d5ccf61a2ae018b3d6cfe7fa3e1d9 to your computer and use it in GitHub Desktop.
Cozystack WHMCS Module — Sales Demo Script

Cozystack WHMCS Module — Sales Demo Script

Overview

This demo shows the complete self-service cloud provisioning flow: a customer orders a Cozystack tenant, gets dashboard credentials, deploys resources, and sees costs — all through WHMCS.


Demo Flow

1. Order a Tenant (2 min)

Narration: "A customer visits our store and orders a Cozystack tenant."

  1. Open https://whmcs.dev.infra.aenix.org
  2. Log in (or show already logged in)
  3. Go to Store → Cozystack → Order Now
  4. Enter a tenant name (e.g. acmecorp)
  5. Click Continue → Checkout → Complete Order
  6. Wait ~20 seconds for provisioning

Key points:

  • Tenant is automatically created in Kubernetes
  • Keycloak user is provisioned for dashboard access
  • Credentials appear on the service page immediately

2. View Service Details (1 min)

Narration: "The customer immediately sees their dashboard credentials."

  1. Navigate to the new service in My Products & Services
  2. Show the Dashboard Access panel:
    • Dashboard URL
    • Username
    • Temporary password
  3. Point out "Getting Started" prompt for new tenants

Key points:

  • No manual setup needed — everything is automated
  • Password must be changed on first login
  • Page auto-refreshes every 60 seconds

3. Log into Cozystack Dashboard (1 min)

Narration: "The customer clicks through to their cloud dashboard."

  1. Click Visit Website or the dashboard URL
  2. Keycloak login page appears
  3. Enter the username and password from WHMCS
  4. Cozystack Dashboard loads

Key points:

  • SSO via Keycloak — one click from WHMCS to cloud management
  • User sees only their own tenant's resources
  • Full self-service: deploy VMs, databases, storage

4. Deploy a Resource (2 min)

Narration: "Let's deploy a managed database."

  1. In the Cozystack Dashboard, create a MariaDB instance
  2. Wait for it to come up (~1 min)
  3. Go back to WHMCS → service page
  4. Click Resources in the sidebar
  5. Show the resource table with workloads and quantities

Key points:

  • Resources appear automatically — no manual tracking
  • Workload names, resource types, and quantities all visible
  • Data comes directly from the Kubernetes billing API

5. View Costs (1 min)

Narration: "The customer can see exactly what their infrastructure costs."

  1. Click Hourly Costs in the sidebar
    • Shows per-resource costs with unit prices
    • Total hourly cost calculated automatically
    • Cost breakdown chart
  2. Click Monthly Costs
    • Accumulated costs for the current month
    • Based on hourly billing data

Key points:

  • Transparent pricing — no surprises
  • Costs calculated from real usage data
  • Hourly granularity, monthly aggregation

6. Cancel Service (1 min)

Narration: "If a customer wants to leave, they can self-service cancel."

  1. On the service page, click Cancel Service
  2. Warning appears with inline confirmation
  3. Type the tenant name to confirm
  4. Service is cancelled, all resources deleted

Key points:

  • Destructive action requires explicit confirmation
  • Tenant and Keycloak user cleaned up automatically
  • No orphaned resources in Kubernetes

Technical Highlights

Feature Implementation
Tenant provisioning K8s Tenant CR via API
User management Keycloak CRD (EDP operator)
Billing Hourly cron → WHMCS Billable Items
Monthly invoicing Automated on 1st of month
Suspend/unsuspend Keycloak user enable/disable
Static analysis PHPStan level 5, 56 unit tests
Deployment One-command deploy via virtctl

Architecture

Customer → WHMCS → Module → K8s API → Cozystack
                         → Keycloak (user provisioning)
                         → Billing API (usage tracking)

All infrastructure managed as code. No manual intervention required for the complete lifecycle: order → provision → use → bill → cancel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment