Fix PM2 startup and harden server entry detection.

Use a bash launch script for production and pathToFileURL-based main-module checks so sourcing.simosen.cn listens reliably under PM2.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-15 00:55:21 +08:00
parent e9939ef9dc
commit 3cace7ab42
3 changed files with 17 additions and 4 deletions
+2 -2
View File
@@ -3,8 +3,8 @@ module.exports = {
{
name: "product-sourcing",
cwd: "/www/wwwroot/sourcing.simosen.cn/app",
script: "src/server.js",
interpreter: "node",
script: "deploy/start.sh",
interpreter: "/bin/bash",
env: {
NODE_ENV: "production",
PORT: "9477",
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
exec /root/.nvm/versions/node/v20.20.2/bin/node src/server.js