Skip to content

VPS Infrastructure (planovi-vps) β€” Business Logic & Modules

Code-Verified Blueprint: 6 modules β€’ 46 documented BR-* business rules β€’ Zero-orphan file coverage.
Switch between Latest and frozen release snapshots using the Documentation Version dropdown at the top of the left sidebar.

Module Specifications Index

#Module SpecificationRule PrefixRules (BR-*)Open [TEAM_WHY]
1Edge Reverse Proxy, SNI Stream Routing, IP Access Control & Error PagesBR-EDGE123
2Dual-Environment Self-Hosted Supabase Stack (PROD & DEV)BR-SUPA83
3Application Runtimes: PHP 8.3 FPM, Flutter Web & IoT Converter Backends / MQTTBR-APP53
4GitHub Webhook Auto-Deployer & Legacy CI WorkflowBR-DEP103
5Host Provisioning, Kernel Tuning, RBAC User Management, Backups & MaintenanceBR-OPS83
6Local Docs-as-Code Scaffold & Repository HygieneBR-DOC31

Repository Snapshot & Runtime Metadata

  • Repository: PA-IDEAS/planovi-vps
  • Branch & HEAD Commit: main @ b3a7ad3
  • Target Production Host: Hostinger VPS running Ubuntu 24.04 LTS (191.218.165.149, deployment root /opt/vps-stack, application checkouts under /opt/vps-apps)

Primary Stack & Pinned Versions

ComponentRuntime / Base ImagePinned VersionSource File
Edge Reverse Proxynginx:alpineRolling Alpine (latest tag)docker-compose.yml:6
PostgreSQL (PROD & DEV)supabase/postgres15.1.0.147docker-compose.yml:39,441
API Gateway (PROD & DEV)kong2.8.1 (DB-less declarative)docker-compose.yml:63,465
Supabase Studio (PROD & DEV)supabase/studio2026.07.20-sha-74a0848docker-compose.yml:81,483
Edge Functions Runtime (PROD & DEV)supabase/edge-runtimev1.54.3docker-compose.yml:116,518
Postgres Meta (PROD & DEV)supabase/postgres-metav0.68.0docker-compose.yml:157,562
Auth / GoTrue (PROD & DEV)supabase/gotruev2.132.3docker-compose.yml:181,586
Storage API (PROD & DEV)supabase/storage-apiv1.11.0docker-compose.yml:229,634
PostgREST (PROD & DEV)postgrest/postgrestv11.2.0docker-compose.yml:257,662
PHP Microservices & Webpage Runtimephp:8.3-fpm-alpine + Alpine nginxPHP 8.3 FPM (pdo_pgsql, gd, zip, opcache, intl)php-app/Dockerfile:1,13
Flutter Web Static Container (orphaned)nginx:alpineRolling Alpinedocker-compose.yml:296
Webhook Auto-Deployerpython:3.11-alpine + docker-cli, docker-cli-compose, docker-cli-buildx, git, rsync, openssh-clientPython 3.11deployer/Dockerfile:1,5
Converter FastAPI Backends (PROD & DEV)python:3.13-slim (uvicorn cloud.app:app)Python 3.13docker-compose.yml:341,399
MQTT Broker (DEV only)eclipse-mosquitto2docker-compose.yml:370
Local Docs Scaffoldastro / @astrojs/starlight / sharp / typescriptastro ^4.16.1, starlight ^0.28.2, sharp ^0.33.5, typescript ^5.5.4docs/package.json:14-19

