You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

96 regels
2.5 KiB

  1. #!/bin/bash
  2. # -------------------------------------------------------
  3. # setup.sh — Einmalig nach git clone ausführen
  4. # -------------------------------------------------------
  5. set -e
  6. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  7. cd "$SCRIPT_DIR/.."
  8. PROJECT_ROOT="$(pwd)"
  9. echo "🚀 Contao Blueprint Setup"
  10. echo "-------------------------"
  11. # .env lokal anlegen (nicht im Git, wird nicht deployed)
  12. if [ ! -f ".env" ]; then
  13. echo "📋 Erstelle .env mit DDEV-Standardwerten..."
  14. cat > .env << 'EOF'
  15. APP_ENV=dev
  16. APP_SECRET=pleasechangethis
  17. DATABASE_URL=mysql://db:db@db:3306/db
  18. EOF
  19. echo "✅ .env erstellt."
  20. else
  21. echo "✅ .env bereits vorhanden."
  22. fi
  23. # .env.local für Live-Zugangsdaten anlegen (Vorlage)
  24. if [ ! -f ".env.local" ]; then
  25. cp .env.example .env.local
  26. echo "✅ .env.local als Vorlage erstellt — Live-Zugangsdaten bei Bedarf eintragen."
  27. fi
  28. # DDEV starten
  29. echo ""
  30. echo "🐳 Starte DDEV..."
  31. ddev start
  32. # phpMyAdmin installieren
  33. echo ""
  34. echo "🗄️ Installiere phpMyAdmin Add-on..."
  35. ddev add-on get ddev/ddev-phpmyadmin
  36. ddev restart
  37. # Composer im Container
  38. echo ""
  39. echo "📦 Installiere Composer-Abhängigkeiten..."
  40. ddev exec composer install --no-interaction
  41. # Contao Web-Verzeichnis initialisieren
  42. echo ""
  43. echo "📁 Initialisiere Contao Web-Verzeichnis..."
  44. mkdir -p assets
  45. ddev exec vendor/bin/contao-console contao:install-web-dir
  46. # Symlinks setzen
  47. echo ""
  48. echo "🔗 Setze Symlinks..."
  49. ddev exec vendor/bin/contao-console contao:symlinks
  50. # Assets installieren
  51. echo ""
  52. echo "🎨 Installiere Assets..."
  53. ddev exec vendor/bin/contao-console assets:install public
  54. # Cache leeren und aufwärmen
  55. echo ""
  56. echo "🧹 Leere Cache..."
  57. ddev exec vendor/bin/contao-console cache:clear
  58. ddev exec vendor/bin/contao-console cache:warmup
  59. # DB importieren falls Dump vorhanden
  60. if [ -f "db/dump.sql" ]; then
  61. echo ""
  62. echo "🗄️ Importiere Datenbank aus db/dump.sql..."
  63. ddev import-db --file="${PROJECT_ROOT}/db/dump.sql"
  64. echo "✅ Datenbank importiert."
  65. fi
  66. # Contao Migrationen
  67. echo ""
  68. echo "⚙️ Führe Contao-Migrationen aus..."
  69. ddev exec vendor/bin/contao-console contao:migrate --no-interaction
  70. # Cache nochmal leeren nach Migrationen und DB-Import
  71. ddev exec vendor/bin/contao-console cache:clear
  72. # Admin-Benutzer anlegen
  73. echo ""
  74. echo "👤 Admin-Benutzer anlegen..."
  75. ddev exec vendor/bin/contao-console contao:user:create
  76. echo ""
  77. echo "✅ Setup abgeschlossen!"
  78. echo ""
  79. echo "🌐 Frontend: https://$(ddev describe 2>/dev/null | grep -o '[a-z0-9-]*\.ddev\.site' | head -1)"
  80. echo