stock-bot/docs/servers.md
2026-11-26 22:23:07 -05:00

5.4 KiB
Raw Blame History

Infrastructure & Server Topology

Stock Bot runs across dedicated local-network hardware separating research/data-curation workloads from live/paper broker execution and cold archival storage.


1. Host Inventory

Host Hardware OS & Storage Primary Role
quant (12900K) (10.0.0.51) Intel Core i9-12900K (16C / 24T), 125 GiB RAM Ubuntu 24.04 LTS; OS NVMe + 4 TB WD Black SN850X NVMe mounted at /mnt/data (/home/boki/stockbot → /mnt/data/stockbot, Docker data-root: /mnt/data/docker) Primary QA/Research stack: raw MongoDB corpus, PostgreSQL security master & trial_ledger, curated Hive Parquet + DuckDB store, QuestDB 10.2.0 intraday store, data-pipeline, data-ingestion, orchestrator, web-api, web-app, monitoring
9900K (ITX) Intel Core i9-9900K (8C / 16T), 32 GB RAM, 1 GbE Ubuntu 24.04 LTS, local NVMe Isolated Paper & Live Execution Host (Milestone M5): headless ib-gateway (IBC), Python ib-bridge (ib_async), execution orchestrator + Rust engine, local Dragonfly state, hot rolling bar window. Zero research jobs or agent shell access
TrueNAS (6700K) Intel Core i7-6700K, 32 TB ZFS (6×8 TB), 2.5 GbE TrueNAS SCALE, MinIO (S3-compatible) Cold backups: immutable curated Parquet dataset snapshots, PostgreSQL pg_dump backups, trial_ledger & air-gapped vault archives
Proxmox (8945HS) AMD Ryzen 9 8945HS (8C / 16T) Proxmox VE Network & shared infrastructure: OPNsense, GitLab, Pi-hole
Workstation (local) Developer desktop Linux Interactive code editing, docker-compose.dev.yml isolated dev stack, local marimo notebooks (127.0.0.1:2718), Claude Code & Studio copilot agents

2. quant (10.0.0.51) Service & Port Map

All 16 containers run from /mnt/data/stockbot (docker compose --env-file .env.quant -f docker-compose.yml -f docker-compose.quant.yml):

Category Container / Service Host Port(s) Notes
UI & API web-app (Nginx) 80, 5173 React dashboard & /api reverse proxy to web-api
web-api 2003 Research API, dataset/trial admission, WebSocket updates
orchestrator 2004 Durable research & backtest workers (Rust engine N-API addon)
Data Services data-ingestion 2001 Provider crawlers writing raw collections to MongoDB
data-pipeline 2002 Reads MongoDB strictly via MONGODB_READ_URI (mongoReadOnly: true); writes PostgreSQL master tables + curated Parquet/QuestDB
Databases mongodb (stock) 27017 ~638 GB multi-billion-doc raw corpus (wiredTigerCacheSizeGB bounded). Never drop or write from dev/tests
postgres (trading_bot) 5432 Security master, trial_ledger, backtests, promotions, vault_evaluations
questdb (10.2.0) 9000 (HTTP/UI), 8812 (PGWire), 9009 (ILP) Intraday 1m/5m/1h & hot streaming bars (listing_id SYMBOL CAPACITY 65536 NOCACHE)
dragonfly 6379 BullMQ queues, pub/sub, ephemeral cache
Curated Files /mnt/data/stockbot/curated/ Host NVMe Hive-partitioned Parquet (bars_1d, corporate_actions, fundamentals_pit, earnings_events_pit, short_interest_pit, macro_pit, fx_rates_1d, features/) queried in-process via DuckDB
Ops & Admin grafana 3000 Dashboards (prometheus + loki)
bull-board 3001 BullMQ job queue inspector
loki / prometheus 3100 / 9090 Centralized logs (promtail) & metrics
pgadmin / mongo-express 5050 / 8081 Database admin UIs (LAN-only)

3. Local Development vs quant Separation

Environment Compose File PostgreSQL MongoDB (Write) MongoDB (Read / Pipeline) Dragonfly QuestDB
dev (workstation) docker-compose.dev.yml localhost:5433 (trading_bot_dev) localhost:27018 (stock_dev) quant:27017 or localhost:27017 (stock, read-only via MONGODB_READ_URI) localhost:6380 localhost:9100
qa (quant) docker-compose.yml + docker-compose.quant.yml 10.0.0.51:5432 (trading_bot) 10.0.0.51:27017 (stock) 10.0.0.51:27017 (stock, MONGODB_READ_URI for data-pipeline) 10.0.0.51:6379 10.0.0.51:9000
Paper / Live (9900K) docker-compose.prod.yml (M5) Isolated execution DB None Curated artifact pull only Local :6379 Local :9000 (90d hot window)

Offline Local Snapshot: The workstation's pre-migration Docker containers (trading-bot-*) are intentionally stopped with their local Docker volumes preserved untouched as a cold local fallback.


4. Isolation & Resource Rules

  1. Live/Paper Never Competes with Research: 9900K runs only execution processes (ib-gateway, ib-bridge, execution orchestrator, local Dragonfly/QuestDB). Heavy DuckDB sweeps, CPCV folds, and data-pipeline backfills run exclusively on quant (12900K).
  2. Air-Gapped Holdout Storage: On quant, the rolling 6-month vault partition (/mnt/data/stockbot/vault/) is readable only by the vault-evaluator OS/container user, never mounted into marimo, agent containers, or web-api research workers.
  3. MongoDB Cache Discipline: Keep MongoDB WiredTiger cache bounded on quant so OS page cache, DuckDB, PostgreSQL, and QuestDB retain ample headroom across the 125 GiB RAM pool.