Ephemeral Zero Trust Demo Infrastructure with GraphPG, Drizzle, and Cloudflare Tunnel
Live telemetry sandboxes usually force an uncomfortable choice between fake browser state that never touches a real query planner and dedicated cloud servers that cost money while idle. Standard staging clusters solve the realism gap by leaving managed databases online all month, which raises fixed hosting overhead and forces manual credential rotation or SSH cleanup when sample data goes stale. At RetroAgile, we wired the sandbox directly to a disposable PostgreSQL 18 and GraphPG 1.3.0 backend defined in code, routed exclusively over Cloudflare Zero Trust Service Tokens, and backed by deterministic Worker fallback when the server is destroyed.

Why ephemeral Workers need an inside-out database path
Browser visitors interacting with /demo should never hold database URLs or origin API keys, and a sandbox VM should never expose PostgreSQL port 5432 or GraphQL endpoints to public internet scanners. Instead, our infra-demo IaC package provisions an UpCloud DEV-1xCPU-1GB-10GB server with default_action = "drop" firewall rules for both IPv4 and IPv6, blocking every inbound socket.
Inside the VM, cloudflared maintains an outbound tunnel to Cloudflare Edge and routes demo-api.retroagile.com to http://127.0.0.1:8081. Cloudflare Access sits in front of that hostname with a nonIdentity policy requiring CF-Access-Client-Id and CF-Access-Client-Secret headers injected only inside RetroAgile's server routes (/api/demo/graphpg and /api/demo/reset).
Co-hosting RetroAgile and Innovi Care on one Postgres instance
Running separate VMs or managed instances for multiple demo portals wastes memory before a visitor opens either page. Because PostgreSQL isolates catalogs and memory pools cleanly across logical databases, one postgres:18-alpine container (320m memory ceiling) hosts both retroagile telemetry tables and innovi_care FHIR R4 tables side by side, each served by its own graphpg 1.3.0 binary (96m ceiling each).
You can read the container memory budgeting breakdown on mihai.ltd and the broader clinical security model in the Innovi Pro zero-trust blueprint. On RetroAgile's side, graphpg.yaml binds the telemetry catalog (repositories, integration_connections, spec_audits, agent_sessions, agent_telemetry_events, and pull_request_lifecycles) plus the volatile mutation resetRetroagileDemo.
Deterministic Drizzle migrations and single-SQL inspection
Rather than configuring snapshots or replication slots on an ephemeral server, both schema creation and clean resets live in Drizzle SQL migrations (packages/db/migrations/0001_demo_reset_rpc.sql):
CREATE OR REPLACE FUNCTION reset_retroagile_demo()
RETURNS jsonb
LANGUAGE plpgsql
VOLATILE
AS $$
DECLARE
v_now timestamptz := clock_timestamp();
BEGIN
TRUNCATE TABLE
agent_telemetry_events, pull_request_lifecycles,
agent_sessions, spec_audits, integration_connections, repositories
RESTART IDENTITY CASCADE;
-- deterministic seed rows follow using v_now intervals
RETURN jsonb_build_object('status', 'reset', 'database', 'retroagile', 'reset_at', v_now);
END;
$$;
PRO Tip #1: Placing the TRUNCATE ... RESTART IDENTITY CASCADE and seed inserts inside one VOLATILE PL/pgSQL function ensures that the Docker boot initializer, the 30-minute host cron script, the local pnpm run db:seed CLI, and the Reset Demo DB button on /demo execute identical SQL logic.
When visitors click Query GraphPG Tunnel on /demo, the server endpoint checks GRAPHPG_URL. When the UpCloud server is provisioned, GraphPG executes the GraphQL selection in a single lateral PostgreSQL 18 statement (mode: "live-vps"). When pulumi destroy or tofu destroy tears down the server between demos, the endpoint automatically degrades to mode: "deterministic-fallback", returning the same seeded dataset, reset_retroagile_demo() JSONB contract, and compiled SQL receipt with zero broken pages. Note that live UpCloud provisioning itself has not been executed yet in this repo so compute spend stays at zero until explicitly brought up.
What else can you build with this setup? Swap in Neon or Fly.io Postgres if you prefer serverless scaling over fixed VPS compute, or wire your own CI preview branches to tear down demo backends nightly while keeping edge docs online. For architectural assessments of agentic developer platforms or database-first APIs, reach out through Innovi Pro.