123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- // PM2 生态系统配置文件
- // 用于管理Delta中性交易策略的进程
- module.exports = {
- apps: [
- {
- name: 'delta-neutral-trading',
- script: 'yarn',
- args: 'trade',
- interpreter: 'none',
- // 实例配置
- 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',
- 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'
- }
- }
- };
|