PM2 - ecosystem file - (interpreter & fork)
-
ecosystem.config.js
module.exports = { apps: [ // Next.js Web Dashboard { name: 'domain-web-5800', cwd: './web', script: 'npm', args: 'start -- -p 5800', env: { NODE_ENV: 'production', }, instances: 1, autorestart: true, watch: true, exec_mode: 'fork', max_memory_restart: '500M', error_file: '/var/www/domain/web-error.log', out_file: '/var/www/domain/web-out.log', merge_logs: true, time: true, }, // Telegram Bot Service (Express) { name: 'domain-bot-5801', cwd: './bot', script: 'src/index.js', env: { NODE_ENV: 'production', PORT: 5801, }, interpreter: '/root/.nvm/versions/node/v20.20.0/bin/node', instances: 1, autorestart: true, watch: true, exec_mode: 'fork', max_memory_restart: '300M', error_file: '/var/www/domain/bot-error.log', out_file: '/var/www/domain/bot-out.log', merge_logs: true, time: true, }, ], }