What This Repo Owns (and What It Explicitly Does NOT Own)

  • Owns: All Docker Compose orchestration for the Hostinger VPS (docker-compose.yml), including the dual PROD/DEV self-hosted Supabase stacks, PHP 8.3 FPM container, IoT Converter FastAPI + Mosquitto runtime definitions, and the Nginx L4/L7 edge proxy (proxy/).
  • Owns: The GitHub push webhook auto-deployment engine (deployer/deployer.py), including FVM-driven on-demand Flutter builder image creation, browser-safe .public.env injection, Edge Function rsync sync, ARM firmware build invocation, and automatic git reset --hard rollback with Google Chat alerting.
  • Owns: Host-level operational automation: Ubuntu 24.04 initial provisioning (setup-vps.sh), Linux kernel TCP BBR/socket tuning (sysctl-tuning.conf), IP whitelist updates (scripts/update-allowed-ip.sh), PostgreSQL backup/health/prune cron scripts (scripts/backup*.sh, check-health.sh, docker-prune.sh), and SSH/sudo user provisioning (scripts/planovi-adduser.sh, scripts/planovi-dev-docker.sh).
  • Does NOT Own: Application business logic, database SQL migrations, Supabase Edge Function TypeScript code, Flutter UI code, PHP microservice source code, or RP2350 C firmware/FastAPI application code β€” those live in sibling repositories (planovi-flutter-app, planovi-backend, planovi-microservices, planovi-webpage, planovi-converter) and are pulled into /opt/vps-apps/* at deploy time.
  • Does NOT Own: Live production secrets, Cloudflare Origin TLS private keys, Device CA private keys, or the canonical ecosystem documentation portal (PA-IDEAS/planovi-docs is the central documentation hub deployed to Cloudflare Pages dev-docs-arq.pages.dev; docs/ in this repo is a local Starlight copy).

Directory Map

planovi-vps/
β”œβ”€β”€ .github/workflows/ # Legacy GitHub Actions workflow (deploy.yml β€” references non-existent fastapi-app)
β”œβ”€β”€ deployer/ # Webhook auto-deployer HTTP server (Dockerfile, deployer.py)
β”œβ”€β”€ docs/ # Local Astro Starlight docs scaffold (package.json, astro.config.mjs, 14 md/mdx pages)
β”œβ”€β”€ php-app/ # Unified PHP 8.3-FPM + internal Nginx image serving webpage & PHP microservices
β”œβ”€β”€ proxy/ # Edge vps-proxy Nginx config, stream SNI router, Kong declarative config
β”‚ β”œβ”€β”€ conf.d/ # Per-domain vhosts (apps, converters, dev-api, docs, internal-email-templates, supabase)
β”‚ └── html/ # Branded PL/EN static fallback pages (404.html, 50x.html, default.html)
β”œβ”€β”€ scripts/ # Host maintenance, backup, monitoring, IP whitelist, storage migration, SSH RBAC scripts
β”œβ”€β”€ docker-compose.yml # Master 22-service Docker Compose stack (PROD + DEV)
β”œβ”€β”€ setup-vps.sh # Initial Ubuntu 24.04 VPS provisioning script
β”œβ”€β”€ sysctl-tuning.conf # Linux kernel TCP BBR, socket backlog, and VM swap tuning
β”œβ”€β”€ .env.example # Environment variable template (contains live-looking placeholder values β€” see Section 5)
β”œβ”€β”€ supabase_cloud_dump.sql # 0-byte legacy placeholder tracked in Git
└── .gitignore / README.md

Local Development & Testing Commands

No automated unit test suite or linter configuration exists in this repository. Verified operational and validation commands:

  • Validate Docker Compose syntax (requires .env present):
    Terminal window
    cp .env.example .env # Replace all placeholders with environment-specific values
    docker compose config --quiet
  • Validate Nginx config inside running vps-proxy:
    Terminal window
    docker exec vps-proxy nginx -t
  • Validate Python syntax of deployer/deployer.py and scripts/migrate-storage-files.py:
    Terminal window
    python3 -m py_compile deployer/deployer.py scripts/migrate-storage-files.py
  • Validate shell script syntax:
    Terminal window
    bash -n setup-vps.sh scripts/*.sh
  • Start / rebuild stack on VPS (/opt/vps-stack):
    Terminal window
    docker compose up -d --build
  • Run local Docs-as-Code preview (docs/):
    Terminal window
    cd docs && npm ci && npm run dev
    npm run build

Environment Variables & Config Keys (KEY NAMES ONLY)

Key NameWhere Read (file)Required?Purpose
POSTGRES_PASSWORDdocker-compose.yml, scripts/backup.sh, scripts/backup_databases.shYesShared PostgreSQL password for both PROD (supabase-db) and DEV (supabase-db-dev) DBs, PostgREST, GoTrue, Storage, pg-meta, Edge Runtime, Converter FastAPI
JWT_SECRETdocker-compose.ymlYesShared HS256 JWT signing secret for PROD & DEV GoTrue, PostgREST, Storage, and Edge Runtime
SUPABASE_ANON_KEYdocker-compose.ymlYesPublic anon role JWT injected into PROD & DEV Studio, Storage, Edge Runtime
SUPABASE_SERVICE_ROLE_KEYdocker-compose.ymlYesPrivileged service_role JWT injected into PROD & DEV Studio, Storage, Edge Runtime (also mapped to ENERGY_SUPABASE_SERVICE_ROLE_KEY)
SITE_URLdocker-compose.yml:194YesBase redirect URL for PROD GoTrue (GOTRUE_SITE_URL)
SITE_URL_DEVdocker-compose.yml:599No (default https://dev-panel.planovi.app)Base redirect URL for DEV GoTrue (GOTRUE_SITE_URL)
API_EXTERNAL_URLdocker-compose.yml:196-197YesExternal Auth URL for PROD GoTrue (https://api.planovi.app/auth/v1)
GOOGLE_CLIENT_IDdocker-compose.yml:149,222,554,627YesPROD Google OAuth Client ID (also fallback for DEV)
GOOGLE_CLIENT_SECRETdocker-compose.yml:150,223,555,628YesPROD Google OAuth Client Secret (also fallback for DEV)
GOOGLE_CLIENT_ID_DEVdocker-compose.yml:554,627No (falls back to GOOGLE_CLIENT_ID)Separate DEV Google OAuth Client ID for supabase-auth-dev & supabase-edge-runtime-dev
GOOGLE_CLIENT_SECRET_DEVdocker-compose.yml:555,628No (falls back to GOOGLE_CLIENT_SECRET)Separate DEV Google OAuth Client Secret
RESEND_API_KEYdocker-compose.yml:139,205,541,610YesSMTP password (smtp.resend.com:587) for GoTrue and API key for Resend transactional emails in Edge Functions
SMTP_ADMIN_EMAILdocker-compose.yml:206,611YesSender address for GoTrue auth emails
FROM_EMAILdocker-compose.yml:140,542Yes (missing from .env.example)Sender address for Edge Function emails
UNSUBSCRIBE_BASE_URLdocker-compose.yml:143,545Yes (missing from .env.example)Base URL for email unsubscribe links in Edge Functions
PORTAL_URLdocker-compose.yml:144,546Yes (missing from .env.example)Portal base URL used by Edge Functions
GEMINI_API_KEYdocker-compose.yml:131,533YesGoogle Gemini API key for AI Edge Functions (jarvis, ai-energy-balancer, OCR)
DEALFLOW_BASE_URLdocker-compose.yml:132,534YesBase API URL for PHP Dealflow microservice (shared by PROD & DEV compose blocks)
DEALFLOW_API_SECRETdocker-compose.yml:133,535YesShared secret for PROD form-writer.php / Dealflow API (fallback for DEV)
DEALFLOW_API_SECRET_DEVdocker-compose.yml:535No (falls back to DEALFLOW_API_SECRET)Separate DEV secret matching /opt/vps-apps/microservices/dev/.env
SCHEDULER_BASE_URLdocker-compose.yml:134,536YesBase API URL for PHP Scheduler microservice
SCHEDULER_API_SECRETdocker-compose.yml:135,537YesShared secret for PROD Scheduler API (fallback for DEV)
SCHEDULER_API_SECRET_DEVdocker-compose.yml:537No (falls back to SCHEDULER_API_SECRET)Separate DEV secret matching /opt/vps-apps/microservices/dev/.env
INCHARGE_API_TOKENdocker-compose.yml:136,538YesExternal API token for InCharge integration
STRIPE_SECRET_KEYdocker-compose.yml:146,548Yes (missing from .env.example)Stripe API secret key for billing Edge Functions
STRIPE_WEBHOOK_SECRETdocker-compose.yml:147,549Yes (missing from .env.example)Stripe webhook signing secret for subscription events
STRIPE_INQUIRY_WEBHOOK_SECRETdocker-compose.yml:148,550Yes (missing from .env.example)Stripe webhook signing secret for inquiry checkout events
SIGNING_SECRET_DEVdocker-compose.yml:553Yes for DEV (missing from .env.example and PROD)Signing secret passed as SIGNING_SECRET to supabase-edge-runtime-dev
WEBHOOK_SECRETdocker-compose.yml:324, deployer/deployer.py:18Yes (fatal if empty)GitHub HMAC-SHA256 webhook verification secret
DEPLOYER_PORTdeployer/deployer.py:16No (default 9000)HTTP listen port inside vps-deployer
GOOGLE_CHAT_WEBHOOK_URLdocker-compose.yml:325, deployer/deployer.py:19, scripts/backup.sh:22, scripts/check-health.sh:17, scripts/docker-prune.sh:10Optional in deployer; hardcoded fallback in backup.sh/check-health.shGoogle Chat space webhook for deploy, backup, health, and prune alerts
ASLANDI_EDGE_SHARED_TOKENdocker-compose.yml:417No (hardcoded fallback in compose)Shared token for converters-api-dev edge integration
ASLANDI_CARD_MASTER_KEY_B64docker-compose.yml:418Yes for converters-api-dev (missing from .env.example)Base64 master encryption key for SD card crypto in converters-api-dev
GITHUB_TOKEN, VPS_HOST, VPS_SSH_PRIVATE_KEY.github/workflows/deploy.yml:24,50,52,55Yes (GitHub Actions Secrets)Used by legacy CI workflow to push to GHCR and SSH into VPS


Complete File Coverage Matrix (Zero-Orphan Inventory)

Every tracked file in git ls-files (54 files total) and every service in docker-compose.yml (22 services total) is mapped below with zero orphans.

#Module NameRule PrefixAssigned Tracked Files & Services (100% Coverage)
2.1Edge Reverse Proxy, SNI Stream Routing, IP Access Control & Error PagesBR-EDGE-*proxy/nginx.conf, proxy/allowed_ips.conf, proxy/conf.d/apps.conf, proxy/conf.d/converters.conf, proxy/conf.d/dev-api.conf, proxy/conf.d/docs.conf, proxy/conf.d/internal-email-templates.conf, proxy/conf.d/supabase.conf, proxy/html/404.html, proxy/html/50x.html, proxy/html/default.html, scripts/update-allowed-ip.sh, docker-compose.yml (proxy service)
2.2Dual-Environment Self-Hosted Supabase Stack (PROD & DEV)BR-SUPA-*docker-compose.yml (supabase-db, supabase-kong, supabase-studio, supabase-edge-runtime, supabase-pg-meta, supabase-auth, supabase-storage, supabase-postgrest, supabase-db-dev, supabase-kong-dev, supabase-studio-dev, supabase-edge-runtime-dev, supabase-pg-meta-dev, supabase-auth-dev, supabase-storage-dev, supabase-postgrest-dev, networks, volumes), proxy/kong.yml, .env.example, scripts/migrate-storage-files.py, supabase_cloud_dump.sql
2.3Application Runtimes (PHP 8.3 FPM, Flutter Web & IoT Converter Backends / MQTT)BR-APP-*php-app/Dockerfile, php-app/nginx-php.conf, docker-compose.yml (php-app, flutter-web, converters-api-prod, converters-api-dev, mosquitto-dev)
2.4GitHub Webhook Auto-Deployer & Legacy CI WorkflowBR-DEP-*deployer/Dockerfile, deployer/deployer.py, docker-compose.yml (vps-deployer), .github/workflows/deploy.yml
2.5Host Provisioning, Kernel Tuning, RBAC User Management, Backups & MaintenanceBR-OPS-*setup-vps.sh, sysctl-tuning.conf, scripts/planovi-adduser.sh, scripts/planovi-dev-docker.sh, scripts/backup.sh, scripts/backup_databases.sh, scripts/check-health.sh, scripts/docker-prune.sh
2.6Local Docs-as-Code Scaffold & Repository HygieneBR-DOC-*.gitignore, README.md, docs/astro.config.mjs, docs/package.json, docs/package-lock.json, docs/tsconfig.json, docs/public/favicon.svg, docs/src/env.d.ts, docs/src/content/config.ts, docs/src/components/SiteTitle.astro, docs/src/content/docs/index.mdx, docs/src/content/docs/architecture/overview.md, docs/src/content/docs/architecture/security-and-ssl.md, docs/src/content/docs/architecture/storage-and-volumes.md, docs/src/content/docs/developer-guide/configuration-and-secrets.md, docs/src/content/docs/developer-guide/deployment-workflows.md, docs/src/content/docs/developer-guide/provisioning.md, docs/src/content/docs/operations/backups-and-recovery.md, docs/src/content/docs/operations/monitoring-and-health.md, docs/src/content/docs/services/application-runtimes.md, docs/src/content/docs/services/deployer-service.md, docs/src/content/docs/services/nginx-and-vhosts.md, docs/src/content/docs/services/supabase-stack.md, docs/src/content/docs/support/troubleshooting.md