Stripe subscription billing · Docker resource monitoring · Automated email alerts · Live auto-scaling — all built today.
Per-project subscriptions · Checkout sessions · Invoice history · Webhook handling
| Description | Amount | Status | Date |
|---|---|---|---|
| Loading invoices... | |||
Polling every 60s · Prometheus gauges · MongoDB snapshots · Alert thresholds at 70 / 90 / 100%
7 gauges registered per container: container_cpu_raw_percent, container_cpu_plan_percent, container_memory_percent, container_network_in_bytes, container_network_out_bytes, container_block_read_bytes, container_block_write_bytes
Every poll tick saves a ContainerMetricSnapshot document with a 7-day TTL index — powers the REST metrics API and historical graphs.
Memory hits 80% → Stripe billing updated → Docker limits raised → Email sent · 24-hour cooldown
autoScaling=true + autoPayEnabled=true + stripeItemId present + 24hr cooldown clearSubscriptionItem.update() with new priceId + CREATE_PRORATIONS billing behaviourdocker update --memory 2g --cpus 4 <container> — live, no restart neededHTML emails triggered by deployments, resource thresholds, plan upgrades, and invitations
HMAC-SHA256 signature verification · JSON parsing · DB sync · Container lifecycle
// StripeService.java — handleWebhook()
event = Webhook.constructEvent(payload, sigHeader, webhookSecret);
switch (event.getType()) {
case "checkout.session.completed" → {
// activate project subscription in DB
project.setStripeSubscriptionId(subscriptionId);
project.setSubscriptionStatus("active");
project.setStripeItemId(sub.getItems().get(0).getId());
projectRepository.save(project);
}
case "customer.subscription.deleted" → {
// cancel sub, clear DB fields, stop container
project.setSubscriptionStatus("canceled");
deploymentService.stopProjectContainer(project.getId(), userId);
}
}