Files
chatc2/ecosystem.config.js
T
2026-06-24 14:13:09 +00:00

51 lines
1.2 KiB
JavaScript

/**
* PM2 Ecosystem File — Chatc2
*
* Uso:
* npm install -g pm2 (instalar PM2 globalmente)
* pm2 start ecosystem.config.js
* pm2 save (salvar para auto-início)
* pm2 startup (iniciar com o sistema)
*
* Comandos úteis:
* pm2 status (ver processos)
* pm2 logs chatc2 (ver logs)
* pm2 restart chatc2 (reiniciar)
* pm2 reload chatc2 (reiniciar sem downtime)
* pm2 stop chatc2 (parar)
*/
module.exports = {
apps: [{
name: 'chatc2',
script: 'src/server.js',
cwd: __dirname,
// Cluster: usa todos os CPUs disponíveis
instances: 'max',
exec_mode: 'cluster',
// Reinício automático em caso de crash
autorestart: true,
max_restarts: 10,
restart_delay: 5000,
// Watch desabilitado em produção
watch: false,
// Limites de memória
max_memory_restart: '512M',
// Logs
log_date_format: 'YYYY-MM-DD HH:mm:ss',
error_file: 'logs/pm2-error.log',
out_file: 'logs/pm2-out.log',
merge_logs: true,
// Variáveis de ambiente
env: {
NODE_ENV: 'production',
},
}],
};