Files
AdsPreview/deployment/scripts/deploy.sh
Johannes b4758b4f26 security: clean repository without media files and sensitive data
- Removed area/ directory with 816MB of media files
- Removed sensitive FTP credentials from Git history
- Implemented .env.upload system for secure deployments
- Added comprehensive .gitignore for future protection

This commit represents a clean slate with all sensitive data removed.
2025-09-07 11:05:29 +02:00

98 lines
3.2 KiB
Bash
Executable File

#!/bin/sh
# Deployment-Skript für Production Update
echo "🚀 Starte Production Deployment..."
# Prüfe ob wir im deployment/scripts/ Ordner sind und wechsle zur Projekt-Root
if [ "$(basename "$PWD")" = "scripts" ]; then
cd ../..
elif [ "$(basename "$PWD")" = "deployment" ]; then
cd ..
fi
# Deployment-Ordner vorbereiten
echo "📁 Erstelle Deployment-Ordner..."
rm -rf deployment/build 2>/dev/null || true
mkdir -p deployment/build/public
# Frontend bauen
echo "📦 Baue Frontend..."
cd frontend
# Temporären Build-Ordner erstellen
echo "📁 Erstelle temporären Build-Ordner..."
rm -rf ../build_temp 2>/dev/null || true
mkdir -p ../build_temp
# Abhängigkeiten installieren (ohne die lokalen node_modules zu überschreiben)
echo "⬇️ Installiere Production Dependencies..."
cp package*.json ../build_temp/
cd ../build_temp
npm ci --production --silent
# Source-Code kopieren (ohne node_modules)
echo "📄 Kopiere Source-Code..."
cd ../frontend
cp -r public src ../build_temp/
cd ../build_temp
# Build erstellen
echo "🔨 Erstelle Production Build..."
npm run build
# Frontend-Build in public-Ordner des Deployments kopieren
echo "📦 Kopiere Frontend-Build ins public-Verzeichnis..."
cp -r build/* ../deployment/build/public/
# Backend-Verzeichnisse in der Root des Deployments erstellen
echo "📄 Kopiere Backend-Dateien mit korrekter Struktur..."
cd ../backend
# Kopiere Backend-Verzeichnisse in die Root des Deployment-Ordners (als komplette Ordner)
cp -r src ../deployment/build/
cp -r storage ../deployment/build/
cp -r vendor ../deployment/build/
# PHP-Dateien aus backend/public in das public-Verzeichnis des Deployments kopieren
cd public
for file in *.php .htaccess .nginx; do
if [ -f "$file" ]; then
cp "$file" ../../deployment/build/public/
fi
done
# area-Ordner in die Root des Deployment-Ordners kopieren
#echo "📁 Kopiere area-Verzeichnis..."
#cd ../..
#cp -r area deployment/build/ 2>/dev/null || true
# Temporären Build-Ordner aufräumen
echo "🧹 Räume temporären Build-Ordner auf..."
cd ../..
rm -rf build_temp
# Rechte setzen
echo "🔒 Setze Dateiberechtigungen..."
chmod -R 755 deployment/build
find deployment/build -type f -name "*.html" -exec chmod 644 {} \;
find deployment/build -type f -name "*.css" -exec chmod 644 {} \;
find deployment/build -type f -name "*.js" -exec chmod 644 {} \;
find deployment/build -type f -name "*.php" -exec chmod 644 {} \;
find deployment/build -type f -name "*.json" -exec chmod 644 {} \;
echo "✅ Production Deployment abgeschlossen!"
echo "🎯 Deployment-ready Dateien sind im 'deployment/build/' Ordner"
echo ""
echo "📋 DEPLOYMENT STRUKTUR:"
echo " deployment/build/"
echo " ├── public/ (React App + PHP Entry Points)"
echo " │ ├── index.html (React)"
echo " │ ├── index.php (PHP Entry Point)"
echo " │ └── static/ (React Assets)"
echo " ├── src/ (PHP Backend Code)"
echo " ├── storage/ (Data Files)"
echo " ├── vendor/ (PHP Dependencies)"
echo " └── area/ (Project Data)"
echo ""
echo "📤 Du kannst jetzt den kompletten Inhalt des 'deployment/build/' Ordners auf deinen Webspace hochladen."