← back to Big Red

ecosystem.config.js

25 lines

// Big Red — Steve's AI chat surface. Registered with pm2 as "aichat" so it
// shows up alongside the other managed services and survives reboots once
// `pm2 save` is run.
module.exports = {
  apps: [{
    name: 'aichat',
    cwd: __dirname,
    script: 'server.js',
    env: {
      NODE_ENV: 'production',
      PORT: process.env.PORT || '9936',
      // pm2 strips the interactive PATH, but server.js spawns the `claude` CLI
      // which lives under ~/.local/bin on Mac2 and under /root/.local/bin on
      // Kamatera. Without this, /api/chat fails with spawn claude ENOENT.
      PATH: `${process.env.HOME || '/root'}/.local/bin:/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin`,
    },
    max_memory_restart: '512M',
    out_file: './tmp/aichat.out.log',
    error_file: './tmp/aichat.err.log',
    merge_logs: true,
    autorestart: true,
    watch: false,
  }],
};