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", }, }, };