# ============================================================================= # rust-brain — Environment Configuration # ============================================================================= # Copy to .env and fill in real values before running. # Placeholder values (<...>) MUST be replaced — services will fail to start otherwise. # ============================================================================= # --- Project --- COMPOSE_PROJECT_NAME=rustbrain # --- Postgres --- POSTGRES_USER=rustbrain POSTGRES_PASSWORD= POSTGRES_DB=rustbrain POSTGRES_PORT=5432 POSTGRES_URL=postgresql://rustbrain:@postgres:5432/rustbrain # --- Apache AGE (POC) --- # Enable AGE graph extension by using the age-poc compose override: # docker compose -f docker-compose.yml -f docker-compose.age-poc.yml up -d postgres # Without the override, AGE is compiled into the image but not activated on startup. # AGE_COMMIT pins the Apache AGE commit in Dockerfile.postgres (default: 8c74fd24 = v1.7.0-pre PG16) AGE_COMMIT=8c74fd24dd91bba54fdf4793fccd0fb7bd2bb9d8 # --- Pgweb --- PGWEB_PORT=8085 # --- Neo4j --- # NEO4J_AUTH is auto-derived from NEO4J_USER/NEO4J_PASSWORD in docker-compose.yml. # Do NOT set NEO4J_AUTH separately — changing it here without updating the # healthcheck and service passwords causes password drift (see RUSA-314). NEO4J_USER=neo4j NEO4J_PASSWORD= NEO4J_HTTP_PORT=7474 NEO4J_BOLT_PORT=7687 NEO4J_URI=bolt://neo4j:7687 # Database name — override for multi-database Neo4j Enterprise setups (default: "neo4j") NEO4J_DATABASE=neo4j # Read-only user for the API service (query_graph endpoint). # Password must match the CREATE USER statement in scripts/init-neo4j.cypher. # On Neo4j Enterprise, grant the reader role to enforce read-only at the DB level. NEO4J_READONLY_USER=rustbrain_readonly NEO4J_READONLY_PASSWORD= # --- Qdrant --- QDRANT_REST_PORT=6333 QDRANT_GRPC_PORT=6334 QDRANT_HOST=http://qdrant:6333 QDRANT_GRPC_HOST=http://qdrant:6334 # Name of the Qdrant collection that stores code embeddings QDRANT_COLLECTION=code_embeddings # Workspace ID used for orphan data that has no workspace mapping during migration. # Used by scripts/migrate-qdrant-workspace.sh to route points with no crate_name→workspace # match into ws_default_ collections. # QDRANT_DEFAULT_WORKSPACE_ID=default # --- Ollama --- OLLAMA_PORT=11434 OLLAMA_HOST=http://ollama:11434 EMBEDDING_MODEL=qwen3-embedding:4b EMBEDDING_DIMENSIONS=2560 CODE_MODEL=codellama:7b # How long Ollama keeps models loaded in memory after the last request (default: 5m). # Increase to avoid cold-start latency on repeated queries. Set to "-1" to keep forever. OLLAMA_KEEP_ALIVE=30m # LRU cache for query embeddings (API service). Reduces Ollama calls for repeated queries. # Set to 0 to disable caching. Only affects the search_semantic / aggregate_search endpoints. EMBEDDING_CACHE_SIZE=10000 # Time-to-live in seconds for cached query embeddings (default: 3600 = 1 hour). # After TTL expires, the next identical query hits Ollama again. EMBEDDING_CACHE_TTL_SECS=3600 # --- Prometheus --- PROMETHEUS_PORT=9090 # --- Grafana --- GRAFANA_PORT=3000 GRAFANA_USER=admin GRAFANA_PASSWORD=rustbrain # --- Node Exporter --- NODE_EXPORTER_PORT=9100 # --- Blackbox Exporter --- BLACKBOX_EXPORTER_PORT=9115 # --- Tool API --- API_PORT=8088 # GitHub personal access token — passed to the API container for git clone # operations when creating workspaces. Required for private repos; optional for # public repos when the API falls back to unauthenticated git clone. # IMPORTANT: Leave unset (commented out or deleted) for public-only repos. # An empty GH_TOKEN= causes workspace creation to fail because the API uses # `gh repo clone` which requires auth, instead of falling back to `git clone`. #GH_TOKEN=ghp_your_token_here # GID of the docker group on the host — used by the API container to access # /var/run/docker.sock for workspace volume operations (docker volume create/rm). # Find your host value with: stat -c %g /var/run/docker.sock # Common values: 999 (Ubuntu), 125 (Debian-based), 998 (Fedora) DOCKER_GID=999 # Override Docker daemon connection for API container (default: unix socket). # Set to a remote daemon URL if using a remote Docker host. # DOCKER_HOST=unix:///var/run/docker.sock # Host-side clone root directory for workspace git clones. # Must match the host path that backs the bind mount so docker run -v works # from inside the API container. WORKSPACE_HOST_CLONE_ROOT=/tmp/rustbrain-clones # Docker image names used by the API when spawning per-workspace containers. # Change only if you build custom images with different tags. INGESTION_IMAGE=rustbrain-ingestion:latest OPENCODE_IMAGE=rustbrain-opencode:latest # Docker network used for inter-container communication. # Must match the network defined in docker-compose.yml. DOCKER_NETWORK=rustbrain_rustbrain-net # Seconds to keep per-workspace execution containers alive after completion. # 0 = remove immediately after the command exits. CONTAINER_KEEP_ALIVE_SECS=0 # Internal MCP SSE URL used by the API container and execution containers to reach the MCP server. # Override only if running MCP on a custom host/port. MCP_SSE_URL=http://mcp-sse:3001/sse # --- Health / Metrics Endpoint (ingestion service) --- # Port for the ingestion service's /health and /metrics endpoint. # Must be different from PROMETHEUS_PORT (default 9090) when running on the same host. HEALTH_PORT=9091 # --- OpenCode Playground --- OPENCODE_PORT=4096 OPENCODE_HOST=http://opencode:4096 OPENCODE_SERVER_PASSWORD= # Absolute host path to the OpenCode config directory containing opencode.json # and .opencode/agents/. Used by the API service to mount config into execution # containers spawned per-workspace. # Example: OPENCODE_CONFIG_HOST_PATH=/home/user/projects/rust-brain/configs/opencode OPENCODE_CONFIG_HOST_PATH= # Optional HTTP basic-auth credentials for the OpenCode service (leave blank to disable) # OPENCODE_AUTH_USER= # OPENCODE_AUTH_PASS= # Public hostname or IP for execution containers (e.g. Tailscale IP). # When set, execution containers publish their port to a random host port, # making them reachable from Tailscale-connected devices at http://:. # Leave empty to use Docker-internal URLs only. # RUSTBRAIN_PUBLIC_HOST=100.x.y.z # --- MCP Server --- MCP_SSE_PORT=3001 # Workspace ID for workspace-scoped API endpoints. # When set, the MCP SSE server passes this as X-Workspace-Id header to all API requests. # Leave empty to use the default workspace. WORKSPACE_ID= # --- Playground UI --- # Port for the playground web frontend PLAYGROUND_UI_PORT=8092 # API base URL the playground frontend uses to reach the Tool API. # Change if the API is accessible on a different host/port from the browser. PLAYGROUND_API_BASE_URL=http://localhost:8088 # --- Audit Service --- # Port for the workspace leak detection job's /health and /metrics endpoints AUDIT_PORT=8090 # Interval between leak detection scans in seconds (default: 600 = 10 min) AUDIT_INTERVAL_SECS=600 # If true, leak detector only reports orphans without removing them (default: true) # Set to "false" to enable automatic cleanup of orphaned Docker resources LEAK_DETECTION_DRY_RUN=true # Auto-delete workspace_audit_log entries older than N days (default: 90) AUDIT_LOG_RETENTION_DAYS=90 # --- LiteLLM (Hosted) --- # LiteLLM is hosted externally - configure connection here # Required for OpenCode AI features. start.sh validates this is set and not the placeholder. # Also passed to execution containers so OpenCode agents can reach the LLM provider. LITELLM_BASE_URL=https://grid.ai.juspay.net LITELLM_API_KEY=your-api-key-here # --- AI Models --- # Required for OpenCode AI features. start.sh validates this is set. ANTHROPIC_API_KEY= OPENAI_API_KEY= CHAT_MODEL=glm-latest # --- Logging --- LOG_LEVEL=info RUST_LOG=info,rustbrain=debug # Log output format: "pretty" (human-readable, default) or "json" (structured, for log aggregators) LOG_FORMAT=pretty # Optional: write logs to a file in addition to stdout # LOG_FILE=/var/log/rustbrain/api.log # --- Ingestion --- # Path to the Rust project to ingest (mounted into ingestion container) INGEST_TARGET_PATH=./target-repo # Memory budget for the ingestion pipeline (default: 32GB to match container limit) # This controls the internal memory allocation across pipeline stages. INGESTION_MEMORY_BUDGET=32GB # --- Target Repo (for Explorer agent filesystem access) --- # Absolute host path to the Rust project that was ingested into rust-brain. # Mounted read-only into the opencode container at /workspace/target-repo # so the Explorer agent can grep/rg/cat source files directly. # # If not set: Explorer uses MCP-only mode (knowledge base queries, still works). # If set: Explorer can also grep across raw source files for deeper analysis. # # Example: TARGET_REPO_PATH=/home/user/projects/hyperswitch TARGET_REPO_PATH= # --- OpenCode Developer Agent Write Workflow --- # The developer agent needs write access to create/modify files. # A git-based workflow clones or copies the target repo to a writable location. # # Optional: Clone from URL instead of copying from TARGET_REPO_PATH # Example: TARGET_REPO_URL=https://github.com/juspay/hyperswitch TARGET_REPO_URL= # # Working directory where the developer agent makes changes # (default: /workspace/target-repo-work inside container) OPENCODE_WORK_DIR=/workspace/target-repo-work # # Git configuration for commits made by the developer agent GIT_USER_NAME=OpenCode Developer GIT_USER_EMAIL=opencode@rustbrain.local # # Prefix for feature branches created by the developer agent FEATURE_BRANCH_PREFIX=opencode # Maximum concurrent embedding requests to Ollama EMBED_BATCH_SIZE=32 # Maximum concurrent Neo4j write transactions NEO4J_BATCH_SIZE=1000 # Batch size for crate processing (reduce for large monorepos) BATCH_SIZE=8 # Parallel jobs for ingestion (use 1 for memory-constrained systems) PARALLEL_JOBS=1 # Maximum body source length to store (in bytes) MAX_BODY_SOURCE_LEN=50000 # Stuck detector threshold in seconds (default 600 = 10 minutes) STUCK_THRESHOLD=600 # --- Timeouts --- # Chat timeout in seconds (default 600 = 10 minutes) CHAT_TIMEOUT=600