# Infrastruktur — Explor.Code.Law Gerichtsentscheidungen und Normen-Index auf dem Strato-VServer, analog zu Lawgit. Aktuell **Daten + Pipeline** (kein UI). Domain und Port sind für später reserviert. ## Architektur ``` Lokal / CI → Gitea git.coded.law/michaelkole/explore → Checkout /opt/explore ├── ge_md/ # Markdown-Volltexte (im Git) ├── data/ # normen_index.json (im Git) ├── ge_xml/ # Roh-ZIP/XML (NICHT im Git, nur auf Disk) ├── extract_rii.py … └── LAWGIT_ROOT → /opt/lawgit ``` Gesetze bleiben in Lawgit (`/opt/lawgit/laws_md/`). Explore kopiert sie nicht. ## Pfade | Was | Pfad | |-----|------| | Checkout | `/opt/explore/` | | Entscheidungen (Markdown) | `/opt/explore/ge_md/` | | Normen-Index | `/opt/explore/data/normen_index.json` | | Rohdaten (gitignoriert) | `/opt/explore/ge_xml/` | | Lawgit (Read-only Bezug) | `/opt/lawgit/` | | Optionale Env | `/opt/explore/.env` (Mode 600) | **Wichtig:** Deploy darf `ge_xml/` und `.env` nie löschen (`git clean` / `reset --hard` vermeiden). ## Domain / Port (vorbereitet) | Variable | Wert | Status | |----------|------|--------| | Domain | `explore.coded.law` | DNS + Certbot noch offen | | Frontend-Port (später) | `127.0.0.1:3097` | frei (Stand Server-Check) | | UI / Apache / Docker | — | bewusst noch nicht eingerichtet | ## Gitea - Host: `https://git.coded.law` - Repo (Ziel): `michaelkole/explore` - Deploy-Workflow: `.gitea/workflows/deploy.yml` - Secret: `SSH_PRIVATE_KEY` (siehe `setup-ssh-deploy.sh`) SSH zum Server: `ssh -i ~/.ssh/gitea_deploy root@82.165.92.92` ## Sync & Deploy ### Erstinstallation (einmalig) 1. Gitea-Repo `michaelkole/explore` anlegen und lokalen Stand pushen. 2. Auf dem Server: ```bash git clone https://git.coded.law/michaelkole/explore.git /opt/explore cd /opt/explore cp env.example .env && chmod 600 .env # optional # optional: Roh-XML von lokal nachziehen # ./sync_to_server.sh --xml-only ``` Oder lokal: `./deploy.sh` (legt `/opt/explore` an und pullt). 3. CI: `./setup-ssh-deploy.sh` (Gitea-API-Token mit repo-Rechten). ### Laufendes Update (Git) Push auf `main` → Workflow aktualisiert tracked Dateien unter `/opt/explore` (`ge_md/`, `data/`, Skripte). `ge_xml/` bleibt unberührt. Manuell: ```bash ssh -i ~/.ssh/gitea_deploy root@82.165.92.92 cd /opt/explore git fetch origin main git checkout origin/main -- . ``` ### Roh-XML (`ge_xml/`) Liegt nicht in Git. Nach lokaler Extraktion auf den Server spiegeln: ```bash ./sync_to_server.sh --xml-only # oder voller Bootstrap (ohne .venv): ./sync_to_server.sh ``` ### Index auf dem Server neu bauen ```bash cd /opt/explore python3 -m pip install -r requirements.txt --break-system-packages # oder venv python3 index_normen.py --lawgit /opt/lawgit ``` ## Env (`env.example` → `.env`) | Variable | Default | Zweck | |----------|---------|--------| | `LAWGIT_ROOT` | `/opt/lawgit` | Pfad zu `laws_md/` für `index_normen.py` | | `DOMAIN` | `explore.coded.law` | reserviert für späteres UI | ## Nützliche Befehle ```bash # Bestand prüfen ssh -i ~/.ssh/gitea_deploy root@82.165.92.92 'du -sh /opt/explore/ge_md /opt/explore/ge_xml /opt/explore/data; find /opt/explore/ge_md -name "*.md" | wc -l' # Extraktion auf dem Server (braucht Netz + Platz) cd /opt/explore && python3 extract_rii.py --limit 5 --court bgh,bverfg ``` ## Abgrenzung zu Lawgit | | lawgit | explore | |--|--------|---------| | Checkout | `/opt/lawgit` | `/opt/explore` | | Inhalt | `laws_md/`, UI, Postgres | `ge_md/`, Index, später Kommentar | | Deploy | Docker Compose + Apache | Git-Sync (schlank) | | Domain | lawgit.coded.law | explore.coded.law (geplant) |