deploy.sh: Ein-Befehl-Deployment über Forgejo + Bind-Mount
This commit is contained in:
parent
8d3bb17853
commit
84cdf4491e
1 changed files with 34 additions and 0 deletions
34
scripts/deploy.sh
Executable file
34
scripts/deploy.sh
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
# deploy.sh — Push zu Forgejo + sofort auf pve-hetzner synchronisieren
|
||||
# CT 116 sieht Änderungen automatisch über Bind-Mount.
|
||||
#
|
||||
# Nutzung: ./scripts/deploy.sh "Commit-Nachricht"
|
||||
# ./scripts/deploy.sh (ohne Nachricht = Auto-Message)
|
||||
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
source homelab.conf
|
||||
|
||||
MSG="${1:-Deploy: $(date +%Y-%m-%d\ %H:%M)}"
|
||||
|
||||
git add -A
|
||||
if git diff --cached --quiet 2>/dev/null; then
|
||||
echo "Nichts zu committen."
|
||||
else
|
||||
git commit -m "$MSG"
|
||||
fi
|
||||
|
||||
git fetch forgejo main
|
||||
git rebase forgejo/main
|
||||
git push forgejo main
|
||||
|
||||
echo "→ Sync auf pve-hetzner..."
|
||||
sshpass -p "$PW_HETZNER" ssh -o StrictHostKeyChecking=no root@$SRV_HETZNER \
|
||||
'cd /opt/homelab-brain && git fetch origin main --quiet && git reset --hard FETCH_HEAD --quiet && echo "OK: $(git log --oneline -1)"'
|
||||
|
||||
echo "→ Bot neu starten..."
|
||||
sshpass -p "$PW_HETZNER" ssh -o StrictHostKeyChecking=no root@$SRV_HETZNER \
|
||||
'pct exec 116 -- systemctl restart hausmeister-bot 2>/dev/null && echo "Bot restarted" || echo "Bot restart nicht nötig"'
|
||||
|
||||
echo "✅ Deploy fertig."
|
||||
Loading…
Add table
Reference in a new issue