Skip to content

Commit 9e34094

Browse files
SamoraDCclaude
andcommitted
fix: remove supervisor env vars and Python from entrypoint
- Remove environment directive from supervisord.conf (Rust reads env directly) - Remove Python database init from entrypoint.sh (image has no Python) - Add missing env vars to render.yaml (INITIAL_BALANCE, IMBALANCE_THRESHOLD, etc.) - Remove dashboard service (strategy/Dockerfile.api doesn't exist) - Add ONNX model verification to entrypoint Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e57a238 commit 9e34094

3 files changed

Lines changed: 46 additions & 33 deletions

File tree

deploy/entrypoint.sh

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
#!/bin/bash
22
set -e
33

4-
# QuantumFlow HFT Paper Trading - Entrypoint Script
4+
# ORPFlow HFT Paper Trading - Entrypoint Script
55
# Initializes the environment and starts all services
6+
# Note: No Python in runtime - Rust binary handles everything
67

78
echo "========================================"
8-
echo "QuantumFlow HFT Paper Trading System"
9+
echo "ORPFlow HFT Paper Trading System"
910
echo "========================================"
1011
echo ""
1112

1213
# Create necessary directories
1314
mkdir -p /var/log/supervisor
1415
mkdir -p /data
1516

16-
# Initialize database if it doesn't exist
17-
if [ ! -f /data/trades.db ]; then
18-
echo "Initializing SQLite database..."
19-
python -c "
20-
from strategy.src.storage.database import init_database
21-
init_database('/data/trades.db')
22-
print('Database initialized successfully')
23-
"
24-
fi
25-
2617
# Display configuration
2718
echo "Configuration:"
2819
echo " Symbols: ${SYMBOLS:-BTCUSDT,ETHUSDT}"
2920
echo " Timezone: ${TIMEZONE:-America/Sao_Paulo}"
3021
echo " Max Position: ${RISK_MAX_POSITION:-1.0}"
3122
echo " Max Drawdown: ${RISK_MAX_DRAWDOWN:-0.05}"
23+
echo " Initial Balance: ${INITIAL_BALANCE:-10000}"
24+
echo " ML Enabled: ${ML_ENABLED:-true}"
25+
echo " ONNX Model Dir: ${ONNX_MODEL_DIR:-/app/models/onnx}"
3226
echo ""
3327

3428
# Check Binance connectivity
@@ -40,6 +34,16 @@ else
4034
fi
4135
echo ""
4236

37+
# Verify ONNX models exist
38+
echo "Checking ONNX models..."
39+
if [ -d "${ONNX_MODEL_DIR:-/app/models/onnx}" ]; then
40+
MODEL_COUNT=$(find "${ONNX_MODEL_DIR:-/app/models/onnx}" -name "*.onnx" 2>/dev/null | wc -l)
41+
echo " ONNX models found: $MODEL_COUNT"
42+
else
43+
echo " ONNX models: WARNING - Directory not found"
44+
fi
45+
echo ""
46+
4347
echo "Starting services..."
4448
echo ""
4549

deploy/supervisord.conf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ childlogdir=/var/log/supervisor
99
# Market Data + Strategy Engine (Unified Rust Binary)
1010
# Jane Street Style: Single binary, no Python in hot path
1111
# Handles: WebSocket, Order Book, Strategy, Paper Trading, REST API (port 8000)
12+
#
13+
# Note: Rust binary reads environment variables directly from the system,
14+
# no need to pass them via supervisor's environment directive.
1215
# ============================================================================
1316
[program:market-data]
1417
command=/app/bin/market-data
@@ -17,8 +20,9 @@ autostart=true
1720
autorestart=true
1821
stderr_logfile=/var/log/supervisor/market-data.err.log
1922
stdout_logfile=/var/log/supervisor/market-data.out.log
20-
environment=RUST_LOG="%(ENV_RUST_LOG)s",SYMBOLS="%(ENV_SYMBOLS)s",IPC_SOCKET_PATH="%(ENV_IPC_SOCKET_PATH)s",INITIAL_BALANCE="%(ENV_INITIAL_BALANCE)s",IMBALANCE_THRESHOLD="%(ENV_IMBALANCE_THRESHOLD)s",DATABASE_PATH="%(ENV_DATABASE_PATH)s"
2123
priority=100
24+
startsecs=5
25+
startretries=3
2226

2327
# ============================================================================
2428
# OCaml Risk Gateway
@@ -31,7 +35,6 @@ autostart=true
3135
autorestart=true
3236
stderr_logfile=/var/log/supervisor/risk-gateway.err.log
3337
stdout_logfile=/var/log/supervisor/risk-gateway.out.log
34-
environment=IPC_SOCKET_PATH="%(ENV_IPC_SOCKET_PATH)s"
3538
priority=200
3639
startsecs=5
3740
startretries=3

render.yaml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,50 @@ services:
1414

1515
# Environment Variables
1616
envVars:
17+
# Logging
1718
- key: RUST_LOG
1819
value: info
20+
21+
# Trading Configuration
1922
- key: SYMBOLS
2023
value: BTCUSDT,ETHUSDT
24+
- key: INITIAL_BALANCE
25+
value: "10000"
26+
- key: IMBALANCE_THRESHOLD
27+
value: "0.3"
28+
- key: MIN_CONFIDENCE
29+
value: "0.6"
30+
- key: POSITION_SIZE_PCT
31+
value: "0.1"
32+
33+
# Database
2134
- key: DATABASE_URL
2235
value: sqlite:///data/trades.db
23-
- key: TIMEZONE
24-
value: America/Sao_Paulo
36+
37+
# IPC
2538
- key: IPC_SOCKET_PATH
2639
value: /tmp/orp-flow.sock
40+
41+
# Risk Management
2742
- key: RISK_MAX_POSITION
2843
value: "1.0"
2944
- key: RISK_MAX_DRAWDOWN
3045
value: "0.05"
46+
- key: MAX_DAILY_TRADES
47+
value: "50"
48+
49+
# General
50+
- key: TIMEZONE
51+
value: America/Sao_Paulo
3152
- key: PAPER_TRADING
3253
value: "true"
54+
3355
# ONNX ML Inference Configuration
3456
- key: ONNX_MODEL_DIR
3557
value: /app/models/onnx
3658
- key: ML_ENABLED
3759
value: "true"
60+
3861
# Telegram notifications (optional - set in dashboard)
3962
- key: TELEGRAM_BOT_TOKEN
4063
sync: false # Must be set manually in dashboard
@@ -47,22 +70,5 @@ services:
4770
mountPath: /data
4871
sizeGB: 1
4972

50-
# Web Dashboard & API (optional - can use free tier)
51-
- type: web
52-
name: orp-flow-dashboard
53-
runtime: docker
54-
dockerfilePath: ./strategy/Dockerfile.api
55-
dockerContext: ./strategy
56-
region: oregon
57-
plan: free # Will spin down after 15min inactivity (OK for dashboard)
58-
59-
envVars:
60-
- key: DATABASE_URL
61-
value: sqlite:///data/trades.db
62-
- key: PORT
63-
value: "8000"
64-
65-
healthCheckPath: /health
66-
6773
# Auto-deploy on push to main
6874
autoDeploy: true

0 commit comments

Comments
 (0)