Files
sp/docs/phase5-deferred.md
Semih 31040a76b4 feat(phase5): coolify ops + backup status dashboard
- lib/coolify.ts typed client (whitelisted apps)
- /operations: deploy/restart server actions per app, audited
- /operations: backup status cards reading MinIO listings
- lib/minio.ts shared client
- docs/phase5-deferred.md (migration runner + stripe webhook rationale)
2026-05-13 11:22:59 +00:00

2.4 KiB

Phase 5 deferred: migration runner + Stripe webhook

Migration runner

Why deferred: PRD envisions a per-project "Migrate Now" button with log stream — driven by /internal/admin/migrate on each spoke. No spoke currently exposes this endpoint. Building the panel UI for a button that calls nothing is premature.

Trigger to revisit:

  • The first spoke ships /internal/admin/migrate (and ideally /internal/admin/migrate/status).
  • OR migrations on the spokes start being a bottleneck (manual prisma migrate deploy on each host gets annoying).

When triggered, do:

  1. Add migrate() and migrateStatus() to @/lib/admin-sdk/<spoke>.ts.
  2. Add /projects/[key]/migrate page with a Server Action that calls migrate, then long-polls status (or upgrades to SSE if log streaming is needed).
  3. Audit row is automatic (AdminClient already wraps with writeAudit).
  4. Guard: require a manual confirm dialog (typed project key) — destructive on prod.

Stripe central webhook receiver

Why deferred: no spoke currently uses Stripe (sase.tr's payments table exists but isn't wired to Stripe yet — at least the panel can't see Stripe traffic). A central receiver with no events to receive is dead code.

Trigger to revisit:

  • A spoke goes live with Stripe and needs cross-project subscription/MRR rollups.
  • OR a Stripe Connect / multi-account setup arrives and routing per-spoke is needed.

When triggered, do:

  1. Add STRIPE_WEBHOOK_SECRET per spoke + STRIPE_CENTRAL_SIGNING_SECRET for panel.
  2. /api/webhooks/stripe Route Handler: verify Stripe-Signature header (raw body required), normalize event, write to Event model with projectKey derived from account ID.
  3. Re-publish into <key>:events Redis Stream so worker-side consumers see Stripe events alongside spoke-native events (single fan-out path).
  4. Dashboard cards on / start showing MRR / new subs per project.

What Phase 5 actually delivered

  • lib/coolify.ts typed client (listApplications, deploy, restart, recentDeployments) with COOLIFY_API_TOKEN env.
  • /operations page lists panel-managed apps (whitelist via MANAGED_APP_UUIDS), shows status / commit / branch / last deploy, with Deploy + Restart Server Actions (audited).
  • /operations backup status section reads MinIO panel-backups/ + panel-audit-archive/ listings — latest dump age, total size, latest audit archive.
  • Server Actions audited via the existing writeAudit helper.