feat(ops): restart individual PM2 children and enrich manage UI

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-20 22:31:34 +07:00
co-authored by Cursor
parent 84f29057df
commit aa3c2a25b2
12 changed files with 658 additions and 237 deletions
+43
View File
@@ -0,0 +1,43 @@
const fs = require("fs");
const path = require("path");
function loadEnv(file) {
const out = {};
if (!fs.existsSync(file)) return out;
for (const line of fs.readFileSync(file, "utf8").split("\n")) {
const t = line.trim();
if (!t || t.startsWith("#")) continue;
const i = t.indexOf("=");
if (i === -1) continue;
const key = t.slice(0, i).trim();
let val = t.slice(i + 1).trim();
if (
(val.startsWith('"') && val.endsWith('"')) ||
(val.startsWith("'") && val.endsWith("'"))
) {
val = val.slice(1, -1);
}
out[key] = val;
}
return out;
}
const root = __dirname;
module.exports = {
apps: [
{
name: "jerapah-flow",
cwd: root,
script: "packages/server/runner.js",
interpreter: "node",
instances: 1,
autorestart: true,
max_restarts: 20,
env: {
NODE_ENV: "production",
...loadEnv(path.join(root, ".env")),
},
},
],
};