Optimierung der PM2-Instanzverwaltung: Entfernen der zweiten Instanz und Anpassung der Fehlermeldungen in den Deployment-Skripten
All checks were successful
Code Analysis and Production Deploy / analyze (push) Successful in 10m23s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 2m52s

This commit is contained in:
Torsten Schulz (local)
2026-08-26 11:23:48 +02:00
parent c1c648de74
commit e82c1d9b0a
4 changed files with 17 additions and 46 deletions

View File

@@ -282,17 +282,11 @@ install_dependencies_if_needed
# 4. Stop running apps before replacing build artifacts
echo ""
echo "4. Stopping PM2 before replacing build artifacts..."
if command -v pm2 >/dev/null 2>&1; then
for instance_name in harheimertc harheimertc-3102; do
if pm2 describe "$instance_name" >/dev/null 2>&1; then
pm2 stop "$instance_name" || true
echo "$instance_name gestoppt"
else
echo " PM2-Prozess $instance_name läuft nicht"
fi
done
if command -v pm2 >/dev/null 2>&1 && pm2 describe harheimertc >/dev/null 2>&1; then
pm2 stop harheimertc || true
echo " ✓ harheimertc gestoppt"
else
echo " PM2 ist nicht verfügbar"
echo " PM2-Prozess harheimertc läuft nicht oder PM2 ist nicht verfügbar"
fi
# 5. Remove old build (but keep data!)
@@ -559,18 +553,14 @@ restart_pm2_instance() {
fi
}
# Starte/Neustarte beide Instanzen
# Starte/Neustarte die Produktionsinstanz
INSTANCE_ERRORS=0
if ! restart_pm2_instance "harheimertc"; then
INSTANCE_ERRORS=$((INSTANCE_ERRORS + 1))
fi
if ! restart_pm2_instance "harheimertc-3102"; then
INSTANCE_ERRORS=$((INSTANCE_ERRORS + 1))
fi
# Prüfe, ob beide Prozesse laufen
# Prüfe, ob der Prozess läuft
sleep 2
echo ""
echo " Checking PM2 instances status..."
@@ -582,19 +572,11 @@ else
INSTANCE_ERRORS=$((INSTANCE_ERRORS + 1))
fi
if pm2 describe harheimertc-3102 | grep -q "online"; then
echo " ✓ PM2-Prozess 'harheimertc-3102' läuft (online)"
else
echo " WARNING: PM2-Prozess 'harheimertc-3102' ist nicht online. Prüfe Logs: pm2 logs harheimertc-3102"
INSTANCE_ERRORS=$((INSTANCE_ERRORS + 1))
fi
if [ "$INSTANCE_ERRORS" -gt 0 ]; then
echo ""
echo "WARNING: Einige PM2-Instanzen haben Probleme. Bitte manuell prüfen:"
echo " pm2 status"
echo " pm2 logs harheimertc"
echo " pm2 logs harheimertc-3102"
fi
echo ""
@@ -603,8 +585,5 @@ echo "The application is now running with the latest code and your production da
echo ""
echo "Useful commands:"
echo " pm2 logs harheimertc # View logs (Port 3100)"
echo " pm2 logs harheimertc-3102 # View logs (Port 3102)"
echo " pm2 status # View status"
echo " pm2 restart harheimertc # Restart instance on port 3100"
echo " pm2 restart harheimertc-3102 # Restart instance on port 3102"
echo " pm2 restart all # Restart all instances"