Docker Deployment
Docker Deployment
Section titled “Docker Deployment”AgentCTX provides a Docker Compose setup that runs the full platform stack: TypeScript gateway, SurrealDB, NATS messaging, a mock MCP backend, and the Rust HTTP gateway.
Quick Start
Section titled “Quick Start”git clone https://github.com/ryan-haver/agentctx.gitcd agentctxdocker compose up -d --build --waitServices
Section titled “Services”| Service | Image | Port | Purpose |
|---|---|---|---|
| surrealdb | surrealdb/surrealdb:v3 | 8000 | Database (documents, vectors, graph, live queries) |
| surrealdb-init | alpine:3.20 | — | Schema bootstrapping (loads 10 .surql files, then exits) |
| nats | nats:latest | 4222, 8222 | Message bus (JetStream, pub/sub, monitoring) |
| mock-mcp | node:22-alpine | 3200 | Mock MCP backend (echo tool for development/testing) |
| agentctx | Custom (Dockerfile) | 3100 | TypeScript gateway (MCP + SSE + middleware pipeline) |
| ctx-gateway | Custom (Rust) | 8420 | Rust HTTP gateway (LLM traffic interception) |
Health Check
Section titled “Health Check”After starting, verify all services are healthy:
curl http://localhost:3100/health# {"ok": true}Environment Variables
Section titled “Environment Variables”Configure via .env or environment variables:
| Variable | Default | Description |
|---|---|---|
SURREAL_URL | ws://surrealdb:8000 | SurrealDB connection URL |
SURREAL_USER | root | SurrealDB username |
SURREAL_PASS | root | SurrealDB password |
SURREAL_NS | agentctx | SurrealDB namespace |
SURREAL_DB | main | SurrealDB database |
NATS_URL | nats://nats:4222 | NATS connection URL |
NATS_MONITOR_URL | http://nats:8222 | NATS monitoring endpoint |
MOCK_MCP_URL | http://mock-mcp:3200 | Mock MCP backend URL |
NODE_ENV | production | Node.js environment |
USE_RUST_SIDECAR | false | Route translations through Rust native addon |
CTX_GATEWAY_PORT | 8420 | Rust gateway listen port |
ANTHROPIC_API_KEY | — | API key for Anthropic (optional, for LLM plane) |
OPENAI_API_KEY | — | API key for OpenAI (optional, for LLM plane) |
Production Considerations
Section titled “Production Considerations”Persistence
Section titled “Persistence”Add volumes for data persistence:
volumes: surrealdb_data:services: surrealdb: volumes: - surrealdb_data:/dataScaling
Section titled “Scaling”- The gateway is stateless — run multiple instances behind a load balancer
- SurrealDB supports clustering for high availability
- NATS supports clustering and superclusters for federation
Security
Section titled “Security”- Change default SurrealDB credentials
- Enable mTLS between services
- Use 1Password integration for secrets management (
OP_SERVICE_ACCOUNT_TOKEN)
See Also
Section titled “See Also”- Installation — all installation methods
- Configuration — environment variables reference