Refactor fix_wt_config.sh to improve configuration management by enhancing error handling and adding logging for better traceability.

This commit is contained in:
Torsten Schulz (local)
2025-12-04 16:51:06 +01:00
parent fb2de33e76
commit e5da73b2a1
2 changed files with 195 additions and 0 deletions

89
README-DEPLOYMENT.md Normal file
View File

@@ -0,0 +1,89 @@
# Deployment-Anleitung für ypchat.net
## Voraussetzungen
- Die Anwendung muss nach `/opt/ypchat` kopiert werden
- Node.js muss installiert sein
- Apache muss konfiguriert sein
## Schritte
### 1. Anwendung nach /opt/ypchat kopieren
```bash
# Als root oder mit sudo
sudo mkdir -p /opt/ypchat
sudo cp -r /home/torsten/Programs/SingleChat/* /opt/ypchat/
sudo chown -R www-data:www-data /opt/ypchat
```
### 2. Installation durchführen
```bash
cd /opt/ypchat
sudo -u www-data ./install.sh
```
### 3. Service installieren
```bash
cd /opt/ypchat
sudo ./install-service-ypchat.sh
```
### 4. Alten Service stoppen
```bash
sudo systemctl stop ypchat
sudo systemctl disable ypchat # Optional: Alten Service deaktivieren
```
### 5. Neuen Service starten
```bash
sudo systemctl start ypchat
sudo systemctl status ypchat
```
### 6. Logs prüfen
```bash
sudo journalctl -u ypchat -f
```
## Troubleshooting
### Service startet nicht
```bash
# Prüfe Logs
sudo journalctl -u ypchat -n 50
# Prüfe ob Node.js verfügbar ist
which node
/usr/bin/node --version
# Prüfe ob .env existiert
ls -la /opt/ypchat/.env
cat /opt/ypchat/.env
```
### Alte Seite wird noch angezeigt
1. Prüfe ob der neue Service läuft: `sudo systemctl status ypchat`
2. Prüfe ob Port 4000 belegt ist: `sudo lsof -i :4000`
3. Prüfe Apache-Logs: `sudo tail -f /var/log/apache2/error.log`
4. Apache neu laden: `sudo systemctl reload apache2`
### Gebaute Dateien fehlen
```bash
# Prüfe ob dist existiert
ls -la /opt/ypchat/docroot/dist
# Falls nicht, baue neu:
cd /opt/ypchat
sudo -u www-data npm run build
sudo -u www-data cp -r client/dist docroot/
```