|
- #!/bin/bash
- set -e
-
- # ══════════════════════════════════════════════════════════════════════
- # Konfiguration – einmalig anpassen
- # ══════════════════════════════════════════════════════════════════════
-
- # Verzeichnis des Git-Repos (enthält httpdocs/, .git/, etc.)
- GIT_DIR="/var/www/vhosts/memap.de/httpdocs/timetracking/timetracking-git-repo"
-
- # Verzeichnis, aus dem die App läuft (Document Root ist dann APP_DIR/public)
- APP_DIR="/var/www/vhosts/memap.de/httpdocs/timetracking/timetracking-copy"
-
- # Binaries
- PHP="/opt/plesk/php/8.4/bin/php"
- COMPOSER="/usr/local/bin/composer84"
- NPM="/home/flo/.nodenv/versions/16/bin/npm"
-
- # ══════════════════════════════════════════════════════════════════════
-
- echo ""
- echo "╔══════════════════════════════════════╗"
- echo "║ spawntree Timetracker – Deploy ║"
- echo "╚══════════════════════════════════════╝"
- echo ""
-
- # ── 1. Git aktualisieren ───────────────────────────────────────────────
- echo "⏳ [1/7] Git pull..."
- git -C "$GIT_DIR" pull
-
- # ── 2. Dateien ins App-Verzeichnis synchronisieren ────────────────────
- # Quelle: httpdocs/ im Repo, nicht der Repo-Root
- echo "⏳ [2/7] Dateien synchronisieren..."
- rsync -av --delete \
- --exclude=".git" \
- --exclude="node_modules" \
- --exclude="var/cache" \
- --exclude="var/log" \
- --exclude=".env.local" \
- --exclude=".env.*.local" \
- --exclude="public/build" \
- "$GIT_DIR/httpdocs/" "$APP_DIR/"
-
- # ── 3. Composer Dependencies installieren ─────────────────────────────
- echo "⏳ [3/7] Composer install..."
- cd "$APP_DIR"
- export APP_ENV=prod
- "$PHP" "$COMPOSER" install --no-dev --optimize-autoloader --no-interaction --no-scripts
-
- # ── 4. Central-Migrationen ausführen ──────────────────────────────────
- echo "⏳ [4/7] Central-Migrationen..."
- "$PHP" bin/console doctrine:migrations:migrate --em=central --no-interaction
-
- # ── 5. Tenant-Schemas aktualisieren ───────────────────────────────────
- echo "⏳ [5/7] Tenant-Schemas aktualisieren..."
- "$PHP" bin/console app:update-tenant-schema
-
- # ── 6. Cache leeren ───────────────────────────────────────────────────
- echo "⏳ [6/7] Cache leeren..."
- "$PHP" bin/console cache:clear
-
- # ── 7. Assets bauen ───────────────────────────────────────────────────
- # HINWEIS: Ubuntu 18.04 hat glibc 2.27, Node 18+ braucht 2.28 – npm build
- # funktioniert auf diesem Server nicht. Assets müssen lokal gebaut und
- # manuell hochgeladen werden:
- #
- # ddev exec npm run build
- # rsync -av httpdocs/public/build/ SERVER_USER@SERVER_IP:/var/www/vhosts/memap.de/httpdocs/timetracking/timetracking-copy/public/build/
- #
- # Sobald der Server auf Ubuntu 22.04 upgraded ist, diese Zeilen einkommentieren:
- # echo "⏳ [7/7] Assets bauen (npm)..."
- # "$NPM" ci
- # "$NPM" run build
-
- echo "⚠️ [7/7] Assets-Build übersprungen – bitte public/build/ manuell hochladen."
-
- echo ""
- echo "⏳ Dateiberechtigungen setzen..."
- sudo chown -R memap:psaserv "$APP_DIR"
-
- echo ""
- echo "✅ Deploy abgeschlossen."
- echo ""
|