Refactor deployment scripts to improve Node.js version handling and PM2 process management
All checks were successful
Code Analysis and Production Deploy / analyze (push) Successful in 7m36s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 2m55s

- Updated `ensure_node_version` function in `deploy-production.sh` and `deploy-test.sh` to use a common script for Node.js version validation.
- Simplified PM2 instance restart logic by introducing `deploy_restart_pm2` function in a new `deploy-runtime.sh` script.
- Replaced direct PM2 commands with the new function to handle instance restarts and HTTP readiness checks.
- Modified PM2 configuration files to set the script directly instead of using `node` as the interpreter, allowing for better compatibility with older Node.js versions.
- Added tests for the new deployment runtime functions in `deploy-runtime.spec.ts` to ensure correct behavior during deployment.
- Updated `package-lock.json` to include new dependencies and ensure compatibility with the latest changes.
This commit is contained in:
Torsten Schulz (local)
2026-10-29 15:48:17 +01:00
parent 4ecc2cc90c
commit 10a37180de
7 changed files with 693 additions and 100 deletions

View File

@@ -49,8 +49,9 @@ module.exports = {
{
name: 'harheimertc',
// Nuxt 4 production build: direkt den Node-Server starten (kein "preview mode")
script: 'node',
args: '.output/server/index.mjs',
script: '.output/server/index.mjs',
// Der PM2-Daemon kann noch unter einer älteren Node-Version laufen.
interpreter: process.env.DEPLOY_NODE_BINARY || process.execPath,
cwd: '/var/www/harheimertc',
instances: 1,
autorestart: true,