25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

84 satır
4.0 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. --exclude="public/build" \
  34. "$GIT_DIR/httpdocs/" "$APP_DIR/"
  35. # ── 3. Composer Dependencies installieren ─────────────────────────────
  36. echo "⏳ [3/7] Composer install..."
  37. cd "$APP_DIR"
  38. export APP_ENV=prod
  39. "$PHP" "$COMPOSER" install --no-dev --optimize-autoloader --no-interaction --no-scripts
  40. # ── 4. Central-Migrationen ausführen ──────────────────────────────────
  41. echo "⏳ [4/7] Central-Migrationen..."
  42. "$PHP" bin/console doctrine:migrations:migrate --em=central --no-interaction
  43. # ── 5. Tenant-Schemas aktualisieren ───────────────────────────────────
  44. echo "⏳ [5/7] Tenant-Schemas aktualisieren..."
  45. "$PHP" bin/console app:update-tenant-schema
  46. # ── 6. Cache leeren ───────────────────────────────────────────────────
  47. echo "⏳ [6/7] Cache leeren..."
  48. "$PHP" bin/console cache:clear
  49. # ── 7. Assets bauen ───────────────────────────────────────────────────
  50. # HINWEIS: Ubuntu 18.04 hat glibc 2.27, Node 18+ braucht 2.28 – npm build
  51. # funktioniert auf diesem Server nicht. Assets müssen lokal gebaut und
  52. # manuell hochgeladen werden:
  53. #
  54. # ddev exec npm run build
  55. # rsync -av httpdocs/public/build/ SERVER_USER@SERVER_IP:/var/www/vhosts/memap.de/httpdocs/timetracking/timetracking-copy/public/build/
  56. #
  57. # Sobald der Server auf Ubuntu 22.04 upgraded ist, diese Zeilen einkommentieren:
  58. # echo "⏳ [7/7] Assets bauen (npm)..."
  59. # "$NPM" ci
  60. # "$NPM" run build
  61. echo "⚠️ [7/7] Assets-Build übersprungen – bitte public/build/ manuell hochladen."
  62. echo ""
  63. echo "⏳ Dateiberechtigungen setzen..."
  64. sudo chown -R memap:psaserv "$APP_DIR"
  65. echo ""
  66. echo "✅ Deploy abgeschlossen."
  67. echo ""