Refactor Vite configuration for improved development experience; add support for hot module replacement and optimize build process
This commit is contained in:
213
CHECK_SERVICES.md
Normal file
213
CHECK_SERVICES.md
Normal file
@@ -0,0 +1,213 @@
|
||||
# Services überprüfen und verwalten
|
||||
|
||||
## Backend-Service Status prüfen
|
||||
|
||||
Das Deploy-Script verwendet **PM2** als Standard. Hier die Befehle:
|
||||
|
||||
### Mit PM2 (Standard)
|
||||
|
||||
```bash
|
||||
# Status anzeigen
|
||||
pm2 status
|
||||
|
||||
# Detaillierte Info
|
||||
pm2 info timeclock-backend
|
||||
|
||||
# Ist der Service laufend?
|
||||
pm2 list | grep timeclock-backend
|
||||
|
||||
# Logs ansehen
|
||||
pm2 logs timeclock-backend
|
||||
|
||||
# Letzten 50 Zeilen
|
||||
pm2 logs timeclock-backend --lines 50
|
||||
```
|
||||
|
||||
### Backend manuell starten (falls nicht laufend)
|
||||
|
||||
```bash
|
||||
cd /var/www/timeclock/backend
|
||||
pm2 start src/index.js --name timeclock-backend --env production
|
||||
pm2 save
|
||||
```
|
||||
|
||||
### Mit systemd (falls PM2 nicht verwendet)
|
||||
|
||||
```bash
|
||||
# Status prüfen
|
||||
sudo systemctl status timeclock
|
||||
|
||||
# Ist der Service aktiv?
|
||||
systemctl is-active timeclock
|
||||
|
||||
# Logs ansehen
|
||||
sudo journalctl -u timeclock -f
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Alle Services überprüfen
|
||||
|
||||
### Kompletter Status-Check
|
||||
|
||||
```bash
|
||||
# Backend (PM2)
|
||||
echo "=== Backend (PM2) ==="
|
||||
pm2 status
|
||||
|
||||
# Apache2
|
||||
echo ""
|
||||
echo "=== Apache2 ==="
|
||||
sudo systemctl status apache2 --no-pager | head -n 15
|
||||
|
||||
# Backend-Health-Check
|
||||
echo ""
|
||||
echo "=== Backend Health-Check ==="
|
||||
curl -s http://localhost:3010/api/health | jq || curl http://localhost:3010/api/health
|
||||
|
||||
# Frontend erreichbar?
|
||||
echo ""
|
||||
echo "=== Frontend Check ==="
|
||||
curl -I https://stechuhr3.tsschulz.de 2>/dev/null | head -n 5
|
||||
```
|
||||
|
||||
### Oder mit dem Deploy-Script
|
||||
|
||||
```bash
|
||||
cd /var/www/timeclock
|
||||
./deploy.sh status
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Backend neu starten
|
||||
|
||||
### Mit PM2
|
||||
|
||||
```bash
|
||||
# Neustart
|
||||
pm2 restart timeclock-backend
|
||||
|
||||
# Stoppen
|
||||
pm2 stop timeclock-backend
|
||||
|
||||
# Starten
|
||||
pm2 start timeclock-backend
|
||||
|
||||
# Löschen und neu starten
|
||||
pm2 delete timeclock-backend
|
||||
cd /var/www/timeclock/backend
|
||||
pm2 start src/index.js --name timeclock-backend --env production
|
||||
pm2 save
|
||||
```
|
||||
|
||||
### Mit systemd
|
||||
|
||||
```bash
|
||||
sudo systemctl restart timeclock
|
||||
sudo systemctl stop timeclock
|
||||
sudo systemctl start timeclock
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Backend läuft nicht
|
||||
|
||||
1. **Prüfe Logs:**
|
||||
```bash
|
||||
pm2 logs timeclock-backend --err
|
||||
```
|
||||
|
||||
2. **Prüfe .env Datei:**
|
||||
```bash
|
||||
cat /var/www/timeclock/backend/.env
|
||||
```
|
||||
|
||||
3. **Prüfe Port-Belegung:**
|
||||
```bash
|
||||
sudo netstat -tulpn | grep 3010
|
||||
# oder
|
||||
sudo lsof -i :3010
|
||||
```
|
||||
|
||||
4. **Prüfe Datenbank-Verbindung:**
|
||||
```bash
|
||||
mysql -h tsschulz.de -u stechuhr2 -p stechuhr2 -e "SHOW TABLES;"
|
||||
```
|
||||
|
||||
5. **Manuell starten (Debug):**
|
||||
```bash
|
||||
cd /var/www/timeclock/backend
|
||||
node src/index.js
|
||||
# Siehst du Fehler?
|
||||
```
|
||||
|
||||
### Backend startet, aber API antwortet nicht
|
||||
|
||||
1. **Health-Check direkt:**
|
||||
```bash
|
||||
curl http://localhost:3010/api/health
|
||||
```
|
||||
|
||||
2. **Apache Proxy prüfen:**
|
||||
```bash
|
||||
# Ist Proxy-Modul aktiv?
|
||||
apache2ctl -M | grep proxy
|
||||
|
||||
# Apache Error-Log
|
||||
sudo tail -f /var/log/apache2/stechuhr3-error.log
|
||||
```
|
||||
|
||||
3. **Firewall prüfen:**
|
||||
```bash
|
||||
sudo ufw status
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Monitoring einrichten
|
||||
|
||||
### PM2 Monitoring
|
||||
|
||||
```bash
|
||||
# Real-time Monitoring
|
||||
pm2 monit
|
||||
|
||||
# Web-Dashboard (PM2 Plus)
|
||||
pm2 plus
|
||||
```
|
||||
|
||||
### Automatischer Neustart bei Absturz
|
||||
|
||||
PM2 startet automatisch neu. Konfiguration:
|
||||
|
||||
```bash
|
||||
pm2 startup systemd
|
||||
# Führe den angezeigten Befehl aus
|
||||
pm2 save
|
||||
```
|
||||
|
||||
### Health-Check Cronjob
|
||||
|
||||
Siehe `scripts/health-check.sh` für automatisches Monitoring!
|
||||
|
||||
---
|
||||
|
||||
## Schnell-Befehle
|
||||
|
||||
```bash
|
||||
# Alles prüfen
|
||||
./deploy.sh status
|
||||
|
||||
# Logs live ansehen
|
||||
./deploy.sh logs
|
||||
|
||||
# Backend neu starten
|
||||
pm2 restart timeclock-backend
|
||||
|
||||
# Apache neu starten
|
||||
sudo systemctl restart apache2
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user