Server Provisioning

When a hosting service is paid for, ProEcommerce creates the account on your server automatically. When the client cancels or gets terminated for non-payment, it tears the account down. All via the server's native API.

Supported control panels

PanelStatusNotes
cPanel / WHMProductionWHM API 1, token auth, full lifecycle
CloudPanelProductionCLI-based provisioning over SSH
PleskPlannedREST API wired, awaiting test servers
DirectAdminPlannedQ3 roadmap

How provisioning works

  1. A service's status transitions to active (typically when its first invoice is paid)
  2. ProEcommerce queues a provision job with all the parameters
  3. The provisioning-runner cron (every 2 minutes) picks up pending jobs
  4. The job calls the control panel's API (WHM, CloudPanel, etc.) with your stored credentials
  5. On success: the service record stores the created username and server ID, a welcome email goes out, and the service is fully live
  6. On failure: the job retries with exponential backoff up to 5 times before alerting the admin

Adding a server

In the admin dashboard: Servers → Add Server. You'll need:

Credential encryption. API tokens and SSH keys are encrypted with AES-256-CBC using a master key stored in AWS Secrets Manager. Even a full database compromise wouldn't expose server credentials in cleartext.

Server groups

Group servers by purpose ("USA East shared", "EU reseller", "Premium SSD") and assign products to groups rather than specific servers. New accounts are distributed across healthy servers in the group using a least-loaded algorithm.

Lifecycle actions

Create

Calls createacct (WHM) or site:add (CloudPanel) with the client's chosen username, domain, and package. Returns the server-side account ID which we store for future reference.

Suspend

Triggered when payment goes past the suspension threshold (default: day 10 overdue). Calls suspendacct — the account is no longer accessible but data is retained intact.

Unsuspend

Fires automatically when a previously-overdue invoice is paid. Calls unsuspendacct. The account comes back online within seconds.

Terminate

Triggered 45 days past-due (configurable). Calls removeacct — data is destroyed on the server. A final backup is pulled to your "recovery" S3 bucket before destruction if you have that policy enabled.

Change package

Upgrades/downgrades call changepackage with the new plan. The server applies new limits (disk, bandwidth, email accounts) immediately and issues a prorated invoice for the difference.

Module development

Need a control panel we don't support yet? Write a provisioning module. Each module extends ProvisioningModule and implements six methods:

abstract class ProvisioningModule {
    abstract public function create(Service $s): Result;
    abstract public function suspend(Service $s): Result;
    abstract public function unsuspend(Service $s): Result;
    abstract public function terminate(Service $s): Result;
    abstract public function changePackage(Service $s, string $newPackage): Result;
    abstract public function testConnection(Server $srv): Result;
}

Drop your implementation in includes/provisioning/ and it becomes selectable in the product editor.