first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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': ''
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user