[{"data":1,"prerenderedAt":388},["ShallowReactive",2],{"article-\u002Fblog\u002Fephemeral-demo-infrastructure-graphpg-drizzle-cloudflare":3},{"id":4,"title":5,"author":6,"body":7,"date":366,"description":367,"extension":368,"featured":369,"logId":370,"meta":371,"navigation":375,"path":376,"published":375,"readingTime":377,"sector":378,"seo":379,"stem":380,"tags":381,"__hash__":387},"blog\u002Fblog\u002Fephemeral-demo-infrastructure-graphpg-drizzle-cloudflare.md","Ephemeral Zero Trust Demo Infrastructure with GraphPG, Drizzle, and Cloudflare Tunnel","RetroAgile Systems Architecture",{"type":8,"value":9,"toc":361},"minimark",[10,14,31,39,44,65,99,103,130,174,178,185,292,315,349,357],[11,12,5],"h1",{"id":13},"ephemeral-zero-trust-demo-infrastructure-with-graphpg-drizzle-and-cloudflare-tunnel",[15,16,17,18,23,24,30],"p",{},"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 ",[19,20,22],"a",{"href":21},"\u002Fdemo","RetroAgile",", we wired the sandbox directly to a disposable PostgreSQL 18 and ",[19,25,29],{"href":26,"rel":27},"https:\u002F\u002Fmihailtd.github.io\u002Fgraphpg\u002F",[28],"nofollow","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.",[15,32,33],{},[34,35],"img",{"alt":36,"src":37,"title":38},"Request path from RetroAgile Nuxt Worker on Cloudflare through Cloudflare Access Service Tokens and an outbound Argo Tunnel into GraphPG 1.3.0 and PostgreSQL 18, with deterministic Worker fallback when the VPS is torn down.","\u002Fblog\u002Fdiagrams\u002Fretroagile-demo-tunnel-poster.webp","Live GraphPG execution when the VPS is up, seamless deterministic fallback when torn down.",[40,41,43],"h2",{"id":42},"why-ephemeral-workers-need-an-inside-out-database-path","Why ephemeral Workers need an inside-out database path",[15,45,46,47,50,51,56,57,60,61,64],{},"Browser visitors interacting with ",[48,49,21],"code",{}," 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 ",[19,52,55],{"href":53,"rel":54},"https:\u002F\u002Fgithub.com\u002Fmihailtd\u002Fretroagile\u002Ftree\u002Fmain\u002Fpackages\u002Finfra-demo",[28],"infra-demo IaC package"," provisions an UpCloud ",[48,58,59],{},"DEV-1xCPU-1GB-10GB"," server with ",[48,62,63],{},"default_action = \"drop\""," firewall rules for both IPv4 and IPv6, blocking every inbound socket.",[15,66,67,68,71,72,75,76,79,80,83,84,87,88,91,92,87,95,98],{},"Inside the VM, ",[48,69,70],{},"cloudflared"," maintains an outbound tunnel to Cloudflare Edge and routes ",[48,73,74],{},"demo-api.retroagile.com"," to ",[48,77,78],{},"http:\u002F\u002F127.0.0.1:8081",". Cloudflare Access sits in front of that hostname with a ",[48,81,82],{},"nonIdentity"," policy requiring ",[48,85,86],{},"CF-Access-Client-Id"," and ",[48,89,90],{},"CF-Access-Client-Secret"," headers injected only inside RetroAgile's server routes (",[48,93,94],{},"\u002Fapi\u002Fdemo\u002Fgraphpg",[48,96,97],{},"\u002Fapi\u002Fdemo\u002Freset",").",[40,100,102],{"id":101},"co-hosting-retroagile-and-innovi-care-on-one-postgres-instance","Co-hosting RetroAgile and Innovi Care on one Postgres instance",[15,104,105,106,109,110,113,114,117,118,121,122,125,126,129],{},"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 ",[48,107,108],{},"postgres:18-alpine"," container (",[48,111,112],{},"320m"," memory ceiling) hosts both ",[48,115,116],{},"retroagile"," telemetry tables and ",[48,119,120],{},"innovi_care"," FHIR R4 tables side by side, each served by its own ",[48,123,124],{},"graphpg"," 1.3.0 binary (",[48,127,128],{},"96m"," ceiling each).",[15,131,132,133,138,139,144,145,148,149,152,153,152,156,152,159,152,162,165,166,169,170,173],{},"You can read the container memory budgeting breakdown on ",[19,134,137],{"href":135,"rel":136},"https:\u002F\u002Fmihai.ltd\u002Fblog\u002Frunning-two-graphpg-apis-on-a-3-dollar-vps",[28],"mihai.ltd"," and the broader clinical security model in ",[19,140,143],{"href":141,"rel":142},"https:\u002F\u002Finnovi.pro\u002Fblog\u002Fzero-trust-demo-environments-cloudflare-upcloud-graphpg",[28],"the Innovi Pro zero-trust blueprint",". On RetroAgile's side, ",[48,146,147],{},"graphpg.yaml"," binds the telemetry catalog (",[48,150,151],{},"repositories",", ",[48,154,155],{},"integration_connections",[48,157,158],{},"spec_audits",[48,160,161],{},"agent_sessions",[48,163,164],{},"agent_telemetry_events",", and ",[48,167,168],{},"pull_request_lifecycles",") plus the volatile mutation ",[48,171,172],{},"resetRetroagileDemo",".",[40,175,177],{"id":176},"deterministic-drizzle-migrations-and-single-sql-inspection","Deterministic Drizzle migrations and single-SQL inspection",[15,179,180,181,184],{},"Rather than configuring snapshots or replication slots on an ephemeral server, both schema creation and clean resets live in Drizzle SQL migrations (",[48,182,183],{},"packages\u002Fdb\u002Fmigrations\u002F0001_demo_reset_rpc.sql","):",[186,187,192],"pre",{"className":188,"code":189,"language":190,"meta":191,"style":191},"language-sql shiki shiki-themes github-dark-default","CREATE OR REPLACE FUNCTION reset_retroagile_demo()\nRETURNS jsonb\nLANGUAGE plpgsql\nVOLATILE\nAS $$\nDECLARE\n  v_now timestamptz := clock_timestamp();\nBEGIN\n  TRUNCATE TABLE\n    agent_telemetry_events, pull_request_lifecycles,\n    agent_sessions, spec_audits, integration_connections, repositories\n  RESTART IDENTITY CASCADE;\n  -- deterministic seed rows follow using v_now intervals\n  RETURN jsonb_build_object('status', 'reset', 'database', 'retroagile', 'reset_at', v_now);\nEND;\n$$;\n","sql","",[48,193,194,202,208,214,220,226,232,238,244,250,256,262,268,274,280,286],{"__ignoreMap":191},[195,196,199],"span",{"class":197,"line":198},"line",1,[195,200,201],{},"CREATE OR REPLACE FUNCTION reset_retroagile_demo()\n",[195,203,205],{"class":197,"line":204},2,[195,206,207],{},"RETURNS jsonb\n",[195,209,211],{"class":197,"line":210},3,[195,212,213],{},"LANGUAGE plpgsql\n",[195,215,217],{"class":197,"line":216},4,[195,218,219],{},"VOLATILE\n",[195,221,223],{"class":197,"line":222},5,[195,224,225],{},"AS $$\n",[195,227,229],{"class":197,"line":228},6,[195,230,231],{},"DECLARE\n",[195,233,235],{"class":197,"line":234},7,[195,236,237],{},"  v_now timestamptz := clock_timestamp();\n",[195,239,241],{"class":197,"line":240},8,[195,242,243],{},"BEGIN\n",[195,245,247],{"class":197,"line":246},9,[195,248,249],{},"  TRUNCATE TABLE\n",[195,251,253],{"class":197,"line":252},10,[195,254,255],{},"    agent_telemetry_events, pull_request_lifecycles,\n",[195,257,259],{"class":197,"line":258},11,[195,260,261],{},"    agent_sessions, spec_audits, integration_connections, repositories\n",[195,263,265],{"class":197,"line":264},12,[195,266,267],{},"  RESTART IDENTITY CASCADE;\n",[195,269,271],{"class":197,"line":270},13,[195,272,273],{},"  -- deterministic seed rows follow using v_now intervals\n",[195,275,277],{"class":197,"line":276},14,[195,278,279],{},"  RETURN jsonb_build_object('status', 'reset', 'database', 'retroagile', 'reset_at', v_now);\n",[195,281,283],{"class":197,"line":282},15,[195,284,285],{},"END;\n",[195,287,289],{"class":197,"line":288},16,[195,290,291],{},"$$;\n",[15,293,294,295,298,299,302,303,306,307,311,312,314],{},"PRO Tip #1: Placing the ",[48,296,297],{},"TRUNCATE ... RESTART IDENTITY CASCADE"," and seed inserts inside one ",[48,300,301],{},"VOLATILE"," PL\u002FpgSQL function ensures that the Docker boot initializer, the 30-minute host cron script, the local ",[48,304,305],{},"pnpm run db:seed"," CLI, and the ",[308,309,310],"strong",{},"Reset Demo DB"," button on ",[48,313,21],{}," execute identical SQL logic.",[15,316,317,318,321,322,324,325,328,329,332,333,336,337,340,341,344,345,348],{},"When visitors click ",[308,319,320],{},"Query GraphPG Tunnel"," on ",[48,323,21],{},", the server endpoint checks ",[48,326,327],{},"GRAPHPG_URL",". When the UpCloud server is provisioned, GraphPG executes the GraphQL selection in a single lateral PostgreSQL 18 statement (",[48,330,331],{},"mode: \"live-vps\"","). When ",[48,334,335],{},"pulumi destroy"," or ",[48,338,339],{},"tofu destroy"," tears down the server between demos, the endpoint automatically degrades to ",[48,342,343],{},"mode: \"deterministic-fallback\"",", returning the same seeded dataset, ",[48,346,347],{},"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.",[15,350,351,352,173],{},"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 ",[19,353,356],{"href":354,"rel":355},"https:\u002F\u002Finnovi.pro\u002F#contact",[28],"Innovi Pro",[358,359,360],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":191,"searchDepth":204,"depth":204,"links":362},[363,364,365],{"id":42,"depth":204,"text":43},{"id":101,"depth":204,"text":102},{"id":176,"depth":204,"text":177},"2026-11-14","How RetroAgile pairs Cloudflare Workers with a disposable PostgreSQL 18 and GraphPG 1.3.0 backend on UpCloud using Drizzle SQL reset RPCs and Cloudflare Access Service Tokens.","md",false,"DISPATCH-005",{"type":372,"image":37,"imageFallback":373,"canonical":374},"article","\u002Fblog\u002Fdiagrams\u002Fretroagile-demo-tunnel-poster.png","https:\u002F\u002Fretroagile.com\u002Fblog\u002Fephemeral-demo-infrastructure-graphpg-drizzle-cloudflare",true,"\u002Fblog\u002Fephemeral-demo-infrastructure-graphpg-drizzle-cloudflare","6 min","INFRASTRUCTURE",{"title":5,"description":367},"blog\u002Fephemeral-demo-infrastructure-graphpg-drizzle-cloudflare",[124,382,383,384,385,386],"drizzle orm","cloudflare tunnel","upcloud","postgresql","zero trust","h0ktsn9Jh4x4lLomM9FrdBHG0nHhLNbQMMdq5wRu85I",1794728604149]