Przeglądaj źródła

deploy script

master
FlorianEisenmenger 1 tydzień temu
rodzic
commit
23cdc3d451
1 zmienionych plików z 66 dodań i 0 usunięć
  1. +66
    -0
      httpdocs/deploy.sh

+ 66
- 0
httpdocs/deploy.sh Wyświetl plik

@@ -0,0 +1,66 @@
#!/bin/bash
set -e

# ══════════════════════════════════════════════════════════════════════
# Konfiguration – einmalig anpassen
# ══════════════════════════════════════════════════════════════════════

# Verzeichnis des Git-Repos
GIT_DIR="/var/www/vhosts/memap.de/httpdocs/timetracking/timetracking-git-repo"

# Verzeichnis, aus dem die App tatsächlich läuft (Document Root eine Ebene drüber)
APP_DIR="/var/www/vhosts/memap.de/httpdocs/timetracking/timetracking-copy"

# Binaries
PHP="/usr/bin/php8.2"
COMPOSER="/usr/local/bin/composer"
NPM="/usr/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 ────────────────────
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" \
"$GIT_DIR/" "$APP_DIR/"

# ── 3. Composer Dependencies installieren ─────────────────────────────
echo "⏳ [3/7] Composer install..."
cd "$APP_DIR"
"$COMPOSER" install --no-dev --optimize-autoloader --no-interaction

# ── 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 ───────────────────────────────────────────────────
echo "⏳ [7/7] Assets bauen (npm)..."
"$NPM" ci
"$NPM" run build

echo ""
echo "✅ Deploy abgeschlossen."
echo ""

Ładowanie…
Anuluj
Zapisz