#!/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

# Backend deployen
echo ""
echo "=== Deploying Backend ==="
./deploy-backend.sh

# Frontend bauen und deployen
echo ""
echo "=== Building and Deploying Frontend ==="
./deploy-frontend.sh

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"
