refactor: pre-M0 cleanup, core library hardening, and isolated dev/QA Docker stack
- Remove ~44k LOC of dead code, legacy v1 TS simulator/strategy stack, event-bus, analytics FastAPI prototype, legacy calculation archives, and unused deps (data-ingestion provider API handlers untouched) - Extract @stock-bot/di/http-security and isolate @stock-bot/browser to data-ingestion via ServiceContainerBuilder.withRegistrations() - Harden @stock-bot/mongodb read-only proxies, flatten @stock-bot/postgres with unified master+research migrations, and fix @stock-bot/config EnvLoader, ServiceApplication worker lifecycle, NamespacedCache.clear(), and BatchProcessor error propagation - Flatten workspace root (remove apps/stock/package.json) and collapse orchestrator re-export shims - Pin all Docker image versions, add shm_size/nofile/RAM caps and docker-compose.quant.yml, fix 05-add-visible-column.sql view recreation, and decouple dev/QA Compose project names for side-by-side execution - Update PLATFORM-PLAN, DATA-CONTRACTS (bars_1m PARTITION BY MONTH, Rust bulk ETL, DuckDB limits), MILESTONES, and servers docs
This commit is contained in:
parent
ce9e2df67c
commit
4cd6038063
432 changed files with 1247 additions and 44469 deletions
|
|
@ -1,19 +1,22 @@
|
|||
# Production Infrastructure Template (for dedicated production server deployment)
|
||||
# Production Execution Infrastructure Template (isolated 9900K host — 32 GB RAM)
|
||||
# Provide secrets via a host-managed .env.prod file (never commit production credentials).
|
||||
# Host prerequisite: sysctl vm.max_map_count >= 1048576 (/etc/sysctl.d/99-stockbot.conf)
|
||||
# Usage: docker compose --env-file .env.prod -f docker-compose.prod.yml up -d
|
||||
|
||||
name: stock-bot-prod
|
||||
|
||||
services:
|
||||
dragonfly:
|
||||
image: docker.dragonflydb.io/dragonflydb/dragonfly:latest
|
||||
image: docker.dragonflydb.io/dragonflydb/dragonfly:v1.30.3
|
||||
container_name: stock-bot-prod-dragonfly
|
||||
mem_limit: 3g
|
||||
ports:
|
||||
- '${BIND_HOST:-127.0.0.1}:${DRAGONFLY_PORT:-6379}:6379'
|
||||
command:
|
||||
- dragonfly
|
||||
- --logtostderr
|
||||
- --maxmemory=${DRAGONFLY_MAXMEMORY:-8gb}
|
||||
- --maxmemory=${DRAGONFLY_MAXMEMORY:-2gb}
|
||||
- --proactor_threads=${DRAGONFLY_THREADS:-4}
|
||||
- --requirepass=${DRAGONFLY_PASSWORD:?DRAGONFLY_PASSWORD is required}
|
||||
- --bind=0.0.0.0
|
||||
- --default_lua_flags=allow-undeclared-keys
|
||||
|
|
@ -21,7 +24,7 @@ services:
|
|||
- dragonfly_prod_data:/data
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'redis-cli -a "$DRAGONFLY_PASSWORD" ping']
|
||||
test: ['CMD-SHELL', 'redis-cli -a "$$DRAGONFLY_PASSWORD" ping']
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
|
@ -31,13 +34,25 @@ services:
|
|||
- stock-bot-prod-network
|
||||
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
image: postgres:16.9-alpine
|
||||
container_name: stock-bot-prod-postgres
|
||||
mem_limit: 4g
|
||||
shm_size: 1g
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DATABASE:-trading_bot_prod}
|
||||
POSTGRES_USER: ${POSTGRES_USERNAME:?POSTGRES_USERNAME is required}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
|
||||
POSTGRES_INITDB_ARGS: '--encoding=UTF-8'
|
||||
command:
|
||||
- postgres
|
||||
- -c
|
||||
- shared_buffers=1GB
|
||||
- -c
|
||||
- effective_cache_size=3GB
|
||||
- -c
|
||||
- work_mem=32MB
|
||||
- -c
|
||||
- maintenance_work_mem=256MB
|
||||
ports:
|
||||
- '${BIND_HOST:-127.0.0.1}:${POSTGRES_PORT:-5432}:5432'
|
||||
volumes:
|
||||
|
|
@ -45,7 +60,7 @@ services:
|
|||
- ./database/postgres/init:/docker-entrypoint-initdb.d
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"']
|
||||
test: ['CMD-SHELL', 'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"']
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
|
@ -53,15 +68,20 @@ services:
|
|||
- stock-bot-prod-network
|
||||
|
||||
mongodb:
|
||||
image: mongo:7-jammy
|
||||
image: mongo:7.0.21-jammy
|
||||
container_name: stock-bot-prod-mongodb
|
||||
mem_limit: 6g
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 262144
|
||||
hard: 262144
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: ${MONGODB_USERNAME:?MONGODB_USERNAME is required}
|
||||
MONGO_INITDB_ROOT_PASSWORD: ${MONGODB_PASSWORD:?MONGODB_PASSWORD is required}
|
||||
MONGO_INITDB_DATABASE: ${MONGODB_DATABASE:-stock}
|
||||
ports:
|
||||
- '${BIND_HOST:-127.0.0.1}:${MONGODB_PORT:-27017}:27017'
|
||||
command: --wiredTigerCacheSizeGB ${MONGODB_CACHE_GB:-16}
|
||||
command: --wiredTigerCacheSizeGB ${MONGODB_CACHE_GB:-4}
|
||||
volumes:
|
||||
- mongodb_prod_data:/data/db
|
||||
- ./database/mongodb/init:/docker-entrypoint-initdb.d
|
||||
|
|
@ -75,8 +95,13 @@ services:
|
|||
- stock-bot-prod-network
|
||||
|
||||
questdb:
|
||||
image: questdb/questdb:latest
|
||||
image: questdb/questdb:10.2.0
|
||||
container_name: stock-bot-prod-questdb
|
||||
mem_limit: 8g
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 1048576
|
||||
hard: 1048576
|
||||
ports:
|
||||
- '${BIND_HOST:-127.0.0.1}:${QUESTDB_PORT:-9000}:9000'
|
||||
- '${BIND_HOST:-127.0.0.1}:${QUESTDB_PG_PORT:-8812}:8812'
|
||||
|
|
@ -85,6 +110,14 @@ services:
|
|||
- questdb_prod_data:/var/lib/questdb
|
||||
environment:
|
||||
- QDB_TELEMETRY_ENABLED=false
|
||||
- QDB_RAM_USAGE_LIMIT_BYTES=${QDB_RAM_USAGE_LIMIT_BYTES:-4294967296}
|
||||
- JAVA_OPTS=-Xms1g -Xmx2g
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'curl -fsS http://127.0.0.1:9003/status >/dev/null 2>&1 || exit 1']
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 15s
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- stock-bot-prod-network
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue