7.1 KiB
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) |
2.1 quant (125 GiB RAM) Memory, Shared-Memory & Kernel Budget
Enforced via docker-compose.quant.yml + /etc/sysctl.d/99-stockbot.conf (vm.max_map_count = 1048576):
| Component | Engine-Internal Cap | Container mem_limit |
Required OS / Container Settings |
|---|---|---|---|
MongoDB 7.0.21 (stock) |
--wiredTigerCacheSizeGB 16 (8 outside bulk ETL) |
24g |
ulimits.nofile = 1048576 |
QuestDB 10.2.0 |
QDB_RAM_USAGE_LIMIT_BYTES=21474836480 (20 GiB), JVM -Xms2g -Xmx4g |
28g |
ulimits.nofile = 1048576, host vm.max_map_count >= 1048576, bars_1m PARTITION BY MONTH |
PostgreSQL 16.9 (trading_bot) |
shared_buffers=4GB, effective_cache_size=16GB, work_mem=64MB, maintenance_work_mem=1GB |
10g |
shm_size: 2g (prevents 64m /dev/shm parallel hash-join/index errors) |
Dragonfly v1.30.3 |
--maxmemory=4gb --proactor_threads=4 |
5g |
Emulated cluster / hashtag locks |
DuckDB + Workers + web-api |
SET memory_limit='6GB'; SET threads=4; SET temp_directory='/mnt/data/stockbot/tmp/duckdb' per worker |
30g total |
Prevents DuckDB's default 80% host-RAM (~100 GiB) per-worker allocation |
| Monitoring & Admin | Prometheus --storage.tsdb.retention.time=15d |
4g total |
Pinned versions across Prometheus, Loki, Grafana, Admin UIs |
| Linux OS Page Cache | — | ~24 GiB unallocated | Keeps hot SN850X NVMe Parquet & QuestDB mmap pages resident |
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) |
Side-by-Side Local Execution: On the
91 GiBworkstation,docker-compose.dev.yml(stock-bot-dev-*on5433/27018/6380/9100) anddocker-compose.yml(trading-bot-*local QA stack on5432/27017/6379/9000) use non-overlapping ports, networks, and volume namespaces so both stacks run simultaneously without conflict (./scripts/docker.sh start --dev && ./scripts/docker.sh start --qa).
4. Isolation & Resource Rules
- Live/Paper Never Competes with Research:
9900Kruns only execution processes (ib-gateway,ib-bridge, executionorchestrator, local Dragonfly/QuestDB). Heavy DuckDB sweeps, CPCV folds, anddata-pipelinebackfills run exclusively onquant(12900K). - Air-Gapped Holdout Storage: On
quant, the rolling 6-month vault partition (/mnt/data/stockbot/vault/) is readable only by thevault-evaluatorOS/container user, never mounted intomarimo, agent containers, orweb-apiresearch workers. - MongoDB Cache Discipline: Keep MongoDB WiredTiger cache bounded on
quantso OS page cache, DuckDB, PostgreSQL, and QuestDB retain ample headroom across the 125 GiB RAM pool.