cms.c2sgmbh/scripts/setup-tenants/README.md
Martin Porwoll 77f70876f4 chore: add Claude Code config, prompts, and tenant setup scripts
- Add .claude/ configuration (agents, commands, hooks, get-shit-done workflows)
- Add prompts/ directory with development planning documents
- Add scripts/setup-tenants/ with tenant configuration
- Add docs/screenshots/
- Remove obsolete phase2.2-corrections-report.md
- Update pnpm-lock.yaml
- Update detect-secrets.sh to ignore setup.sh (env var usage, not secrets)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 10:18:05 +00:00

167 lines
3.9 KiB
Markdown

# Tenant Setup Scripts
Automatisierte Einrichtung von Tenants (porwoll.de, blogwoman.de) im Payload CMS.
## Voraussetzungen
- `curl` und `jq` installiert
- Admin-Zugang zum Payload CMS
- Netzwerkzugriff auf die API
## Verwendung
```bash
# Hilfe anzeigen
./setup.sh --help
# porwoll.de auf Staging einrichten
./setup.sh porwoll
# blogwoman.de auf Production einrichten
./setup.sh -e production blogwoman
# Dry-Run (zeigt was passieren würde, ohne Änderungen)
./setup.sh --dry-run porwoll
# Mit expliziter Tenant-ID
./setup.sh -e production -t 4 porwoll
# Verbose Ausgabe
./setup.sh -v porwoll
```
## Optionen
| Option | Beschreibung |
|--------|--------------|
| `-e, --env` | Environment: `staging` oder `production` (default: staging) |
| `-u, --user` | Admin E-Mail (wird sonst abgefragt) |
| `-p, --password` | Admin Passwort (oder `PAYLOAD_PASSWORD` env var) |
| `-t, --tenant-id` | Tenant-ID überschreiben |
| `-d, --dry-run` | Nur anzeigen, keine Änderungen |
| `-v, --verbose` | Ausführliche Ausgabe |
| `-h, --help` | Hilfe anzeigen |
## Umgebungen
| Environment | API URL |
|-------------|---------|
| staging | https://pl.porwoll.tech/api |
| production | https://cms.c2sgmbh.de/api |
## Standard Tenant-IDs
| Tenant | Default ID |
|--------|------------|
| porwoll | 4 |
| blogwoman | 6 |
## Verzeichnisstruktur
```
scripts/setup-tenants/
├── setup.sh # Hauptscript
├── README.md # Diese Dokumentation
└── tenants/
├── porwoll/
│ ├── site-settings.json # Website-Einstellungen
│ ├── social-links.json # Social Media Links
│ ├── pages.json # Alle Seiten
│ └── navigation.json # Navigation (Main + Footer)
└── blogwoman/
├── site-settings.json
├── social-links.json
├── pages.json
└── navigation.json
```
## Was wird erstellt?
### porwoll.de
- Site Settings (Kontakt, Adresse, SEO)
- 5 Social Links (Facebook, X, Instagram, LinkedIn, YouTube)
- 9 Seiten:
- Startseite
- Mensch
- Zytoskandal
- Whistleblowing
- complex care solutions
- gunshin Holding
- Kontakt
- Impressum
- Datenschutz
- Navigation (5 Hauptmenü-Einträge, 3 Footer-Links)
### blogwoman.de
- Site Settings (Kontakt, SEO)
- 2 Social Links (YouTube, Instagram)
- 10 Seiten:
- Startseite
- Über mich (Caroline)
- Newsletter
- Favoriten
- Blog
- Serien
- Kooperationen
- Transparenz
- Impressum
- Datenschutz
- Navigation (5 Hauptmenü-Einträge, 5 Footer-Links)
## Beispiel-Workflow
```bash
# 1. Erst Dry-Run auf Staging
./setup.sh --dry-run -v porwoll
# 2. Auf Staging ausführen und testen
./setup.sh -v porwoll
# 3. Im Browser prüfen: https://pl.porwoll.tech/admin
# 4. Wenn alles OK, auf Production
./setup.sh -e production porwoll
```
## Fehlerbehandlung
| Problem | Lösung |
|---------|--------|
| 401 Unauthorized | Token abgelaufen → Script neu starten |
| 403 Forbidden | User hat keine Tenant-Berechtigung |
| 400 Bad Request | JSON-Syntax prüfen |
| Pages existieren bereits | Script überspringt bestehende Seiten |
## Hinweise
- Das Script prüft vor dem Erstellen, ob Dokumente bereits existieren
- Bestehende Site Settings werden aktualisiert (PATCH)
- Bestehende Seiten werden übersprungen (kein Update)
- Die Navigation wird nur erstellt, wenn keine existiert
## Umgebungsvariablen
```bash
# Passwort aus Umgebungsvariable lesen
export PAYLOAD_PASSWORD="your-password"
./setup.sh -u admin@example.com porwoll
```
## Anpassungen
Die JSON-Dateien in `tenants/<tenant>/` können angepasst werden:
- Seiten-Inhalte in `pages.json`
- Navigation in `navigation.json`
- Site Settings in `site-settings.json`
- Social Links in `social-links.json`
### Neue Seite hinzufügen
1. Seite in `pages.json` hinzufügen
2. Falls in Navigation: `navigation.json` aktualisieren mit `PAGE_ID_<slug>`
3. Script ausführen
## Letzte Aktualisierung
17. Januar 2026