Files
TurboTrades/ecosystem.config.cjs
iDefineHD 91f01cd1cf
All checks were successful
Build Frontend / Build Frontend (push) Successful in 22s
Use fork mode instead of cluster for PM2
2026-01-11 01:26:59 +00:00

52 lines
1.5 KiB
JavaScript

module.exports = {
apps: [
{
name: "turbotrades-backend",
script: "./index.js",
cwd: "/root/ttbackend",
instances: 1,
exec_mode: "fork",
autorestart: true,
watch: true,
ignore_watch: ["node_modules", "logs", ".git", "frontend"],
watch_options: {
followSymlinks: false,
},
max_memory_restart: "1G",
env: {
NODE_ENV: "production",
},
env_production: {
NODE_ENV: "production",
},
error_file: "/root/ttbackend/logs/pm2-error.log",
out_file: "/root/ttbackend/logs/pm2-out.log",
log_file: "/root/ttbackend/logs/pm2-combined.log",
time: true,
merge_logs: true,
log_date_format: "YYYY-MM-DD HH:mm:ss Z",
min_uptime: "10s",
max_restarts: 10,
restart_delay: 4000,
kill_timeout: 5000,
wait_ready: true,
listen_timeout: 10000,
},
],
deploy: {
production: {
user: "root",
host: "turbotrades.dev",
ref: "origin/main",
repo: "https://git.turbotrades.dev/iDefineHD/TurboTrades.git",
path: "/root/ttbackend",
"post-deploy":
"npm ci --production && cd frontend && npm ci && npm run build && rm -rf /var/www/html/turbotrades/* && cp -r dist/* /var/www/html/turbotrades/ && cd .. && pm2 reload ecosystem.config.js --env production && pm2 save",
"pre-deploy-local": 'echo "Deploying to turbotrades.dev..."',
"post-setup":
"npm install && pm2 start ecosystem.config.js --env production",
},
},
};