← back to Animals

ecosystem.config.cjs

79 lines

/**
 * Project: Animals — pm2 master config.
 *
 *   pm2 start ecosystem.config.js && pm2 save
 *
 * Ports:
 *   9720  animals-viewer    public Express app + admin + dog-park WS
 *   9721  animals-ingest    state vet board + AAHA + Petfinder workers (cron-driven HTTP)
 *   9722  animals-audit     site audit + mockup generator (Playwright)
 *   9723  animals-leads     lead-routing + outbound (George gmail)
 *   9725  animal-agent      autonomous nightly builder + cron orchestrator
 *   9726  animal-yolo       Claude CLI feature loop (commits one feature/cycle)
 */
module.exports = {
  apps: [
    {
      name: 'animals-viewer',
      script: 'src/server/index.js',
      cwd: __dirname,
      env: { NODE_ENV: 'production', PORT: 9720,
      BASIC_AUTH: 'admin:DW2024!' },
      max_memory_restart: '1G',
      autorestart: true,
      out_file: 'logs/animals-viewer.out.log',
      error_file: 'logs/animals-viewer.err.log',
    },
    {
      name: 'animals-ingest',
      script: 'src/ingest/server.js',
      cwd: __dirname,
      env: { NODE_ENV: 'production', PORT: 9721 },
      max_memory_restart: '1G',
      autorestart: true,
      out_file: 'logs/animals-ingest.out.log',
      error_file: 'logs/animals-ingest.err.log',
    },
    {
      name: 'animals-audit',
      script: 'src/audit/server.js',
      cwd: __dirname,
      env: { NODE_ENV: 'production', PORT: 9722 },
      max_memory_restart: '2G',
      autorestart: true,
      out_file: 'logs/animals-audit.out.log',
      error_file: 'logs/animals-audit.err.log',
    },
    {
      name: 'animals-leads',
      script: 'src/monetize/leads_server.js',
      cwd: __dirname,
      env: { NODE_ENV: 'production', PORT: 9723 },
      max_memory_restart: '512M',
      autorestart: true,
      out_file: 'logs/animals-leads.out.log',
      error_file: 'logs/animals-leads.err.log',
    },
    {
      name: 'animal-agent',
      script: 'agents/animal-agent/server.js',
      cwd: __dirname,
      env: { NODE_ENV: 'production', PORT: 9725 },
      max_memory_restart: '1G',
      autorestart: true,
      out_file: 'logs/animal-agent.out.log',
      error_file: 'logs/animal-agent.err.log',
    },
    {
      name: 'animal-yolo',
      script: 'agents/animal-yolo/server.js',
      cwd: __dirname,
      env: { NODE_ENV: 'production', PORT: 9726, YOLO_SLEEP_MS: '2400000' },  // 40min cycles
      max_memory_restart: '1G',
      autorestart: true,
      out_file: 'logs/animal-yolo.out.log',
      error_file: 'logs/animal-yolo.err.log',
    },
  ],
};