Skip to content

Docker Distributed Cluster

The distributed cluster deployment validates RTC Agent’s multi-Worker capabilities — 2 Server containers + Nginx load balancing + full observability stack (Jaeger, Prometheus, Grafana, Loki, etc.).

ServicePortDescription
Nginx28080Load balancer entry point
Server 1 & 2Internal 8888Not directly exposed
PostgreSQL25432With pgvector
Redis26379Worker coordination
Jaeger UI26686Trace visualization
Jaeger OTLP24317gRPC ingestion
Prometheus29090Metrics collection
Grafana23001Dashboards (admin/admin)
Loki23100Log aggregation
Pyroscope24040Continuous profiling
Alertmanager29093Alert routing
Mock OAuth220060Development OAuth2

Port design: All ports do not conflict with the development environment (15432/16379/80), so both can run simultaneously.

终端窗口
cp etc/config.example.yaml etc/config.docker-full.yaml

Edit etc/config.docker-full.yaml:

database:
dsn: "postgres://rtc_agent:rtc_agent@postgres:5432/rtc_agent?sslmode=disable"
auto_migrate: true
redis:
addr: "redis:6379"
tracing:
enabled: true
endpoint: "jaeger:4317"
sample_rate: 1.0
providers:
mock:
enabled: true
url: "http://mock-oauth2:10060"
llm:
provider: "claude"
api_key: "${LLM_API_KEY}" # Injected via env var — set LLM_API_KEY before starting
model: "claude-sonnet-4-20250514"

⚠️ OAuth2 service address: providers.mock.url points to the OAuth2 authorization service. The example 192.168.31.60:20060 is a public IP example from the dev environment. Developers need to deploy their own OAuth2 service (compatible with the mock-oauth2 protocol) and replace this with the actual service address. See Authentication for details.

终端窗口
docker compose -f docker-compose.full.yml up -d

Startup order: PostgreSQL/Redis → migrate (one-time container) → Server-1 & Server-2 → Nginx

终端窗口
# Health check (via Nginx load balancing)
curl http://localhost:28080/healthz
# {"status":"ok"}
# Check container status — all containers should be healthy/running
docker compose -f docker-compose.full.yml ps
# Jaeger trace dashboard
open http://localhost:26686

Both Servers share the same PostgreSQL and Redis. When user requests are distributed across different Servers via Nginx:

  • Session Affinity: Implemented via Redis distributed lock (SET NX), ensuring only one Worker processes a given Session’s work at any time
  • RTC Checkpoint: When the Agent executes a remote tool call, the checkpoint is stored in Redis, allowing any Worker to resume
  • Worker Heartbeat: Each Worker independently registers with Redis, sends heartbeats, and competes for tasks
终端窗口
docker compose -f docker-compose.full.yml down # Stop containers
docker compose -f docker-compose.full.yml down -v # Also delete data volumes