- Add ecosystem.config.js with auto-restart settings - Add PM2 management scripts to package.json - Create PM2.md documentation - Update .gitignore to exclude logs - Create logs directory for PM2 output Scripts available: - npm run pm2:start - Start with PM2 - npm run pm2:stop - Stop process - npm run pm2:restart - Restart process - npm run pm2:logs - View logs - npm run pm2:status - Check status - npm run pm2:monit - Real-time monitoring
23 lines
568 B
JavaScript
23 lines
568 B
JavaScript
module.exports = {
|
|
apps: [{
|
|
name: 'lpd-gerana-webcam',
|
|
script: './server.js',
|
|
instances: 1,
|
|
exec_mode: 'fork',
|
|
autorestart: true,
|
|
watch: false,
|
|
max_memory_restart: '500M',
|
|
env: {
|
|
NODE_ENV: 'production',
|
|
PORT: 3000
|
|
},
|
|
error_file: './logs/pm2-error.log',
|
|
out_file: './logs/pm2-out.log',
|
|
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
|
|
merge_logs: true,
|
|
min_uptime: '10s',
|
|
max_restarts: 10,
|
|
restart_delay: 4000
|
|
}]
|
|
};
|