# Deployment Scripts Diese Verzeichnis enthält alle Scripts für das Deployment der AdsPreview React Anwendung. ## 📁 Scripts Übersicht ### `setup.sh` - Initiales Setup ```bash ./setup.sh ``` - Installiert Frontend Dependencies - Erstellt Development Build zum Testen - Bereitet Backend-Verzeichnisse vor - Erstellt Standard-Konfigurationsdateien ### `deploy.sh` - Production Deployment ```bash ./deploy.sh ``` - Erstellt optimierten Production Build - Kopiert alle notwendigen Dateien nach `deployment/build/` - Setzt korrekte Dateiberechtigungen - Bereitet Upload-ready Struktur vor ### `upload.sh` - Webspace Upload ```bash # WICHTIG: Erst .env.upload konfigurieren! cp .env.upload.example .env.upload # Bearbeite .env.upload mit deinen FTP-Zugangsdaten ./upload.sh ``` - Uploaded `deployment/build/` Inhalt via SFTP/FTP - **🔒 SICHER:** Verwendet .env.upload für Zugangsdaten (nicht in Git!) - Benötigt `lftp` Tool (`brew install lftp`) ## 🚀 Deployment Workflow 1. **Einmalig:** Setup ausführen ```bash cd deployment/scripts ./setup.sh ``` 2. **FTP-Zugangsdaten konfigurieren (einmalig):** ```bash cp .env.upload.example .env.upload # Bearbeite .env.upload mit deinen echten Zugangsdaten ``` 3. **Production Build erstellen:** ```bash ./deploy.sh ``` 4. **Auf Webspace hochladen:** ```bash ./upload.sh ``` ## 📦 Deployment-Struktur Nach `deploy.sh` wird folgende Struktur erstellt: ``` deployment/build/ ├── public/ # React App + PHP Entry Points │ ├── index.html # React SPA │ ├── index.php # PHP Backend Entry │ ├── files.php # File Service │ └── static/ # React Assets (CSS, JS) ├── src/ # PHP Backend Code │ ├── Api/ # API Controllers │ ├── Core/ # Application Core │ ├── Helper/ # Utility Functions │ └── Services/ # Business Logic ├── storage/ # Application Data │ └── data/ # JSON Storage Files └── vendor/ # PHP Dependencies (GetID3) ``` ## � Sicherheitshinweise ### FTP-Zugangsdaten (.env.upload) - **NIEMALS** Zugangsdaten direkt ins Script schreiben - **IMMER** .env.upload für sensible Daten verwenden - .env.upload ist automatisch von Git ausgeschlossen - Template: .env.upload.example zeigt die Struktur ```bash # .env.upload Beispiel: FTP_HOST="dein-server.de" FTP_USER="dein-username" FTP_PASS="dein-passwort" FTP_PATH="/htdocs" ``` ## 🔧 Anpassungen ### nginx Konfiguration Siehe `../nginx/` Verzeichnis für Server-Konfiguration. ## 💡 Tipps - **Scripts laufen von überall:** Die Scripts erkennen automatisch ihren Standort - **Backup:** Sichere vor Upload immer deine Live-Daten - **Testing:** Teste zuerst mit `setup.sh` bevor du `deploy.sh` verwendest - **Logs:** Scripts geben detaillierte Status-Informationen aus