Files
crypto_monitor/manual_trading_hub/ecosystem.config.cjs
T
dekun 9f67de3677 refactor: 移除 gate_bot,统一为三所架构并更新文档
删除 crypto_monitor_gate_bot 目录,中控与子代理改为 binance/okx/gate 三账户;
文档与 UI 文案「四所」改为「三所」;新增清库前一次性配置备份脚本。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 22:00:08 +08:00

67 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* PM2:中控 hub + 三路子代理 agent(一次启动全部)
*
* 前置:
* cd manual_trading_hub
* source .venv/bin/activate && pip install -r requirements.txt
* cp .env.example .env
*
* 启动(hub + 全部 agent):
* pm2 start ecosystem.config.cjs
* pm2 save && pm2 startup
*
* 仅中控:pm2 start ecosystem.config.cjs --only manual-trading-hub
* 仅某 agentpm2 start ecosystem.config.cjs --only manual-agent-binance
*
* 快捷:bash scripts/pm2_hub.sh start
*/
const path = require("path");
const HUB_DIR = __dirname;
const REPO_ROOT = path.join(HUB_DIR, "..");
const RUN_HUB = path.join(HUB_DIR, "scripts", "run_hub.sh");
const RUN_AGENT = path.join(HUB_DIR, "scripts", "run_agent.sh");
function agentApp(name, exchangeDir, exchange, port) {
return {
name,
cwd: path.join(REPO_ROOT, exchangeDir),
script: RUN_AGENT,
interpreter: "bash",
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: "400M",
restart_delay: 3000,
max_restarts: 15,
merge_logs: true,
env: {
EXCHANGE: exchange,
PORT: String(port),
HOST: "127.0.0.1",
PYTHONPATH: REPO_ROOT,
},
};
}
module.exports = {
apps: [
agentApp("manual-agent-binance", "crypto_monitor_binance", "binance", 15200),
agentApp("manual-agent-okx", "crypto_monitor_okx", "okx", 15201),
agentApp("manual-agent-gate", "crypto_monitor_gate", "gate", 15202),
{
name: "manual-trading-hub",
cwd: HUB_DIR,
script: RUN_HUB,
interpreter: "bash",
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: "512M",
env: {
PYTHONPATH: REPO_ROOT,
},
},
],
};