#!/bin/bash echo "=== YourPart Deployment Script ===" echo "" # Prüfen ob wir im richtigen Verzeichnis sind if [ ! -f "package.json" ]; then echo "Error: Please run this script from the YourPart3 root directory" exit 1 fi # Prüfen ob sudo verfügbar ist if ! command -v sudo &> /dev/null; then echo "Error: sudo is required but not installed" exit 1 fi # Verzeichnisstruktur erstellen echo "Creating directory structure..." sudo mkdir -p /opt/yourpart/{frontend,backend} # Backend deployen echo "" echo "=== Deploying Backend ===" ./deploy-backend.sh # Frontend bauen und deployen echo "" echo "=== Building and Deploying Frontend ===" ./build-frontend.sh # Systemd Service installieren echo "" echo "=== Installing Systemd Service ===" sudo cp yourpart.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable yourpart.service # Apache-Konfiguration installieren echo "" echo "=== Installing Apache Configuration ===" sudo cp yourpart-http.conf /etc/apache2/sites-available/yourpart-http.conf sudo cp yourpart-https.conf /etc/apache2/sites-available/yourpart-https.conf # Alte Konfiguration deaktivieren (falls vorhanden) sudo a2dissite yourpart 2>/dev/null || true # Neue Konfiguration aktivieren sudo a2ensite yourpart-http sudo a2ensite yourpart-https # Apache-Module aktivieren echo "Enabling required Apache modules..." sudo a2enmod proxy sudo a2enmod proxy_http sudo a2enmod proxy_wstunnel sudo a2enmod rewrite sudo a2enmod ssl # Apache neu laden echo "Reloading Apache..." sudo systemctl reload apache2 # Backend-Service starten echo "" echo "=== Starting Backend Service ===" sudo systemctl start yourpart.service # Status anzeigen echo "" echo "=== Deployment Status ===" echo "Backend Service Status:" sudo systemctl status yourpart.service --no-pager -l echo "" echo "Apache Status:" sudo systemctl status apache2 --no-pager -l echo "" echo "=== Deployment Completed! ===" echo "Your application should now be available at:" echo " HTTP: http://your-part.de (redirects to HTTPS)" echo " HTTPS: https://www.your-part.de" echo "" echo "To check logs:" echo " Backend: sudo journalctl -u yourpart.service -f" echo " Apache: sudo tail -f /var/log/apache2/yourpart.*.log"