Infrastruktur-Dokumentation: Neue Kunden-Organisation

- CLAUDE.md: Host-Troubleshooting → Infrastruktur-Dokumentationssystem
- session-start.sh: Erkennt ~/Nextcloud/[kunde]/[repo]/ Struktur
- Legacy-Support für ~/Nextcloud/hosts/ mit Migrations-Hinweis

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
root
2026-01-27 13:00:30 +01:00
parent 92b276a422
commit a536d35743
4 changed files with 772 additions and 81 deletions

114
CLAUDE.md
View File

@@ -229,74 +229,104 @@ This upfront investment minimizes questions in future sessions and enables faste
---
## Host Troubleshooting
## Infrastruktur-Dokumentationssystem
### Automatische Host-Setup (Hook-gesteuert)
### Organisation pro Kunde
Der Session-Start Hook erkennt automatisch Host-Verzeichnisse unter `~/Nextcloud/hosts/`.
Gitea-Struktur:
```
├── Vinos/ ← Organisation für Kunde "vinos"
│ ├── infrastructure.git ← Landkarte für vinos
│ ├── zabbix.git ← System-Repo
│ └── [weitere].git ← Dienst-/System-Repos
└── Egonetix/ ← Organisation für Kunde "egonetix"
├── infrastructure.git ← Landkarte für egonetix
└── [weitere].git
```
**Wenn du `<HOST_SETUP_REQUIRED>` in der Hook-Ausgabe siehst:**
Lokale Struktur:
```
~/Nextcloud/
├── vinos/ ← Kunde vinos
│ ├── infrastructure/ ← Landkarte (dependencies.md, hosts/)
│ ├── zabbix/ ← System-Repo
│ └── [weitere]/ ← Dienst-/System-Repos
└── egonetix/ ← Kunde egonetix
├── infrastructure/
└── [weitere]/
```
### Repo-Typen
| Repo-Typ | Gitea-Ort | Inhalt |
|----------|-----------|--------|
| **Infrastructure** | `[Kunde]/infrastructure.git` | Landkarte, Abhängigkeiten, Host-Übersichten |
| **System-Repo** | `[Kunde]/[system].git` | README, Konfig-Dateien, Troubleshooting |
| **Dienst-Repo** | `[Kunde]/[dienst].git` | docker-compose.yml, Code, Workflows |
### Automatische Erkennung (Hook-gesteuert)
Der Session-Start Hook erkennt Kunden-Verzeichnisse unter `~/Nextcloud/[kunde]/`.
**Wenn du `<REPO_SETUP_REQUIRED>` in der Hook-Ausgabe siehst:**
1. **Frage den User:**
> "Ich habe erkannt, dass für diesen Host noch Setup erforderlich ist. Soll ich das automatisch durchführen?"
> - Git-Repository initialisieren (falls fehlend)
> - Template für Dokumentation kopieren (falls fehlend)
> "Ich habe erkannt, dass für dieses Repo noch Setup erforderlich ist. Soll ich das automatisch durchführen?"
2. **Bei Zustimmung - führe alle fehlenden Schritte aus:**
```bash
# Git initialisieren (falls nicht vorhanden)
git init
git branch -M main
# Template kopieren (falls nicht vorhanden)
cp ~/Nextcloud/hosts/_templates/copilot-instructions-template.md ./copilot-instructions.md
# Template aus infrastructure/_templates/ kopieren
```
3. **Dann interaktiv ausfüllen:**
- Frage nach den wichtigsten Infos (IP, Typ, Funktion, Zugang)
- Ersetze die Platzhalter im Template
- Lösche den Template-Hinweis-Block am Anfang
4. **Initial Commit erstellen:**
3. **Repo auf Gitea erstellen (API):**
```bash
git add copilot-instructions.md
git commit -m "Initial: Host-Dokumentation angelegt"
curl -X POST -H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"repo-name","description":"..."}' \
https://gitea.egonetix.de/api/v1/orgs/[Kunde]/repos
```
### Automatische Erkennung
4. **Remote hinzufügen und pushen:**
```bash
git remote add origin ssh://git@gitea.egonetix.de:222/[Kunde]/[repo-name].git
git push -u origin main
```
Wenn du in einem Verzeichnis unter `~/Nextcloud/hosts/` arbeitest:
1. **Lade die lokale Dokumentation**
- Lies `copilot-instructions.md` falls vorhanden
- Verstehe den System-Typ und Kontext
2. **Bei Troubleshooting-Aufgaben**
- Nutze den Skill `/troubleshoot-host` für strukturiertes Vorgehen
- Dokumentiere Lösungen in der `copilot-instructions.md`
### Verzeichnisstruktur
### Gitea Remote-Konfiguration
**URL-Format:**
```
~/Nextcloud/hosts/
├── [kunde]/ # z.B. vinos, egonetix
│ └── [hostname]/ # z.B. srv-monitor02, srv-db12
│ └── copilot-instructions.md
└── _templates/
└── copilot-instructions-template.md # Master-Template
ssh://git@gitea.egonetix.de:222/[Kunde]/[repo-name].git
```
### Workflow: Neuen Host anlegen
**Beispiele:**
| Kunde | Repo | Remote URL |
|-------|------|------------|
| Vinos | infrastructure | `ssh://git@gitea.egonetix.de:222/Vinos/infrastructure.git` |
| Vinos | zabbix | `ssh://git@gitea.egonetix.de:222/Vinos/zabbix.git` |
| Egonetix | infrastructure | `ssh://git@gitea.egonetix.de:222/Egonetix/infrastructure.git` |
**Wichtig:** Das Repo muss auf Gitea ZUERST erstellt werden (API oder Web-UI).
### Workflow: Neues System-/Dienst-Repo anlegen
Der User legt nur den Ordner an:
```bash
mkdir -p ~/Nextcloud/hosts/[kunde]/[hostname]
cd ~/Nextcloud/hosts/[kunde]/[hostname]
claude # Startet Claude Code
cd ~/Nextcloud/[kunde]
git init [repo-name]
cd [repo-name]
# Template aus ../infrastructure/_templates/ kopieren
# Repo auf Gitea erstellen
# git remote add origin ...
# git push -u origin main
```
Claude erkennt automatisch das fehlende Template und bietet Setup an.
### Skills-Referenz
| Skill | Zweck |