Files
Johannes a6ae81f5b5 feat: Add SSH-Key support for secure deployment authentication
- upload.sh: Conditional SSH-Key vs. password authentication
- Automatic detection of SSH-Keys via FTP_SSH_KEY variable
- CloudPanel-compatible SSH-Key integration
- .env.upload.example: Added SSH-Key documentation
- Secure SFTP uploads without passwords in code
2025-09-07 15:46:11 +02:00
..

Deployment Scripts

Diese Verzeichnis enthält alle Scripts für das Deployment der AdsPreview React Anwendung.

📁 Scripts Übersicht

setup.sh - Initiales Setup

./setup.sh
  • Installiert Frontend Dependencies
  • Erstellt Development Build zum Testen
  • Bereitet Backend-Verzeichnisse vor
  • Erstellt Standard-Konfigurationsdateien

deploy.sh - Production Deployment

./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

# 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

    cd deployment/scripts
    ./setup.sh
    
  2. FTP-Zugangsdaten konfigurieren (einmalig):

    cp .env.upload.example .env.upload
    # Bearbeite .env.upload mit deinen echten Zugangsdaten
    
  3. Production Build erstellen:

    ./deploy.sh
    
  4. Auf Webspace hochladen:

    ./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)

<EFBFBD> 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
# .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