39 lines
1.1 KiB
Bash
Executable File
39 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Deploy Trainingsplan: aktuellen Stand aus dem Gitea-Repo holen und neu bauen.
|
|
# Das Repo ist oeffentlich, es wird kein Zugangsschluessel gebraucht.
|
|
#
|
|
# Aufruf im CasaOS-Terminal:
|
|
# bash /DATA/AppData/trainingsplan/deploy.sh
|
|
|
|
set -euo pipefail
|
|
|
|
APP_DIR="/DATA/AppData/trainingsplan"
|
|
ORIGIN="https://git.somantis.net/J4stMarkus/trainingsplan.git"
|
|
|
|
cd "$APP_DIR" || { echo "FEHLER: $APP_DIR existiert nicht." >&2; exit 1; }
|
|
|
|
if [ -d .git ]; then
|
|
git remote set-url origin "$ORIGIN" 2>/dev/null \
|
|
|| git remote add origin "$ORIGIN"
|
|
else
|
|
git init -q
|
|
git remote add origin "$ORIGIN"
|
|
fi
|
|
|
|
echo "==> Pull main von Gitea"
|
|
git fetch -q origin main
|
|
git reset --hard -q origin/main
|
|
|
|
echo "==> Docker build (--no-cache) + up"
|
|
docker compose build --no-cache
|
|
docker compose up -d
|
|
|
|
# ---------- Kurzer Healthcheck ----------
|
|
sleep 2
|
|
if curl -s -o /dev/null -w "%{http_code}" "http://127.0.0.1:8080/api/data" | grep -q 200; then
|
|
echo "OK: Trainingsplan laeuft auf http://<server>:8080/"
|
|
else
|
|
echo "WARNUNG: Container gestartet, aber /api/data antwortet noch nicht."
|
|
echo " Pruefe: docker compose ps / docker compose logs"
|
|
fi
|