← back to Watches

ecosystem.crawler.config.cjs

35 lines

/**
 * PM2 Ecosystem for Omega Museum Slow Crawler
 * Auto-restarts on failure, runs continuously until complete
 */

module.exports = {
  apps: [{
    name: 'omega-museum-crawler',
    script: 'utils/slow-crawler.js',
    args: '60 500', // 60 seconds between requests, 500 max pages
    cwd: '/root/Projects/watches',
    instances: 1,
    autorestart: true,
    watch: false,
    max_memory_restart: '500M',
    env: {
      NODE_ENV: 'production'
    },
    error_file: '/root/Projects/watches/museum/crawl-data/error.log',
    out_file: '/root/Projects/watches/museum/crawl-data/output.log',
    log_date_format: 'YYYY-MM-DD HH:mm:ss',

    // Restart on crash
    min_uptime: '10s',
    max_restarts: 50,
    restart_delay: 5000,

    // Cron job to notify Steve every successful page crawl
    cron_restart: '*/10 * * * *', // Check every 10 minutes

    // Run notification after successful crawl
    post_update: ['node utils/notify-steve-on-crawl.js']
  }]
};