From e4aeb0d59f793e34e9ddeca165b9b9469cd52503 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 29 Jun 2026 13:04:20 +0000 Subject: [PATCH] pm2: add crash-loop governor and set cwd for linkweb Co-Authored-By: Claude Opus 4.8 --- ecosystem.config.cjs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ecosystem.config.cjs b/ecosystem.config.cjs index cf4094c..0effbf2 100644 --- a/ecosystem.config.cjs +++ b/ecosystem.config.cjs @@ -1,7 +1,18 @@ +// Crash-loop governor: after max_restarts attempts that each fail to stay up +// min_uptime ms, PM2 marks the app `errored` and stops relaunching it, instead +// of restarting forever and pegging the CPU. +const RESTART_POLICY = { + max_restarts: 10, + min_uptime: 10000, + exp_backoff_restart_delay: 200, +}; + module.exports = { apps: [ { name: 'linkweb', + ...RESTART_POLICY, + cwd: __dirname, script: 'server.js', env: { NODE_ENV: 'production',