Skip to content

feat: Add Brain Server proxy for centralized knowledge base - #25

Merged
dsactivi-2 merged 1 commit into
mainfrom
feat/brain-server-proxy
Jan 1, 2026
Merged

feat: Add Brain Server proxy for centralized knowledge base#25
dsactivi-2 merged 1 commit into
mainfrom
feat/brain-server-proxy

Conversation

@dsactivi-2

Copy link
Copy Markdown
Owner

Summary

  • Add HTTP proxy to centralize all Brain/Knowledge Base data on Brain-Server (49.13.158.176:5001)
  • Cloud-Agents now proxies /api/brain/* requests to the central Brain-Server
  • Fallback to local mode if BRAIN_SERVER_URL env is not set

Changes

  • brain-proxy.ts: New proxy router that maps Cloud-Agents API to Brain-Server API
  • brain/client.ts: HTTP client adapter for Brain-Server
  • index.ts: Conditional proxy mode based on BRAIN_SERVER_URL
  • ecosystem.config.cjs: PM2 config with BRAIN_SERVER_URL
  • start-backend.sh: Wrapper script for PM2 with env vars

Architecture

Cloud-Agents (178.156.178.70:3001)
        │
        │  HTTP Proxy
        ▼
Brain-Server (49.13.158.176:5001)
        │
        ▼
    SQLite DB (centralized)

Test plan

  • Verify /api/brain/proxy/health returns Brain-Server status
  • Test /api/brain/ingest/text creates document on Brain-Server
  • Test /api/brain/search finds documents from Brain-Server
  • Test /api/brain/stats shows correct counts

🤖 Generated with Claude Code

- Add brain-proxy.ts: HTTP proxy to Brain Server (49.13.158.176:5001)
- Add brain/client.ts: BrainClient HTTP adapter
- Update index.ts: Conditional proxy mode via BRAIN_SERVER_URL env
- Update ecosystem.config.cjs: Add BRAIN_SERVER_URL config
- Add start-backend.sh: Wrapper script with env vars for PM2

Architecture:
- Cloud-Agents (178.156.178.70:3001) proxies /api/brain/* to Brain-Server
- Brain-Server (49.13.158.176:5001) stores all knowledge base data centrally
- Fallback to local mode if BRAIN_SERVER_URL not set

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jan 1, 2026

Copy link
Copy Markdown

@sentry review

@dsactivi-2
dsactivi-2 merged commit 0a603e8 into main Jan 1, 2026
9 of 10 checks passed
@dsactivi-2
dsactivi-2 deleted the feat/brain-server-proxy branch January 1, 2026 03:01
dsactivi-2 pushed a commit that referenced this pull request Jan 27, 2026
* Initial plan

* feat: Add in-memory fallback for rate-limiting middleware

- Implement automatic fallback to in-memory rate limiting when Redis is unavailable
- Add comprehensive logging to indicate mode switches (Redis → In-memory)
- Add 14 unit tests for fallback scenarios including:
  - Redis connection failures
  - Missing Redis client
  - Rate limit enforcement with in-memory store
  - Header validation
  - Custom key generators
  - Window expiration
- All rate-limit tests passing (14 passing, 14 skipped requiring real Redis)

Co-authored-by: den-is9186 <257160258+den-is9186@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: den-is9186 <257160258+den-is9186@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant