Files
explore/deploy.sh
Michael Hermann bdaa21dc31
Some checks failed
Deploy explore / deploy (push) Failing after 18s
Initialisiere Explor.Code.Law mit RII-Pipeline und Strato-Deploy.
Entscheidungen als Markdown, Normen-Index und schlankes Git-Sync nach /opt/explore (Gitea Actions, ohne Docker).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 12:03:40 +02:00

61 lines
2.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Erstinstallation / Sync von Explor.Code.Law auf dem Strato-VServer.
# Kein Docker, kein Apache — nur Git-Checkout unter /opt/explore.
# ge_xml/ und .env werden nicht gelöscht.
set -euo pipefail
echo "explore Server-Sync"
echo "====================="
PROJECT_DIR="/opt/explore"
GITEA_URL="https://git.coded.law/michaelkole/explore.git"
REMOTE_BRANCH="main"
if [ "$(id -u)" -ne 0 ] && [ ! -w "$(dirname "$PROJECT_DIR")" ]; then
echo "Hinweis: Skript typischerweise als root auf dem Server ausführen,"
echo " oder lokal sync_to_server.sh für rsync nutzen."
fi
mkdir -p "$PROJECT_DIR"
cd "$PROJECT_DIR"
if [ ! -d .git ]; then
if git ls-remote "$GITEA_URL" HEAD &>/dev/null; then
echo "Klone $GITEA_URL$PROJECT_DIR"
# Verzeichnis kann schon Dateien haben (Bootstrap-rsync) → init + fetch
git init
git remote add origin "$GITEA_URL" 2>/dev/null || git remote set-url origin "$GITEA_URL"
git fetch origin "$REMOTE_BRANCH"
git checkout -B "$REMOTE_BRANCH" "origin/$REMOTE_BRANCH"
else
echo "Gitea-Repo noch nicht erreichbar: $GITEA_URL"
echo "Repo anlegen, pushen, dann dieses Skript erneut ausführen."
echo "Bis dahin: lokal ./sync_to_server.sh nutzen."
exit 1
fi
else
echo "Aktualisiere tracked Dateien (ohne git clean)…"
git remote set-url origin "$GITEA_URL" 2>/dev/null || true
git fetch origin "$REMOTE_BRANCH"
# Tracked Dateien aktualisieren. Kein reset --hard, kein git clean:
# ge_xml/ und .env bleiben unangetastet.
git checkout "origin/$REMOTE_BRANCH" -- .
fi
mkdir -p ge_md data ge_xml kommentar
if [ ! -f .env ] && [ -f env.example ]; then
cp env.example .env
chmod 600 .env
echo ".env aus env.example angelegt"
fi
chmod 600 .env 2>/dev/null || true
echo ""
echo "Fertig: $PROJECT_DIR"
echo " ge_md: $(find ge_md -name '*.md' 2>/dev/null | wc -l | tr -d ' ') Dateien"
echo " ge_xml: $(find ge_xml -type f 2>/dev/null | wc -l | tr -d ' ') Dateien"
echo " Index: $([ -f data/normen_index.json ] && echo ja || echo fehlt)"
echo ""
echo "Optional Index: python3 index_normen.py --lawgit /opt/lawgit"