您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

79 行
3.9 KiB

  1. #!/bin/bash
  2. set -e
  3. # ══════════════════════════════════════════════════════════════════════
  4. # Konfiguration – einmalig anpassen
  5. # ══════════════════════════════════════════════════════════════════════
  6. # Verzeichnis des Git-Repos (enthält httpdocs/, .git/, etc.)
  7. GIT_DIR="/var/www/vhosts/memap.de/httpdocs/timetracking/timetracking-git-repo"
  8. # Verzeichnis, aus dem die App läuft (Document Root ist dann APP_DIR/public)
  9. APP_DIR="/var/www/vhosts/memap.de/httpdocs/timetracking/timetracking-copy"
  10. # Binaries
  11. PHP="/opt/plesk/php/8.4/bin/php"
  12. COMPOSER="/usr/local/bin/composer84"
  13. NPM="/home/flo/.nodenv/versions/16/bin/npm"
  14. # ══════════════════════════════════════════════════════════════════════
  15. echo ""
  16. echo "╔══════════════════════════════════════╗"
  17. echo "║ spawntree Timetracker – Deploy ║"
  18. echo "╚══════════════════════════════════════╝"
  19. echo ""
  20. # ── 1. Git aktualisieren ───────────────────────────────────────────────
  21. echo "⏳ [1/7] Git pull..."
  22. git -C "$GIT_DIR" pull
  23. # ── 2. Dateien ins App-Verzeichnis synchronisieren ────────────────────
  24. # Quelle: httpdocs/ im Repo, nicht der Repo-Root
  25. echo "⏳ [2/7] Dateien synchronisieren..."
  26. rsync -av --delete \
  27. --exclude=".git" \
  28. --exclude="node_modules" \
  29. --exclude="var/cache" \
  30. --exclude="var/log" \
  31. --exclude=".env.local" \
  32. --exclude=".env.*.local" \
  33. "$GIT_DIR/httpdocs/" "$APP_DIR/"
  34. # ── 3. Composer Dependencies installieren ─────────────────────────────
  35. echo "⏳ [3/7] Composer install..."
  36. cd "$APP_DIR"
  37. export APP_ENV=prod
  38. "$PHP" "$COMPOSER" install --no-dev --optimize-autoloader --no-interaction --no-scripts
  39. # ── 4. Central-Migrationen ausführen ──────────────────────────────────
  40. echo "⏳ [4/7] Central-Migrationen..."
  41. "$PHP" bin/console doctrine:migrations:migrate --em=central --no-interaction
  42. # ── 5. Tenant-Schemas aktualisieren ───────────────────────────────────
  43. echo "⏳ [5/7] Tenant-Schemas aktualisieren..."
  44. "$PHP" bin/console app:update-tenant-schema
  45. # ── 6. Cache leeren ───────────────────────────────────────────────────
  46. echo "⏳ [6/7] Cache leeren..."
  47. "$PHP" bin/console cache:clear
  48. # ── 7. Assets bauen ───────────────────────────────────────────────────
  49. # HINWEIS: Ubuntu 18.04 hat glibc 2.27, Node 18+ braucht 2.28 – npm build
  50. # funktioniert auf diesem Server nicht. Assets müssen lokal gebaut und
  51. # manuell hochgeladen werden:
  52. #
  53. # ddev exec npm run build
  54. # rsync -av httpdocs/public/build/ SERVER_USER@SERVER_IP:/var/www/vhosts/memap.de/httpdocs/timetracking/timetracking-copy/public/build/
  55. #
  56. # Sobald der Server auf Ubuntu 22.04 upgraded ist, diese Zeilen einkommentieren:
  57. # echo "⏳ [7/7] Assets bauen (npm)..."
  58. # "$NPM" ci
  59. # "$NPM" run build
  60. echo "⚠️ [7/7] Assets-Build übersprungen – bitte public/build/ manuell hochladen."
  61. echo ""
  62. echo "✅ Deploy abgeschlossen."
  63. echo ""