@evoapi/evo-nexus 0.18.5 → 0.18.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.mjs +46 -7
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -222,18 +222,45 @@ async function main() {
|
|
|
222
222
|
console.log(` ${YELLOW}!${RESET} Frontend build failed — run: cd dashboard/frontend && npm run build`);
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
// Restart services if start-services.sh
|
|
225
|
+
// Restart services — prefer systemd if available, fallback to start-services.sh
|
|
226
|
+
const hasSystemd = check("systemctl is-active --quiet evo-nexus 2>/dev/null") ||
|
|
227
|
+
check("systemctl is-enabled --quiet evo-nexus 2>/dev/null");
|
|
226
228
|
const startScript = resolve(targetPath, "start-services.sh");
|
|
227
|
-
|
|
229
|
+
|
|
230
|
+
if (hasSystemd) {
|
|
231
|
+
console.log(`\n ${DIM}Restarting via systemd...${RESET}`);
|
|
232
|
+
// If install dir differs from service dir, sync files
|
|
233
|
+
try {
|
|
234
|
+
const serviceDir = execSync("systemctl show evo-nexus -p WorkingDirectory --value 2>/dev/null", { encoding: "utf-8" }).trim();
|
|
235
|
+
if (serviceDir && resolve(serviceDir) !== resolve(targetPath)) {
|
|
236
|
+
console.log(` ${DIM}Syncing to service directory ${serviceDir}...${RESET}`);
|
|
237
|
+
run(`rsync -a --delete --exclude='.venv' --exclude='node_modules' --exclude='logs' --exclude='dashboard/data' "${targetPath}/" "${serviceDir}/"`, { cwd: targetPath });
|
|
238
|
+
// Rebuild in service dir
|
|
239
|
+
const svcFrontend = resolve(serviceDir, "dashboard", "frontend");
|
|
240
|
+
if (existsSync(resolve(svcFrontend, "package.json"))) {
|
|
241
|
+
run("npm install --silent && npm run build --silent", { cwd: svcFrontend });
|
|
242
|
+
}
|
|
243
|
+
// Fix ownership
|
|
244
|
+
const serviceUser = execSync("systemctl show evo-nexus -p User --value 2>/dev/null", { encoding: "utf-8" }).trim();
|
|
245
|
+
if (serviceUser) {
|
|
246
|
+
run(`chown -R ${serviceUser}:${serviceUser} "${serviceDir}"`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
} catch {}
|
|
250
|
+
run("systemctl restart evo-nexus");
|
|
251
|
+
} else if (existsSync(startScript)) {
|
|
228
252
|
console.log(`\n ${DIM}Restarting services...${RESET}`);
|
|
229
253
|
run(`bash ${startScript}`, { cwd: targetPath });
|
|
230
|
-
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Wait and verify
|
|
257
|
+
if (hasSystemd || existsSync(startScript)) {
|
|
231
258
|
await new Promise(r => setTimeout(r, 3000));
|
|
232
259
|
try {
|
|
233
260
|
execSync("curl -sf http://localhost:8080/api/version", { timeout: 5000 });
|
|
234
261
|
console.log(` ${GREEN}✓${RESET} Dashboard restarted`);
|
|
235
262
|
} catch {
|
|
236
|
-
console.log(` ${YELLOW}!${RESET} Dashboard may not have started — check
|
|
263
|
+
console.log(` ${YELLOW}!${RESET} Dashboard may not have started — check: journalctl -u evo-nexus -n 20`);
|
|
237
264
|
}
|
|
238
265
|
}
|
|
239
266
|
|
|
@@ -274,15 +301,27 @@ async function main() {
|
|
|
274
301
|
`);
|
|
275
302
|
|
|
276
303
|
if (isRemote) {
|
|
277
|
-
// Remote mode: services already running
|
|
278
|
-
|
|
304
|
+
// Remote mode: services already running via systemd
|
|
305
|
+
const hasSvc = check("systemctl is-enabled --quiet evo-nexus 2>/dev/null");
|
|
306
|
+
if (hasSvc) {
|
|
307
|
+
console.log(` ${BOLD}The dashboard is running via systemd.${RESET}
|
|
308
|
+
Open the URL shown above to create your admin account.
|
|
309
|
+
|
|
310
|
+
${BOLD}Useful commands:${RESET}
|
|
311
|
+
${CYAN}•${RESET} ${BOLD}systemctl restart evo-nexus${RESET} — restart services
|
|
312
|
+
${CYAN}•${RESET} ${BOLD}systemctl status evo-nexus${RESET} — check status
|
|
313
|
+
${CYAN}•${RESET} ${BOLD}journalctl -u evo-nexus -f${RESET} — follow logs
|
|
314
|
+
${CYAN}•${RESET} ${BOLD}su - evonexus${RESET} — switch to service user
|
|
315
|
+
`);
|
|
316
|
+
} else {
|
|
317
|
+
console.log(` ${BOLD}The dashboard is already running.${RESET}
|
|
279
318
|
Open the URL shown above to create your admin account.
|
|
280
319
|
|
|
281
320
|
${BOLD}Useful commands:${RESET}
|
|
282
321
|
${CYAN}•${RESET} ${BOLD}./start-services.sh${RESET} — restart dashboard services
|
|
283
|
-
${CYAN}•${RESET} ${BOLD}make scheduler${RESET} — start automated routines
|
|
284
322
|
${CYAN}•${RESET} ${BOLD}make help${RESET} — see all available commands
|
|
285
323
|
`);
|
|
324
|
+
}
|
|
286
325
|
} else {
|
|
287
326
|
console.log(` ${BOLD}Next steps:${RESET}
|
|
288
327
|
${CYAN}1.${RESET} cd ${targetDir}
|