Skip to main content

v2.3.0: Pingora Engine, Chat Settings, Zero-Config Bootstrap

Β· 5 min read
STOA Team
The STOA Platform Team

Pingora's battle-tested connection engine meets AI-native API management β€” plus zero-config bootstrap, per-tenant chat controls, and real-data demo APIs.

Highlights​

Pingora Connection Engine (ADR-058)​

STOA Gateway now embeds Pingora, Cloudflare's proxy framework handling 1T+ requests/day. Rather than a full migration (55+ pts), we chose the embedded connector approach (13 pts): Pingora's shared connection pool lives inside the existing axum binary behind a pingora feature flag.

  • Shared connection pool β€” designed for 1T+ req/day, replaces per-client reqwest pools at scale
  • Zero architecture change β€” same binary, same routing, same API surface
  • Feature-gated β€” FEATURES=kafka,pingora in production builds (cmake required)
  • Future-proof β€” ProxyPhase trait maps 1:1 to Pingora's ProxyHttp for a potential full migration at v2.0

Marketing claim: "STOA Gateway β€” powered by Pingora's connection engine"

See ADR-058 for the full decision record.

Per-Tenant Chat Settings & Source Tracking​

Admins can now independently control the AI chat assistant in Console and Portal, with per-app usage tracking.

  • Per-tenant toggles β€” enable/disable chat separately for Console and Portal
  • Daily token budget β€” set spending limits per tenant to prevent runaway costs
  • Source tracking β€” every chat message tagged with X-Chat-Source header (console or portal)
  • Usage breakdown β€” GET /v1/chat/usage?group_by=source shows per-app token consumption
  • RBAC enforced β€” only cpi-admin and tenant-admin can modify settings; viewer gets 403
  • 25 E2E scenarios β€” CRUD, RBAC, source header enforcement, cross-app integration

New endpoints:

MethodPathDescription
GET/v1/chat/settingsRead tenant chat configuration
PUT/v1/chat/settingsUpdate chat toggles and budget

Zero-Config Helm Bootstrap​

First-time installations are now fully automated. A single helm install with bootstrap enabled provisions the entire platform:

  • Keycloak realm β€” creates realm with registration enabled
  • 4 RBAC roles β€” cpi-admin, tenant-admin, devops, viewer
  • 3 client scopes β€” stoa:read, stoa:write, stoa:admin
  • 4 OIDC clients β€” Console, Portal, Gateway, API (all pre-configured)
  • Admin user β€” created with cpi-admin role if adminEmail is set
  • Default tenant β€” provisioned via Control Plane API
helm install stoa-platform ./charts/stoa-platform \
--set stoa.bootstrap.enabled=true \
--set stoa.domain=example.com \
--set stoa.adminEmail=admin@example.com

The bootstrap job is idempotent β€” running it twice is safe (409 = already exists = OK).

Shared Secrets Management​

Internal service-to-service keys are now auto-generated and stable across upgrades:

KeyPurpose
gateway-consumer-keyGateway ↔ API authentication
chat-internal-keyChat service internal calls
jwt-signing-keyJWT token signing
anthropic-api-keyAnthropic API (optional)

Keys persist across helm upgrade via Helm lookup function. When Anthropic API key is not provided, chat gracefully disables via CHAT_KILL_SWITCH.

Real-Data Demo APIs​

The developer portal now ships with 5 real public APIs pre-configured for immediate testing:

APIAuthRate LimitUse Case
Exchange Rate APINoneUnlimitedForeign exchange rates (180+ currencies)
CoinGeckoNone30 req/minCryptocurrency prices and market cap
OpenWeatherMapAPI Key1,000/dayReal-time weather data
NewsAPIAPI Key100/dayTop headlines from 80+ sources
Alpha VantageAPI Key5/minStock prices and technical indicators

Plus an echo backend fallback for when external APIs are unreachable β€” demos never break.


Gateway (Rust)​

CapabilityDescription
Pingora EngineEmbedded shared connection pool behind pingora feature flag
OAuth Hairpin FixInternal Keycloak URL for DCR/token proxy β€” fixes 502 on K8s clusters
Deployment Mode Tracingstoa.deployment_mode span attribute for Tempo service graph
Chat Source HeaderX-Chat-Source propagation and enforcement

OAuth Hairpin NAT Fix​

OAuth proxy endpoints (token, DCR, PAR) were using the external Keycloak URL. On K8s clusters with hairpin NAT issues (e.g., OVH MKS), this caused 502 errors at the DCR registration step β€” breaking Claude.ai MCP connections.

Fix: New Config::keycloak_backend_url() prefers STOA_KEYCLOAK_INTERNAL_URL (K8s service DNS) for backend calls while keeping the external URL for browser-facing discovery fields.

Control Plane API (Python/FastAPI)​

CapabilityDescription
Chat SettingsGET/PUT /v1/chat/settings β€” per-tenant toggles + budget
Source TrackingChatSource enum, X-Chat-Source header, group_by=source
API SeedingAlembic migration 074 β€” 5 real APIs + echo fallback
Chat BudgetPer-tenant daily token limits with enforcement

Console & Portal (React/TypeScript)​

  • Chat Settings page β€” toggle chat per-app, set daily budget, save flow
  • Source header injection β€” useChatService hook sends X-Chat-Source on all requests
  • RBAC gates β€” viewer role blocked from settings modification

Helm Chart​

New values:

KeyDefaultDescription
stoa.domainβ€”Base domain for all services
stoa.adminEmailβ€”Admin user email (bootstrap)
stoa.anthropicApiKeyβ€”Anthropic API key (optional, enables chat)
stoa.bootstrap.enabledfalseEnable first-time platform provisioning

Bug Fixes​

  • Portal 502 β€” Corrected API_BACKEND_URL and added DNS_RESOLVER in deployment manifest (#1813)
  • OAuth DCR 502 β€” Gateway now uses internal Keycloak URL for backend proxy calls (#1814)
  • Tempo service graph β€” Deployment mode as span attribute (not resource attribute) for correct extraction (#1811)

Breaking Changes​

None. All changes are backwards compatible.

Upgrade Guide​

# Standard Helm upgrade (no bootstrap)
helm upgrade stoa-platform ./charts/stoa-platform -n stoa-system

# First-time install with bootstrap
helm install stoa-platform ./charts/stoa-platform -n stoa-system \
--set stoa.bootstrap.enabled=true \
--set stoa.domain=yourdomain.com \
--set stoa.adminEmail=admin@yourdomain.com

Gateway Docker images now require cmake at build time (Pingora dependency). Pre-built images from GHCR include this β€” no action needed for standard deployments.

What's Next​

  • eBPF kernel-level HTTP parsing β€” zero-copy request inspection (CAB-1841/1843)
  • UAC policy enforcement at kernel level β€” eBPF-based policy evaluation (CAB-1848)
  • WASM plugin runtime β€” user-defined plugins in WebAssembly (CAB-1644)
  • MCP Federation β€” cross-gateway tool discovery (ADR-046)

See the full roadmap for planned features and milestones.

Resources​