Files
x-poster-client/ecosystem.config.js
T
2026-05-11 03:18:19 +00:00

34 lines
1.2 KiB
JavaScript

module.exports = {
apps: [
{
name: 'nestjs-xposter-worker',
script: 'dist/main.js',
// Cấu hình quan trọng
instances: 1, // Chỉ chạy duy nhất 1 bản ghi
exec_mode: 'fork', // Chế độ fork (mặc định cho 1 instance)
cron_restart: '0 * * * *', // Restart mỗi giờ một lần
// Các cấu hình bổ sung nên có
watch: false, // Không watch file ở môi trường prod
autorestart: true, // Tự động restart nếu app bị crash đột ngột
max_memory_restart: '1G', // Restart nếu app ngốn quá 1GB RAM (phòng leak memory)
env: {
NODE_ENV: 'production',
},
},
],
deploy : {
production : {
user : 'SSH_USERNAME',
host : 'SSH_HOSTMACHINE',
ref : 'origin/master',
repo : 'GIT_REPOSITORY',
path : 'DESTINATION_PATH',
'pre-deploy-local': '',
'post-deploy' : 'npm install && pm2 reload ecosystem.config.js --env production',
'pre-setup': ''
}
}
};