Skip to content

VPS Deployment & Cloudflare CI/CD

The Planovi platform utilizes a dual-deployment pipeline:

  1. Backend Edge Functions: Deployed continuously to the Planovi VPS (191.218.165.149) via secure GitHub Webhooks.
  2. Central & In-Repo Documentation: Deployed continuously via Cloudflare Pages to the documentation subdomain (docs.planovi.pl).

1. Planovi VPS Edge Function Pipeline (191.218.165.149)

sequenceDiagram
    autonumber
    actor Dev as Engineer
    participant GH as "GitHub (PA-IDEAS/planovi-backend)"
    participant Webhook as "VPS Webhook Listener (Port 9000)"
    participant VPS as "Planovi VPS (191.218.165.149)"
    participant Supabase as Production Supabase Edge Runtime

    Dev->>GH: Push commit to `main` branch
    GH->>Webhook: POST /deploy (HMAC SHA-256 signed payload)
    Webhook->>Webhook: Verify GitHub Signature
    Webhook->>VPS: Execute /opt/planovi/scripts/deploy-backend.sh
    VPS->>GH: git pull origin main
    VPS->>VPS: Run verification / smoke tests
    VPS->>Supabase: supabase functions deploy --all
    Supabase-->>VPS: Functions updated and warm
    VPS-->>Webhook: Exit 0 (Success)

Production Environment Variables

Production secrets are managed directly on the VPS within /opt/planovi/supabase/.env.production and injected automatically during supabase functions deploy:

  • SUPABASE_URL
  • SUPABASE_SERVICE_ROLE_KEY
  • GEMINI_API_KEY
  • INCHARGE_USERNAME & INCHARGE_PASSWORD
  • SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS

2. Cloudflare Pages Documentation Pipeline

The interactive Astro Starlight documentation site located in docs/ is configured to build and publish automatically to Cloudflare Pages.

Cloudflare Pages Build Settings:

  • Root Directory: docs
  • Build Command: npm run build
  • Build Output Directory: dist
  • Node.js Version: 18.x or 20.x (configured via NODE_VERSION = 20 environment variable)

Preview Deployments

  • Pull Requests: Every pull request generates a unique preview URL (e.g., https://pr-12.planovi-docs.pages.dev) allowing immediate visual verification of API documentation changes before merging.
  • Production Deployment: Merges to main immediately deploy to the public documentation hub.