Files
w-make-portfolio/deploy-vps.sh
T
Jan Wagner 820a2f8241 feat: route alles unter w-make.com — admin/api ohne Subdomain
- Traefik-Routing: /admin und /v1/* auf updates-api (prioritaet 150/200)
- Portfolio fängt restliches w-make.com ab (prioritaet 100)
- Subdomain updates.w-make.com entfällt
- Admin-HTML: Kicker aktualisiert zu w-make.com
- deploy-vps.sh: updates-api wird jetzt auch gebaut und deployed
2026-08-22 18:05:59 +02:00

136 lines
3.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# deploy-w-make.sh
# Deployment-Script für w-make.com (Portfolio + Updates-API)
# Generiert von Jcode am 2026-08-22
set -euo pipefail
echo "🚀 W-Make.com Deployment"
echo "========================="
echo ""
# 1. Zum Projekt-Verzeichnis navigieren
if [ -d "/home/eldov/projects/w-make-portfolio" ]; then
PROJECT_DIR="/home/eldov/projects/w-make-portfolio"
elif [ -d "/opt/containers/w-make-portfolio" ]; then
PROJECT_DIR="/opt/containers/w-make-portfolio"
elif [ -d "/srv/w-make-portfolio" ]; then
PROJECT_DIR="/srv/w-make-portfolio"
else
echo "❌ Projekt-Verzeichnis nicht gefunden. Bitte manuell anpassen:"
echo " PROJECT_DIR=\"/pfad/zu/w-make-portfolio\""
exit 1
fi
echo "📁 Projekt-Verzeichnis: $PROJECT_DIR"
cd "$PROJECT_DIR"
# 2. Git-Status prüfen
echo ""
echo "📊 Git-Status vor dem Pull:"
git status --short
git log --oneline -3
# 3. Neueste Änderungen holen
echo ""
echo "📥 Hole neueste Änderungen von origin/main..."
git fetch origin
git pull origin main
# 4. Zeige neue Commits
echo ""
echo "✨ Neue Commits:"
git log --oneline -5
# 5. .env für updates-api prüfen
echo ""
echo "🔑 Prüfe .env für updates-api..."
if [ ! -f ".env" ]; then
echo "⚠️ .env nicht gefunden, erstelle mit Placeholder..."
echo "UPDATES_ADMIN_TOKEN=$(openssl rand -hex 32)" > .env
echo "SMTP_PASS=placeholder" >> .env
echo " ⚠️ Bitte UPDATES_ADMIN_TOKEN und SMTP_PASS in .env anpassen!"
else
echo "✅ .env existiert"
fi
# 6. Docker Images neu bauen
echo ""
echo "🔨 Baue Docker Images neu..."
docker-compose build w-make-portfolio
docker-compose build updates-api
# 7. Container neu starten
echo ""
echo "🔄 Starte Container neu..."
docker-compose up -d w-make-portfolio
docker-compose up -d updates-api
# 8. Warte auf Startup
echo ""
echo "⏳ Warte 8 Sekunden auf Container-Start..."
sleep 8
# 9. Health-Checks
echo ""
echo "🏥 Health-Checks:"
if curl -sf http://localhost:3000/api/health > /dev/null 2>&1; then
echo "✅ Portfolio Health-Endpoint erreichbar"
curl -s http://localhost:3000/api/health | python3 -m json.tool
else
echo "⚠️ Portfolio Health-Endpoint nicht erreichbar (möglicherweise noch am Starten)"
fi
if curl -sf http://localhost:8080/healthz > /dev/null 2>&1; then
echo "✅ Updates-API Health-Endpoint erreichbar"
curl -s http://localhost:8080/healthz | python3 -m json.tool
else
echo "⚠️ Updates-API Health-Endpoint nicht erreichbar"
fi
# 10. Traefik Routing validieren
echo ""
echo "🌐 Routing-Tests:"
echo -n " https://w-make.com → "
if curl -sf -o /dev/null https://w-make.com 2>/dev/null; then
echo "✅ 200 OK"
else
echo "⚠️ Nicht erreichbar"
fi
echo -n " https://w-make.com/admin → "
if curl -sf -o /dev/null https://w-make.com/admin 2>/dev/null; then
echo "✅ Erreichbar (Authelia-Redirect oder 401)"
else
echo "⚠️ Nicht erreichbar"
fi
echo -n " https://w-make.com/v1/updates → "
if curl -sf -o /dev/null https://w-make.com/v1/updates 2>/dev/null; then
echo "✅ Erreichbar"
else
echo "⚠️ Nicht erreichbar"
fi
# 11. Container-Logs anzeigen
echo ""
echo "📋 Container-Logs (letzte 20 Zeilen):"
docker-compose logs --tail=20 w-make-portfolio
echo ""
docker-compose logs --tail=20 updates-api
# 12. Status-Zusammenfassung
echo ""
echo "========================="
echo "✅ Deployment abgeschlossen!"
echo ""
echo "Nächste Schritte:"
echo "1. Prüfe https://w-make.com im Browser"
echo "2. Prüfe https://w-make.com/admin (Authelia-Login)"
echo "3. Prüfe https://w-make.com/v1/updates (API)"
echo ""
echo "Bei Problemen:"
echo " docker-compose logs -f w-make-portfolio"
echo " docker-compose logs -f w-make-updates-api"
echo ""