IBEX Harness
DocsBenchmarksBlogChangelogRoadmap
GitHub
IBEX Harness

Documentation

OverviewConfigurationAuthenticationAuth cachingDirectivesSessionsRate limitingRequest routingProvider adapters
Proxy›Configuration
Proxy

Configuration

Environment variables and config for the proxy service (Phase 2 shipped).

The proxy loads configuration from environment variables at startup via packages/config. There is no config.yaml — missing required values panic with a clear message so misconfiguration surfaces before the first request, not during traffic.

Copy services/proxy/.env.example to services/proxy/.env for local development. The canonical registry is web/engineering/ENVIRONMENT_VARIABLES.md §9–10.

Local dev timeout

Set IBEX_AUTH_VALIDATE_TIMEOUT=2s on developer machines. The production default 50ms is often too tight for Argon2 token verification over loopback; without the override, bearer requests may return 503 SERVICE_DEGRADED.

Required variables

ParameterTypeDescription
IBEX_AUTH_GRPC_ADDRRequiredstring (host:port)
Auth service gRPC target for ValidateToken and ValidateAgent.
Default: 127.0.0.1:9091
REDIS_URLRequiredstring (URL)
Redis for rate limiting, auth-cache revocation subscribe, idempotency, and /ready.

Provider modes

ParameterTypeDescription
IBEX_LLM_MODEenum
`mock` (in-process stub, default) or `live` (OpenAI-compatible forward). Mock is forbidden when IBEX_ENV=production.
Default: mock
OPENAI_API_KEYstring
Required when IBEX_LLM_MODE=live.
OPENAI_BASE_URLstring (URL)
OpenAI-compatible API base.
Default: https://api.openai.com/v1
IBEX_LLM_EXTRA_MODELSstring
Comma-separated extra model ids registered for routing.

Postgres features (directives / sessions)

ParameterTypeDescription
POSTGRES_DSNstring (postgres://…)
Enables directive load and session store. Empty → Noop directive/session behavior.
IBEX_DIRECTIVE_CACHE_TTLduration
Directive Redis cache TTL.
Default: 60s
IBEX_SESSION_CACHE_TTLduration
Session Redis cache TTL.
Default: 60s
IBEX_SESSION_IDLE_TIMEOUTduration
Idle session sweeper threshold.
Default: 45m

Auth cache

ParameterTypeDescription
IBEX_AUTH_CACHE_ENABLEDboolean
Wrap ValidateToken with bloom+LRU when Redis is healthy. Skipped (WARN) if Redis URL empty or Ping fails.
Default: true

See Auth caching.

Idempotency and traces

ParameterTypeDescription
IBEX_IDEMPOTENCY_TTLduration
Redis Idempotency-Key TTL for non-streaming chat.
Default: 24h
CLICKHOUSE_DSNstring
Empty disables async llm_traces writer (fail-open).
CLICKHOUSE_INSERT_BATCH_SIZEinteger
Trace batch size before flush.
Default: 500
CLICKHOUSE_INSERT_FLUSH_MSinteger
Max flush interval in milliseconds.
Default: 200

HTTP and auth tuning

ParameterTypeDescription
IBEX_PORTinteger
HTTP listen port.
Default: 8080
IBEX_AUTH_VALIDATE_TIMEOUTduration
Per-request ValidateToken deadline.
Default: 50ms (2s in .env.example)
IBEX_MAX_REQUEST_BODY_BYTESinteger
Maximum chat completion JSON body size.
Default: 1048576 (1 MiB)
IBEX_SHUTDOWN_TIMEOUTduration
Graceful drain window on SIGTERM.
Default: 30s

Rate limiting

ParameterTypeDescription
IBEX_RATE_LIMIT_DEFAULT_RPMinteger
Requests per minute for orgs without an override.
Default: 60
IBEX_RATE_LIMIT_ORG_OVERRIDESstring
Comma-separated org_uuid=rpm pairs for tenant-specific budgets.

Redis keys follow ratelimit:{org_id}:rpm:{unix_minute} — org_id is always the second segment per Tenant isolation.

Example .env excerpt

services/proxy/.env
IBEX_PORT=8080
IBEX_AUTH_GRPC_ADDR=127.0.0.1:9091
IBEX_AUTH_VALIDATE_TIMEOUT=2s
IBEX_LLM_MODE=mock
REDIS_URL=redis://localhost:6379/0
POSTGRES_DSN=postgres://ibex:ibex@localhost:5432/ibex?sslmode=disable
IBEX_MAX_REQUEST_BODY_BYTES=1048576
IBEX_RATE_LIMIT_DEFAULT_RPM=60
IBEX_LOG_LEVEL=debug

Smoke-test convenience variables (IBEX_DEV_TOKEN, IBEX_DEV_AGENT_ID) are documented in .env.example but are not read by the proxy binary — they exist for make dev-smoke only.

Readiness dependencies

GET /ready reports critical dependency health:

CheckWhen evaluatedFailure impact
auth_grpcAlwaysOrchestrator should not route traffic
redisWhen REDIS_URL is setRate limiter / cache degraded; requests still allowed

Liveness (GET /health) does not probe dependencies — use it for process-up checks only. Details: ADR-0022.

Boot order

1

Infrastructure

make compose-dev-up — Postgres, Redis, optional ClickHouse.

2

Migrations and seed

make db-migrate && make db-seed — org, agent, and dev PAT for smoke tests.

3

Auth first

Start auth on gRPC 9091 before the proxy. See Environment variables.

4

Proxy

go run ./services/proxy/cmd/proxy with env from .env.

Verify configuration

bash
curl -s http://localhost:8080/health | jq
curl -s http://localhost:8080/ready | jq

Expected: /health returns {"status":"ok"}. /ready returns ok when auth gRPC and Redis are reachable.

Related

  • Overview — middleware order and endpoint table
  • Rate limiting — how RPM config maps to Redis
  • Docker Compose — production-like local stack
  • Environment variables — integrator registry

Was this page helpful?

Edit on GitHub

Last updated on

PreviousOverviewNextAuthentication

On this page

  • Required variables
  • Provider modes
  • Postgres features (directives / sessions)
  • Auth cache
  • Idempotency and traces
  • HTTP and auth tuning
  • Rate limiting
  • Example .env excerpt
  • Readiness dependencies
  • Boot order
  • Verify configuration
  • Related
0%