Skip to content
📦 ARCHIVED SNAPSHOT (v1.0) You are viewing historical business logic and documentation for VPS Infrastructure v1.0 (frozen on 2026-11-23, commit b3a7ad3). Switch to Latest →

Cross-Cutting Concerns & Shared Infrastructure

  • Authentication, Sessions, MFA & RBAC:
    • Application Auth: Self-hosted GoTrue (v2.132.3) issues HS256 JWTs (aud: authenticated) signed with JWT_SECRET for email/password, magic link, invite (INVITE_LINK_MODE=token_hash), and Google OAuth. Application-level RBAC/MFA rules are enforced by planovi-backend (RLS/Edge Functions) and planovi-flutter-app, not planovi-vps.
    • Infrastructure/Host RBAC: 4 Linux groups (planovi-admin, planovi-dev, planovi-auditor, sftp-only) provisioned via scripts/planovi-adduser.sh with key-only SSH (passwd -l) and command-restricted scripts/planovi-dev-docker.sh.
    • Machine-to-Machine Auth: GitHub webhooks use HMAC-SHA256 (WEBHOOK_SECRET); Edge Runtime -> PHP microservices use X-Api-Secret (DEALFLOW_API_SECRET / DEALFLOW_API_SECRET_DEV); IoT devices use mTLS via planovi-device-ca.pem (TCP :443 SNI passthrough & MQTT :8883).
    • Network Perimeter Auth: Cloudflare origin-IP verification ($is_cloudflare, 444 drop) on all public HTTPS vhosts + proxy/allowed_ips.conf IP whitelist on Studio, Docs, Converter Admin /, and MQTT :8883.
  • Multi-Tenancy & Data Isolation:
    • planovi-vps enforces Environment Isolation (PROD vs DEV) via separate Docker containers, PostgreSQL volumes (supabase-db-data vs supabase-db-data-dev), Storage volumes, Edge Functions directories, and /opt/vps-apps/*/{prod,dev} folders.
    • Row-level multi-tenancy (company_id RLS) is owned by planovi-backend migrations, not planovi-vps.
  • Branding Rules & i18n (PL/EN):
    • Platform UI (proxy/html/{404,50x,default}.html): Bilingual PL/EN via inline JS dictionary (defaults to pl). Outdated branding: still uses deprecated #090d16 dark navy, #3b82f6 blue, #8b5cf6 purple, #10b981 emerald, Outfit font, and text-based Planovi header instead of canonical #09090B / #32CA42 / Poppins / official SVG logo.
    • GoTrue Auth Email Subjects (docker-compose.yml:215-220,620-625): Hardcoded in Polish ("Planovi – potwierdź adres e-mail", etc.); HTML bodies are fetched from planovi-microservices.
    • Operational Chat Alerts (deployer.py, backup.sh, check-health.sh, docker-prune.sh): Hardcoded in Polish.
  • Global Error Handling, Logging, Timeouts & Security Guards:
    • Docker Logs: Uniform json-file driver (max-size: 20m, max-file: 3) on all 22 services.
    • Nginx Timeouts & Limits: keepalive_timeout 65, client_max_body_size 500M, default proxy_read_timeout 60s (no custom override on /functions/v1/ or /api/v1/).
    • Deployer Safety Guards: Mandatory WEBHOOK_SECRET, HMAC-SHA256 constant-time check, 600s rejection alert rate-limit, _deploy_lock serialization, .public.env secret-regex + service_role JWT blocker, and automatic git reset --hard rollback.