本文要點
- 算力租賃平台分三層:計費(FOSSBilling)、業務 API(BFF)、資源開通(Provisioner)——三層必須可獨立升級。
- FOSSBilling擅長訂單、發票、客戶入口、支付適配;不擅長直接驅動 KVM / Mac 裸金屬 / K8s。
- 對比 WHMCS:FOSSBilling 零授權費 + MIT;WHMCS 外掛多但長期授權與定制成本高。
- 支付:國際走 Stripe;國內可接易支付;郵件 Resend/SMTP;安裝可腳本化跳過 Web 精靈。
- 自建站點應調 BFF OpenAPI,不要把 guest login/register 當主路徑。
- 真正分水嶺是開通自動化:支付成功 → 佇列 → 分配算力 → 回寫狀態 → 通知客戶。
- 雲 Mac:計費 SKU 與實體機池、日租/月租策略對齊。
先行結論:先解耦,再選型
平台能不能「自動開通」,不取決於 FOSSBilling 還是 WHMCS,而取決於支付事件有沒有進入可靠的非同步開通流水線。
To validate “someone will pay to rent a Mac”—FOSSBilling products + Stripe + manual provisioning can ship in a week. For 24/7 unattended, auditable inventory, and billable resize, split billing from orchestration. kvmboot runs FOSSBilling for portal and invoices, a BFF at api.<domain>, and DC APIs for allocation.
1. 為什麼算力租賃不能只做「收款頁」
First-time compute rental platform teams often copy Shopify: pretty landing + pay button = done. Compute is time-bounded consumable inventory—one M4 Mac mini cannot be sold twice as exclusive monthly dedicated; GPU VRAM at an instant caps how many inference jobs you accept.
- Manual provisioning: ops watches email, SSH creds sent by hand—scale caps at headcount.
- Billing welded to resources: hypervisor calls inside payment plugins—every FOSSBilling upgrade becomes full regression.
- No service state machine: portal shows “paid” only—no provisioning / active / suspended—ticket storm.
- Split identities: portal account, site signup, anonymous trial IDs never reconcile.
“Build fast” means use mature open billing to cut ~60% boilerplate, focus engineering on inventory and provisioning—the value of FOSSBilling development here, not replacing your DC control plane.
2. FOSSBilling 在平台裡管什麼(What)
FOSSBilling is an open WHMCS/Blesta alternative (PHP + MySQL, MIT). In automated compute rental, keep it on the “commercial contract” layer only:
2.1 Billing layer (FOSSBilling strength)
- Products and pricing: daily / weekly / monthly, tiers (16GB / 24GB / storage add-ons).
- Orders, invoices, coupons, tax display (region-dependent).
- Client portal
portal.<domain>: billing history, tickets, partial service list. - Payment adapters: Stripe, PayPal, custom aggregators.
- Cron: renewal reminders, overdue suspend hooks (must sync with downstream orchestration).
2.2 Business API layer (standalone BFF)
Modern lease sites use custom marketing frontends (i18n, SEO, comparison tables). Do not call FOSSBilling internal APIs from the browser—use a stable BFF (Node/Go) with clear OpenAPI, CDN cache, and unified x-client-ssaid / token auth for anonymous vs registered users.
2.3 Resource layer (Provisioner—you build this)
VM create, bare-metal Mac assign, volume attach, DNS, SSH/VNC delivery—Provisioner listens for paid / expiring / suspended events, calls DC APIs, writes back custom fields or BFF DB. Cloud Mac teams running Agent/CI can share tenant IDs with Runner profiles and tenant quotas.
3. 核心對比:WHMCS vs FOSSBilling vs 全自研
Unified five-column headers—paste into architecture reviews.
| Option | Entry / onboarding | Execution & extension | Context / data sovereignty | Cost | Permission boundary | Best fit |
|---|---|---|---|---|---|---|
| WHMCS | Mature plugin market, hoster templates | Many modules; deep定制 via hooks; upgrade regression | Commercial license; data yours, code not fully open | License + modules, adds up | Ecosystem closed loop; heterogeneous compute needs modules | Traditional IDC, cPanel resale |
| FOSSBilling | Docker-ready; scriptable install wizard | PHP patches + payment adapters; heavy logic in BFF | MIT self-host; auditable schema | Mostly people + cloud, no license | Billing vs provisioning must decouple | Cloud Mac / GPU / vertical compute startups |
| Scratch billing | Perfect fit to requirements | Build invoices, tax, renewals, refunds from zero | Full control | High upfront, often 6–12 months | No legacy, easy to reinvent wheels | Hyperscaler or exotic rules |
| Stripe Billing + light CMS | Fast subscription APIs | No service lifecycle or tickets | Bills on Stripe; service metadata DIY | Fees + integration | Still missing Provisioner + portal | SaaS subs, not machine rental |
For most compute rental platform startups, FOSSBilling is the sweet spot between WHMCS and scratch—ship MVP with payments and manual provisioning fallback in 4–8 weeks instead of 3–6 months on invoices alone.
4. 推薦架構:計費 + BFF + 開通
┌─────────────────────────────────────────────────────────────┐
│ Marketing frontend (static site + JS) │
│ Sign-up / checkout / console → BFF OpenAPI │
└───────────────────────────┬─────────────────────────────────┘
│ HTTPS api.example.com
▼
┌─────────────────────────────────────────────────────────────┐
│ BFF (Node/Go): auth, aggregation, webhook ingress │
│ · x-client-ssaid anonymous / x-client-token registered │
│ · order queries, service list, provisioning status │
└───────┬─────────────────────────────┬───────────────────────┘
│ │
▼ ▼
┌──────────────────┐ ┌─────────────────────────────┐
│ FOSSBilling │ │ Provisioner + queue (Redis) │
│ portal.* billing │ │ · paid → allocate compute │
│ products/orders │ │ · expiry → suspend / reclaim │
│ Stripe / Epay │ │ · write back custom fields │
└────────┬─────────┘ └──────────────┬──────────────┘
│ │
▼ ▼
MySQL + Redis DC API (Mac/KVM/GPU)
Reference deploy (kvmboot-shaped): docker compose for MariaDB, Redis, fossbilling/fossbilling, fossbilling-br BFF, Nginx. Split www (static), api (BFF), portal (admin + client). Run ./init.sh yourdomain.com, ./deploy.sh, ./after-init-patch.sh for unattended install (skip browser /install) and seed products.
Docs: FOSSBilling Docs, Stripe Webhooks. Trigger provisioning via webhook + idempotent queue—never rely on payment return URLs alone.
5. 場景怎麼選
| Who you are | Recommended path | Provisioning | Notes |
|---|---|---|---|
| Indie selling a few Macs | FOSSBilling + Stripe + manual SSH | Email creds after payment | Validate willingness in ~1 week |
| Small cloud Mac / CI team | FOSSBilling + BFF + script Provisioner | Queue bare metal, write back state | Align pricing with enterprise Mac rental TCO |
| GPU inference resale | FOSSBilling usage + external metering | Provisioner → K8s / Slurm | Metering vs billing cycle needs design |
| Classic IDC VPS resale | WHMCS or FOSSBilling | Existing virtualizor modules | WHMCS plugin maturity still leads |
| Large multi-region tenant | Scratch billing + ERP | Unified IAM + mesh | FOSSBilling MVP phase only |
6. 推薦組合(Stack)
MVP (~4 weeks):
init.sh → deploy.sh → after-init-patch.sh (auto FOSSBilling + products)
→ Stripe test mode → frontend via BFF → manual provisioning fallback
Unattended provisioning (8–12 weeks):
FOSSBilling SKU 1:1 with inventory pool
→ Stripe/Epay webhook → Redis queue → Provisioner
→ service active + Resend email + portal SSH/VNC
Cloud Mac + Agent (advanced):
Single tenant ID across FOSSBilling client, BFF, Runner quotas
→ daily PoC → monthly lock (see kvmboot plans)
7. 五個常見誤區
- Mistake 1: “FOSSBilling installed = platform done” — It is billing + clients only; without Provisioner you still run manual hosting.
- Mistake 2: “Put all provisioning in PHP modules” — Upgrade and test hell—provisioning must be async, retriable, observable.
- Mistake 3: “Frontend uses FOSSBilling guest login” — Use BFF OpenAPI login/register; guest endpoints are unstable for production.
- Mistake 4: “Payment return URL = provisioned” — Webhooks are source of truth; queue must be idempotent.
- Mistake 5: “Infinite inventory” — SKUs must map to physical/virtual pools—overselling bare-metal Mac breaks SLA.
8. 7 步落地清單
- Lock SKUs and inventory model:e.g. “M4 16GB daily/monthly”, storage add-ons; state machine pending → active → suspended.
- Bring up FOSSBilling stack:
init.sh <domain>secrets; Resend/SMTP;deploy.shcompose. - Auto install and products:
after-init-patch.sh; verifyportal.<domain>/adminand imported catalog. - Wire payments:Stripe test keys + webhook to BFF; regional Epay PID/KEY in production.
- BFF minimum APIs:Product list, create order, service status;
x-client-ssaidfor anonymous browse. - Provisioner v1:On paid message → assign host → write creds; failures to DLQ for manual fix.
- Acceptance:E2E test SKU → SSH received → portal active → simulate suspend; then production payments.
9. FAQ
How large a compute rental platform can FOSSBilling support?
Hundreds of orders/day and dozens of SKUs—FOSSBilling + BFF is usually enough. Complex multi-tenant tax or 100+ heterogeneous plugins may need WHMCS Enterprise or partial scratch.
Must provisioning live inside FOSSBilling?
No. FOSSBilling owns orders, invoices, clients, payments; VM/SSH/storage belongs in Provisioner or BFF async workers.
Can FOSSBilling rent Mac mini cloud hosts?
Yes—configure products and cycles; Stripe or regional pay; backend DC API assigns bare metal and delivers creds via email/portal.
Biggest FOSSBilling weakness vs WHMCS?
Smaller plugin ecosystem and enterprise support; wins on MIT, self-host, zero license—great for vertical teams with engineers.
Do I need PHP skills?
Not for day-to-day ops; needed for payment adapters, themes, modules. Most innovation should live in BFF/Provisioner (Node/Go/Python)—keep PHP thin.
10. 總結
FOSSBilling tutorials are not about memorizing APIs—they are about boundaries: billing solves contracts and money; provisioning solves time-to-SSH and reliability. FOSSBilling can compress launch from “six months on invoices” to “weeks to first payment”; moat is inventory, SLA, and vertical UX (Xcode / Agent on cloud Mac).
Suggested path: FOSSBilling MVP → BFF frontend → Provisioner automation → then i18n and complex billing. Customers remember how fast they can SSH after paying—not which framework name you picked.
算力租出去之後,交付體驗決定復購
FOSSBilling handles checkout; customers care about SSH to a stable M4 bare-metal for Xcode, CI, or Agents. kvmboot runs the same billing + BFF + auto-provision stack: APAC/US East, daily PoC, dedicated memory bandwidth. Use kvmboot as your backend pool while building your platform—real inventory beats empty test orders.
查看雲 Mac 套餐 · 了解平台能力 · 開通驗收清單