|
@@ -1,99 +1,20 @@
|
|
|
-// PM2 生态系统配置文件
|
|
|
-// 用于管理Delta中性交易策略的进程
|
|
|
-
|
|
|
module.exports = {
|
|
|
apps: [
|
|
|
{
|
|
|
- name: 'delta-neutral-trading',
|
|
|
- script: 'yarn',
|
|
|
- args: 'trade',
|
|
|
- interpreter: 'none',
|
|
|
-
|
|
|
- // 实例配置
|
|
|
+ name: 'pacifica-strategy',
|
|
|
+ script: 'node',
|
|
|
+ args: ['-r', 'tsx', './scripts/run-modular-strategy.ts'],
|
|
|
+ cwd: '/root/pacifica',
|
|
|
instances: 1,
|
|
|
- exec_mode: 'fork',
|
|
|
-
|
|
|
- // 自动重启配置
|
|
|
- autorestart: true, // 自动重启
|
|
|
- watch: false, // 不监视文件变化
|
|
|
- max_restarts: 100, // 最大重启次数
|
|
|
- min_uptime: '10s', // 最小运行时间
|
|
|
- restart_delay: 5000, // 重启延迟(毫秒)
|
|
|
-
|
|
|
- // 内存限制
|
|
|
- max_memory_restart: '2G', // 内存超过2G时重启
|
|
|
-
|
|
|
- // 环境变量
|
|
|
- env: {
|
|
|
- NODE_ENV: 'production',
|
|
|
- NODE_OPTIONS: '--max-old-space-size=2048'
|
|
|
- },
|
|
|
-
|
|
|
- // 日志配置
|
|
|
- log_date_format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
- error_file: 'logs/pm2-error.log',
|
|
|
- out_file: 'logs/pm2-out.log',
|
|
|
- merge_logs: true,
|
|
|
- time: true,
|
|
|
-
|
|
|
- // 进程信号处理
|
|
|
- kill_timeout: 10000, // 关闭超时(毫秒)
|
|
|
- shutdown_with_message: true,
|
|
|
-
|
|
|
- // 监控配置
|
|
|
- monitoring: true,
|
|
|
-
|
|
|
- // 崩溃处理
|
|
|
- exp_backoff_restart_delay: 100, // 指数退避重启延迟
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- name: 'position-monitor',
|
|
|
- script: 'yarn',
|
|
|
- args: 'positions',
|
|
|
- interpreter: 'none',
|
|
|
-
|
|
|
- // 每隔5分钟检查一次仓位
|
|
|
- cron_restart: '*/5 * * * *',
|
|
|
- autorestart: false,
|
|
|
-
|
|
|
- // 日志配置
|
|
|
- log_date_format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
- error_file: 'logs/position-monitor-error.log',
|
|
|
- out_file: 'logs/position-monitor-out.log',
|
|
|
-
|
|
|
- env: {
|
|
|
- NODE_ENV: 'production'
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- name: 'health-check',
|
|
|
- script: './scripts/health-check.js',
|
|
|
-
|
|
|
- // 每隔1分钟检查系统健康状态
|
|
|
- cron_restart: '* * * * *',
|
|
|
- autorestart: false,
|
|
|
-
|
|
|
- // 日志配置
|
|
|
- log_date_format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
- error_file: 'logs/health-check-error.log',
|
|
|
- out_file: 'logs/health-check-out.log',
|
|
|
-
|
|
|
+ autorestart: true,
|
|
|
+ watch: false,
|
|
|
+ max_memory_restart: '500M',
|
|
|
env: {
|
|
|
NODE_ENV: 'production'
|
|
|
- }
|
|
|
- }
|
|
|
- ],
|
|
|
-
|
|
|
- deploy: {
|
|
|
- production: {
|
|
|
- user: 'node',
|
|
|
- host: 'localhost',
|
|
|
- ref: 'origin/master',
|
|
|
- repo: 'http://developer.mtdao.io/Malone/pacifica.git',
|
|
|
- path: '/var/www/pacifica',
|
|
|
- 'post-deploy': 'npm install && pm2 reload ecosystem.config.js --env production'
|
|
|
+ },
|
|
|
+ out_file: '/root/pacifica/logs/pm2-out.log',
|
|
|
+ err_file: '/root/pacifica/logs/pm2-err.log',
|
|
|
+ log_date_format: 'YYYY-MM-DD HH:mm:ss'
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ ]
|
|
|
+};
|