Local-Deploy-Modus: Stack + Migrations per pct push statt Gitea
- rapport-lxc.sh: LOCAL_STACK / LOCAL_MIGRATIONS Tarballs werden per pct push in den Container geschoben statt git clone / sync-migrations - deploy-local.sh: läuft auf dem Mac, tart die lokalen Working-Copies (SERVER-CONTAINER + APP/supabase/migrations), scp auf den Proxmox-Host, ruft rapport-lxc.sh im Local-Modus mit durchgereichten Parametern - README: Local-Deploy als empfohlener Test-Pfad dokumentiert Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+38
-13
@@ -31,10 +31,17 @@ TMPL_STORAGE="${TMPL_STORAGE:-local}" # Storage für Template-Cache
|
||||
NET_IP="${NET_IP:-dhcp}" # dhcp ODER z.B. 192.168.1.50/24
|
||||
NET_GW="${NET_GW:-}" # nur bei statischer IP nötig
|
||||
PASSWORD="${PASSWORD:-}" # root-PW im Container (leer = kein Login)
|
||||
REPO_URL="${REPO_URL:-https://git.kgva.ch/karim/rapport-server.git}"
|
||||
REPO_URL="${REPO_URL:-http://git.kgva.ch/karim/RAPPORT-SERVER.git}"
|
||||
REPO_REF="${REPO_REF:-main}"
|
||||
TEMPLATE="${TEMPLATE:-debian-12-standard}" # pveam-Template-Name (Präfix)
|
||||
|
||||
# ── Local-Modus (kein Gitea nötig) ──────────────────────────────────────────
|
||||
# Wenn gesetzt, werden diese Tarballs (Pfade AUF DEM PROXMOX-HOST) per
|
||||
# `pct push` in den Container geschoben statt von Gitea geklont/gesynct.
|
||||
# Setzt deploy-local.sh automatisch — siehe README.
|
||||
LOCAL_STACK="${LOCAL_STACK:-}" # tar.gz des SERVER-CONTAINER-Working-Copy
|
||||
LOCAL_MIGRATIONS="${LOCAL_MIGRATIONS:-}" # tar.gz mit *.sql (APP/supabase/migrations)
|
||||
|
||||
# ═══ Ausgabe-Helfer ═════════════════════════════════════════════════════════
|
||||
GN='\033[0;32m'; YW='\033[0;33m'; RD='\033[0;31m'; BL='\033[1;34m'; CL='\033[0m'
|
||||
msg() { echo -e "${GN}✔${CL} $*"; }
|
||||
@@ -110,14 +117,21 @@ pct exec "$CTID" -- bash -c '
|
||||
'
|
||||
msg "Docker + Node installiert."
|
||||
|
||||
# ═══ 5 · Repo klonen ════════════════════════════════════════════════════════
|
||||
info "Klone Rapport-Stack ($REPO_URL @ $REPO_REF) …"
|
||||
pct exec "$CTID" -- bash -c "
|
||||
set -euo pipefail
|
||||
rm -rf /opt/rapport
|
||||
git clone --branch '$REPO_REF' --depth 1 '$REPO_URL' /opt/rapport
|
||||
"
|
||||
msg "Stack nach /opt/rapport geklont."
|
||||
# ═══ 5 · Stack ins Container holen (Local-Push ODER git clone) ══════════════
|
||||
pct exec "$CTID" -- rm -rf /opt/rapport
|
||||
pct exec "$CTID" -- mkdir -p /opt/rapport
|
||||
if [[ -n "$LOCAL_STACK" ]]; then
|
||||
[[ -f "$LOCAL_STACK" ]] || die "LOCAL_STACK '$LOCAL_STACK' nicht gefunden (auf dem Proxmox-Host)."
|
||||
info "Schiebe lokalen Stack in den Container ($LOCAL_STACK) …"
|
||||
pct push "$CTID" "$LOCAL_STACK" /tmp/rapport-stack.tar.gz
|
||||
pct exec "$CTID" -- tar -xzf /tmp/rapport-stack.tar.gz -C /opt/rapport
|
||||
pct exec "$CTID" -- rm -f /tmp/rapport-stack.tar.gz
|
||||
msg "Lokaler Stack nach /opt/rapport entpackt (kein Gitea)."
|
||||
else
|
||||
info "Klone Rapport-Stack ($REPO_URL @ $REPO_REF) …"
|
||||
pct exec "$CTID" -- git clone --branch "$REPO_REF" --depth 1 "$REPO_URL" /opt/rapport
|
||||
msg "Stack nach /opt/rapport geklont."
|
||||
fi
|
||||
|
||||
# ═══ 6 · Container-IP ermitteln ═════════════════════════════════════════════
|
||||
info "Ermittle Container-IP …"
|
||||
@@ -165,10 +179,21 @@ pct exec "$CTID" -- env CT_IP="$CT_IP" bash -c '
|
||||
'
|
||||
msg ".env erzeugt (Secrets zufällig, Keys passend zum JWT_SECRET)."
|
||||
|
||||
# ═══ 8 · DB-Migrations holen ════════════════════════════════════════════════
|
||||
info "Hole DB-Migrations aus dem App-Repo …"
|
||||
pct exec "$CTID" -- bash -c "cd /opt/rapport && bash scripts/sync-migrations.sh"
|
||||
msg "Migrations synchronisiert."
|
||||
# ═══ 8 · DB-Migrations bereitstellen (Local-Push ODER sync-migrations) ══════
|
||||
if [[ -n "$LOCAL_MIGRATIONS" ]]; then
|
||||
[[ -f "$LOCAL_MIGRATIONS" ]] || die "LOCAL_MIGRATIONS '$LOCAL_MIGRATIONS' nicht gefunden (auf dem Proxmox-Host)."
|
||||
info "Schiebe lokale Migrations in den Container ($LOCAL_MIGRATIONS) …"
|
||||
pct exec "$CTID" -- rm -rf /opt/rapport/volumes/db/init/rapport-migrations
|
||||
pct exec "$CTID" -- mkdir -p /opt/rapport/volumes/db/init/rapport-migrations
|
||||
pct push "$CTID" "$LOCAL_MIGRATIONS" /tmp/rapport-migrations.tar.gz
|
||||
pct exec "$CTID" -- tar -xzf /tmp/rapport-migrations.tar.gz -C /opt/rapport/volumes/db/init/rapport-migrations
|
||||
pct exec "$CTID" -- rm -f /tmp/rapport-migrations.tar.gz
|
||||
msg "Lokale Migrations bereitgestellt (kein Gitea)."
|
||||
else
|
||||
info "Hole DB-Migrations aus dem App-Repo …"
|
||||
pct exec "$CTID" -- bash -c "cd /opt/rapport && bash scripts/sync-migrations.sh"
|
||||
msg "Migrations synchronisiert."
|
||||
fi
|
||||
|
||||
# ═══ 9 · Stack hochfahren ═══════════════════════════════════════════════════
|
||||
info "Starte Compose-Stack (Images pullen, Erststart ~1-2 Min) …"
|
||||
|
||||
Reference in New Issue
Block a user