From 0f32d5927b4a3162994393c50d2fa1b9947198c4 Mon Sep 17 00:00:00 2001 From: loepperts Date: Sat, 29 Nov 2025 22:19:46 +0100 Subject: [PATCH] separate wiki from site --- DEBUG-WIKI.md | 87 ------------ DEPLOYMENT-CHECKLIST.md | 110 --------------- QUARTZ-SETUP-SERVER.md | 127 ------------------ WIKI-404-FIX.md | 159 ---------------------- WIKI-EXTERNAL-SETUP.md | 120 ----------------- WIKI-FIX.md | 81 ----------- WIKI-PROXY-SETUP.md | 119 ----------------- WIKI-SETUP.md | 147 -------------------- app/api/wiki/[...path]/route.ts | 77 ----------- app/api/wiki/route.ts | 70 ---------- app/wiki/page.tsx | 230 ++++---------------------------- components/Navigation.tsx | 8 +- docker-compose.yml | 20 --- test-wiki-build.ps1 | 38 ------ 14 files changed, 30 insertions(+), 1363 deletions(-) delete mode 100755 DEBUG-WIKI.md delete mode 100755 DEPLOYMENT-CHECKLIST.md delete mode 100755 QUARTZ-SETUP-SERVER.md delete mode 100755 WIKI-404-FIX.md delete mode 100755 WIKI-EXTERNAL-SETUP.md delete mode 100755 WIKI-FIX.md delete mode 100755 WIKI-PROXY-SETUP.md delete mode 100755 WIKI-SETUP.md delete mode 100755 app/api/wiki/[...path]/route.ts delete mode 100755 app/api/wiki/route.ts delete mode 100755 test-wiki-build.ps1 diff --git a/DEBUG-WIKI.md b/DEBUG-WIKI.md deleted file mode 100755 index 1e0a43c..0000000 --- a/DEBUG-WIKI.md +++ /dev/null @@ -1,87 +0,0 @@ -# Debug-Anleitung für Wiki-Setup - -## Problem behoben: Node.js Version - -**Problem**: Quartz 4.5.2 benötigt Node.js >= 22, wir hatten Node 20. - -**Lösung**: Dockerfile wurde aktualisiert auf `node:22-alpine` - -## Build-Anweisungen - -### 1. Wiki-Service neu bauen (nach Node.js Update) -```powershell -docker-compose build --no-cache wiki -``` - -### 2. Alle Services bauen -```powershell -docker-compose build -``` - -### 3. Services starten -```powershell -docker-compose up -d -``` - -### 4. Logs prüfen -```powershell -# Alle Logs -docker-compose logs - -# Nur Wiki-Logs -docker-compose logs wiki - -# Live-Logs folgen -docker-compose logs -f wiki -``` - -### 5. Container-Status prüfen -```powershell -docker-compose ps -``` - -## Erwartete Ausgabe beim Build - -Beim erfolgreichen Build sollten Sie sehen: -- ✅ Git wird installiert -- ✅ npm wird aktualisiert -- ✅ Quartz Repository wird geklont -- ✅ npm install läuft durch (kann einige Minuten dauern) -- ✅ serve wird installiert - -## Wenn der Build immer noch fehlschlägt - -### Option 1: Container-Status prüfen -```powershell -docker ps -a -docker-compose logs wiki --tail=100 -``` - -### Option 2: In Container einsteigen und manuell testen -```powershell -# Container starten (auch wenn Build fehlschlägt) -docker-compose run --rm wiki sh - -# Dann im Container: -cd /app/quartz-repo -npm install -``` - -### Option 3: Cache leeren und neu bauen -```powershell -docker-compose down -docker system prune -f -docker-compose build --no-cache wiki -``` - -## Erwartete Ports - -- **Web (Next.js)**: http://localhost:3001 -- **Wiki (Quartz)**: http://localhost:8080 - -## Nächste Schritte nach erfolgreichem Build - -1. Services starten: `docker-compose up -d` -2. Wiki aufrufen: http://localhost:8080 -3. Wiki-Seite testen: http://localhost:3001/wiki - diff --git a/DEPLOYMENT-CHECKLIST.md b/DEPLOYMENT-CHECKLIST.md deleted file mode 100755 index c6968c6..0000000 --- a/DEPLOYMENT-CHECKLIST.md +++ /dev/null @@ -1,110 +0,0 @@ -# Wiki Deployment Checklist - -## ✅ Vor dem Deployment - -- [ ] Alle Änderungen committed -- [ ] API-Route `app/api/wiki/route.ts` vorhanden -- [ ] API-Route `app/api/wiki/[...path]/route.ts` vorhanden -- [ ] Wiki-Seite `app/wiki/page.tsx` vorhanden -- [ ] Docker-Compose mit beiden Services konfiguriert - -## 🔧 Deployment-Schritte - -### 1. Services neu starten -```bash -docker-compose down -docker-compose up -d --build -``` - -### 2. Services prüfen -```bash -docker-compose ps -``` -**Erwartet:** Beide Services (web, wiki) sollten "Up" zeigen - -### 3. Wiki-Service-Logs prüfen -```bash -docker-compose logs wiki --tail=50 -``` -**Erwartet:** "Build complete. Starting server on port 8080..." - -### 4. API-Route testen -```bash -curl https://doing-it.de/api/wiki/ -``` -**Erwartet:** HTML-Inhalt des Wikis, nicht 404 - -### 5. Wiki-Seite testen -Browser: `https://doing-it.de/wiki` -**Erwartet:** Wiki wird im iframe angezeigt - -## 🐛 Troubleshooting - -### Problem: 404 auf /wiki - -**Schritt 1:** Prüfe ob Wiki-Service läuft -```bash -docker-compose ps wiki -docker-compose logs wiki -``` - -**Schritt 2:** Prüfe ob API-Route erreichbar ist -```bash -curl https://doing-it.de/api/wiki/ -``` - -**Schritt 3:** Prüfe interne Kommunikation -```bash -docker-compose exec web curl http://wiki:8080/ -``` - -**Schritt 4:** Prüfe Environment-Variable -```bash -docker-compose exec web printenv WIKI_SERVICE_URL -``` -Sollte sein: `http://wiki:8080` - -**Schritt 5:** Prüfe Next.js Logs -```bash -docker-compose logs web | grep -i wiki -``` - -### Problem: Wiki lädt nicht im iframe - -**Lösung 1:** Prüfe Browser-Konsole (F12) auf Fehler - -**Lösung 2:** Prüfe ob API-Route HTML zurückgibt -```bash -curl -I https://doing-it.de/api/wiki/ -``` - -**Lösung 3:** Prüfe CORS-Header (sollte bereits gesetzt sein) - -## 📝 Wichtige Konfiguration - -### docker-compose.yml sollte enthalten: - -```yaml -web: - environment: - - WIKI_SERVICE_URL=http://wiki:8080 - depends_on: - - wiki - -wiki: - expose: - - "8080" -``` - -### Environment-Variable - -Die `WIKI_SERVICE_URL` muss auf `http://wiki:8080` gesetzt sein (Docker-Service-Name, nicht localhost!). - -## ✅ Nach erfolgreichem Deployment - -- [ ] Wiki ist unter https://doing-it.de/wiki erreichbar -- [ ] Navigation-Link funktioniert -- [ ] Wiki-Inhalte werden angezeigt -- [ ] Keine 404-Fehler -- [ ] Keine Fehler in Browser-Konsole - diff --git a/QUARTZ-SETUP-SERVER.md b/QUARTZ-SETUP-SERVER.md deleted file mode 100755 index 0029c8c..0000000 --- a/QUARTZ-SETUP-SERVER.md +++ /dev/null @@ -1,127 +0,0 @@ -# Quartz Setup auf dem Server - -## Übersicht - -Diese Anleitung beschreibt, wie Sie Quartz als separate Instanz auf Port 3033 auf Ihrem Server einrichten. - -## Optionen für Quartz-Instanz - -### Option 1: Quartz direkt auf dem Host (Empfohlen) - -Quartz läuft direkt auf dem Server-Host auf Port 3033: - -```bash -# Quartz starten -cd /path/to/quartz -npx quartz build -npx serve -s public -l 3033 -``` - -**Konfiguration:** `NEXT_PUBLIC_WIKI_URL=http://localhost:3033` - -### Option 2: Quartz in separatem Docker-Container - -Quartz läuft in einem eigenen Container: - -```yaml -# docker-compose.wiki.yml -services: - quartz: - image: your-quartz-image - ports: - - "3033:3033" - volumes: - - ./wiki-vault:/app/content - - ./wiki-public:/app/public -``` - -**Konfiguration:** -- Für Browser (iframe): `NEXT_PUBLIC_WIKI_URL=http://localhost:3033` -- Falls Next.js-Container zugreift: `NEXT_PUBLIC_WIKI_URL=http://host.docker.internal:3033` - -### Option 3: Quartz im Docker-Netzwerk - -Beide Container im gleichen Netzwerk: - -```bash -# Netzwerk erstellen -docker network create wiki-network - -# Next.js Container -docker-compose up -d -docker network connect wiki-network doing-it-web-1 - -# Quartz Container -docker run -d --name quartz --network wiki-network -p 3033:3033 your-quartz-image -``` - -**Konfiguration:** `NEXT_PUBLIC_WIKI_URL=http://quartz:3033` - -## Wichtiger Hinweis - -Da das iframe **client-side** im Browser läuft (nicht im Container), verwendet es die URL so wie sie gesetzt ist: -- **`localhost:3033`** funktioniert, wenn Quartz auf dem Host läuft -- **`host.docker.internal:3033`** funktioniert nur von einem Container aus, NICHT vom Browser -- Für Browser muss die **öffentliche URL** verwendet werden (z.B. `http://doing-it.de:3033` oder über Reverse Proxy) - -## Reverse Proxy Setup (Empfohlen für Produktion) - -### Mit Nginx - -```nginx -server { - listen 80; - server_name wiki.doing-it.de; - - location / { - proxy_pass http://localhost:3033; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - } -} -``` - -**Dann:** `NEXT_PUBLIC_WIKI_URL=http://wiki.doing-it.de` - -### Oder Subpath - -```nginx -server { - listen 80; - server_name doing-it.de; - - location /wiki-content/ { - proxy_pass http://localhost:3033/; - } -} -``` - -## Environment-Variable setzen - -### In docker-compose.yml (bereits konfiguriert) - -```yaml -environment: - - NEXT_PUBLIC_WIKI_URL=${NEXT_PUBLIC_WIKI_URL:-http://localhost:3033} -``` - -### In .env Datei - -```bash -NEXT_PUBLIC_WIKI_URL=http://localhost:3033 -``` - -### Bei Container-Start - -```bash -NEXT_PUBLIC_WIKI_URL=http://localhost:3033 docker-compose up -d -``` - -## Testing - -1. Quartz starten auf Port 3033 -2. Prüfen: `curl http://localhost:3033` -3. Next.js starten -4. Wiki-Seite öffnen: `http://localhost:3001/wiki` -5. Browser-Entwicklertools (F12) öffnen und prüfen, ob iframe geladen wird - diff --git a/WIKI-404-FIX.md b/WIKI-404-FIX.md deleted file mode 100755 index e7ffbf1..0000000 --- a/WIKI-404-FIX.md +++ /dev/null @@ -1,159 +0,0 @@ -# Wiki 404 Error - Fix Dokumentation - -## Problem -Beim Klick auf den Wiki-Link in der Navbar erscheint ein 404-Fehler auf https://doing-it.de/wiki - -## Implementierte Fixes - -### 1. Root-API-Route hinzugefügt -- **Datei**: `app/api/wiki/route.ts` -- Behandelt direkte Aufrufe zu `/api/wiki` ohne weiteren Pfad -- Wichtig für das iframe, das `/api/wiki/` lädt - -### 2. Verbessertes Error-Handling -- Logging für alle Requests -- 10 Sekunden Timeout für Wiki-Service-Requests -- Bessere Fehlermeldungen mit Status-Codes - -### 3. URL-Handling verbessert -- Keine doppelten Slashes mehr -- Korrekte Query-Parameter-Weiterleitung - -### 4. Next.js 15 Compatibility -- Async params in Catch-All-Route -- Verbesserte Type-Sicherheit - -### 5. Fehleranzeige in Wiki-Seite -- Zeigt Fehlermeldung, falls Wiki nicht lädt -- Button zum Neuladen der Seite - -## Mögliche Ursachen des 404-Fehlers - -### 1. Wiki-Service läuft nicht -**Prüfung:** -```bash -docker-compose ps -docker-compose logs wiki -``` - -**Lösung:** -```bash -docker-compose up -d wiki -``` - -### 2. Wiki-Service nicht erreichbar über Docker-Netzwerk -**Prüfung:** -```bash -docker-compose exec web curl http://wiki:8080/ -``` - -**Lösung:** -- Stelle sicher, dass beide Services im gleichen Docker-Netzwerk sind -- Prüfe `docker-compose.yml` - beide Services sollten dort definiert sein - -### 3. Environment-Variable falsch gesetzt -**Prüfung:** -```bash -docker-compose exec web printenv WIKI_SERVICE_URL -``` - -**Sollte sein:** `http://wiki:8080` - -**Lösung:** In `docker-compose.yml` hinzufügen: -```yaml -web: - environment: - - WIKI_SERVICE_URL=http://wiki:8080 -``` - -### 4. API-Route nicht deployed -**Prüfung:** -- Prüfe, ob `app/api/wiki/route.ts` im Deployment vorhanden ist -- Prüfe Next.js Build-Logs - -**Lösung:** -- Stelle sicher, dass die Datei committed ist -- Rebuild des Next.js Images: `docker-compose build web` - -### 5. Production Dockerfile verwendet -**Prüfung:** -```bash -# Prüfe, welches Dockerfile verwendet wird -cat docker-compose.yml | grep dockerfile -``` - -**Lösung:** -- Stelle sicher, dass in Produktion auch die richtige Dockerfile verwendet wird -- Oder passe die Production-Dockerfile an - -## Debugging-Schritte - -### Schritt 1: Services prüfen -```bash -docker-compose ps -``` -Sollte zeigen: -- `web` - Status: Up -- `wiki` - Status: Up - -### Schritt 2: Wiki-Service-Logs prüfen -```bash -docker-compose logs wiki --tail=50 -``` -Suche nach Fehlermeldungen oder "Build complete" - -### Schritt 3: API-Route direkt testen -```bash -curl https://doing-it.de/api/wiki/ -``` -Oder im Browser: `https://doing-it.de/api/wiki/` - -Sollte HTML zurückgeben, nicht 404. - -### Schritt 4: Internen Service-Zugriff testen -```bash -docker-compose exec web curl http://wiki:8080/ -``` -Sollte HTML zurückgeben. - -### Schritt 5: Next.js Logs prüfen -```bash -docker-compose logs web --tail=100 | grep -i wiki -``` -Suche nach Fehlermeldungen wie "Wiki proxy error" - -## Quick Fix - -Falls das Problem weiterhin besteht, versuche: - -```bash -# 1. Alle Services neu starten -docker-compose down -docker-compose up -d --build - -# 2. Logs beobachten -docker-compose logs -f - -# 3. Prüfen ob beide Services laufen -docker-compose ps -``` - -## Wichtig für Produktion - -1. **Stelle sicher, dass beide Services im docker-compose.yml sind** -2. **Stelle sicher, dass WIKI_SERVICE_URL gesetzt ist** -3. **Stelle sicher, dass die API-Routes im Build enthalten sind** -4. **Prüfe die Next.js Build-Logs auf Warnungen** - -## Alternative: Direkter Link (Fallback) - -Falls das iframe weiterhin Probleme macht, kann die Wiki-Seite so geändert werden, dass sie direkt auf `/api/wiki` verlinkt statt ein iframe zu verwenden. Dies erfordert eine Änderung in `app/wiki/page.tsx`. - -## Nächste Schritte nach Deployment - -1. ✅ API-Routes aktualisiert -2. ✅ Error-Handling verbessert -3. ⏳ Services neu starten -4. ⏳ Logs prüfen -5. ⏳ Testen auf https://doing-it.de/wiki - diff --git a/WIKI-EXTERNAL-SETUP.md b/WIKI-EXTERNAL-SETUP.md deleted file mode 100755 index 674d262..0000000 --- a/WIKI-EXTERNAL-SETUP.md +++ /dev/null @@ -1,120 +0,0 @@ -# Wiki Externe Instanz Setup - -## Übersicht - -Das Wiki läuft jetzt als separate Instanz auf Port 3033 und wird direkt im iframe eingebunden. Dies erfordert keine Docker-Compose-Integration mehr. - -## Konfiguration - -### Umgebungsvariable - -Die Wiki-URL kann über die Umgebungsvariable `NEXT_PUBLIC_WIKI_URL` konfiguriert werden: - -**Standard:** `http://localhost:3033` - -### Lokale Entwicklung - -In der lokalen Entwicklung wird automatisch `http://localhost:3033` verwendet. - -### Produktion - -Für die Produktion kann die URL in `docker-compose.yml` oder über eine `.env`-Datei gesetzt werden: - -```yaml -environment: - - NEXT_PUBLIC_WIKI_URL=http://localhost:3033 -``` - -Oder in einer `.env.local` Datei: -``` -NEXT_PUBLIC_WIKI_URL=http://localhost:3033 -``` - -## Docker-Netzwerk Setup - -### Separate Quartz-Instanz auf dem Server - -1. **Quartz-Instanz starten** auf Port 3033: - ```bash - # Beispiel: Quartz auf Port 3033 starten - npx quartz build - npx serve -s public -l 3033 - ``` - -2. **Docker-Netzwerk verbinden** (optional): - ```bash - # Netzwerk erstellen - docker network create wiki-network - - # Quartz-Container an Netzwerk anhängen - docker network connect wiki-network your-quartz-container - - # Next.js Container an Netzwerk anhängen - docker network connect wiki-network doing-it-web-container - ``` - -3. **URL anpassen** falls nötig: - - Falls Quartz in einem Container läuft: `http://quartz-container-name:3033` - - Falls Quartz direkt auf dem Host läuft: `http://host.docker.internal:3033` (Docker Desktop) - - Falls Quartz extern läuft: `http://localhost:3033` oder absolute URL - -## Docker Compose Anpassung - -Der Wiki-Service in `docker-compose.yml` ist jetzt optional. Falls Sie die separate Instanz verwenden: - -1. **Wiki-Service auskommentieren** (bereits erledigt in `depends_on`) -2. Oder **Wiki-Service komplett entfernen** aus docker-compose.yml, falls nicht mehr benötigt - -### Optionale Wiki-Service Entfernung - -Falls Sie den Wiki-Service komplett aus docker-compose.yml entfernen möchten: - -```yaml -services: - web: - # ... bleibt gleich - # depends_on und WIKI_SERVICE_URL können entfernt werden - - # wiki: Service kann komplett entfernt werden -``` - -## Testing - -1. **Quartz-Instanz starten** auf Port 3033 -2. **Next.js starten**: - ```bash - docker-compose up -d web - ``` -3. **Wiki-Seite öffnen**: `http://localhost:3001/wiki` -4. **Prüfen**: iframe sollte das Wiki von `http://localhost:3033` laden - -## Vorteile - -✅ **Einfachere Wartung**: Quartz kann separat verwaltet werden -✅ **Unabhängige Skalierung**: Wiki und Website können unabhängig skaliert werden -✅ **Einfachere Updates**: Quartz kann ohne Neustart der Website aktualisiert werden -✅ **Flexibilität**: Wiki kann auch extern gehostet werden - -## Troubleshooting - -### Problem: iframe lädt nicht - -**Lösung 1:** Prüfen ob Quartz auf Port 3033 läuft -```bash -curl http://localhost:3033 -``` - -**Lösung 2:** CORS-Header prüfen -- Quartz sollte CORS-Header erlauben -- Oder Next.js als Proxy verwenden (alte Lösung) - -**Lösung 3:** URL anpassen -- Prüfen ob `NEXT_PUBLIC_WIKI_URL` korrekt gesetzt ist -- Für Container: `host.docker.internal:3033` verwenden - -### Problem: Wiki nicht erreichbar aus Container - -**Lösung:** -- `host.docker.internal:3033` statt `localhost:3033` verwenden -- Oder Docker-Netzwerk verwenden - diff --git a/WIKI-FIX.md b/WIKI-FIX.md deleted file mode 100755 index cebdde5..0000000 --- a/WIKI-FIX.md +++ /dev/null @@ -1,81 +0,0 @@ -# Wiki 404 Error - Fix Dokumentation - -## Problem - -Beim Klick auf den Wiki-Link in der Navbar erscheint ein 404-Fehler auf https://doing-it.de/wiki - -## Mögliche Ursachen - -1. **API-Route nicht gefunden**: Die API-Route `/api/wiki/*` wird möglicherweise nicht korrekt deployed -2. **Wiki-Service nicht erreichbar**: Der Wiki-Service läuft möglicherweise nicht oder ist nicht über das Docker-Netzwerk erreichbar -3. **Next.js 14/15 Route-Handling**: Probleme mit async params in Next.js 14+ - -## Implementierte Fixes - -### 1. Root-Route für `/api/wiki` hinzugefügt -- Neue Datei: `app/api/wiki/route.ts` -- Behandelt direkte Aufrufe zu `/api/wiki` ohne Pfad - -### 2. Verbessertes Error-Handling -- Bessere Fehlermeldungen in den API-Routes -- Logging für Debugging -- Fehleranzeige in der Wiki-Seite, falls das Wiki nicht lädt - -### 3. Next.js 15 Compatibility -- Async params in Catch-All-Route -- Verbesserte Type-Definitionen - -### 4. Trailing Slash -- Wiki-URL verwendet jetzt `/api/wiki/` mit trailing slash - -## Debugging-Schritte - -### 1. Prüfen ob Wiki-Service läuft -```bash -docker-compose ps -docker-compose logs wiki -``` - -### 2. Prüfen ob API-Route erreichbar ist -Direkt im Browser oder mit curl: -```bash -curl https://doing-it.de/api/wiki/ -``` - -### 3. Prüfen ob Wiki-Service intern erreichbar ist -```bash -docker-compose exec web curl http://wiki:8080/ -``` - -### 4. Environment-Variable prüfen -Stelle sicher, dass `WIKI_SERVICE_URL` korrekt gesetzt ist: -```bash -docker-compose exec web printenv WIKI_SERVICE_URL -``` - -## Alternative Lösung: Next.js Rewrite - -Falls die API-Route weiterhin Probleme macht, kann ein Next.js Rewrite verwendet werden: - -```javascript -// next.config.js -async rewrites() { - return [ - { - source: '/api/wiki/:path*', - destination: 'http://wiki:8080/:path*', - }, - ] -} -``` - -Dies funktioniert nur server-side und ist möglicherweise zuverlässiger. - -## Nächste Schritte - -1. ✅ Root-Route hinzugefügt -2. ✅ Error-Handling verbessert -3. ✅ Next.js 15 Compatibility -4. ⏳ Testing in Produktion -5. ⏳ Bei Bedarf: Rewrite statt API-Route verwenden - diff --git a/WIKI-PROXY-SETUP.md b/WIKI-PROXY-SETUP.md deleted file mode 100755 index 78db1cf..0000000 --- a/WIKI-PROXY-SETUP.md +++ /dev/null @@ -1,119 +0,0 @@ -# Wiki Proxy Setup - Dokumentation - -## Übersicht - -Das Wiki ist jetzt so konfiguriert, dass es über die Domain `doing-it.de/wiki` erreichbar ist, ohne dass Port 8080 nach außen exponiert werden muss. Dies wird durch einen Next.js API-Route-Proxy erreicht. - -## Architektur - -``` -Browser → doing-it.de/wiki → Next.js (/wiki page) → iframe → /api/wiki/* → Wiki-Service (intern) -``` - -1. **Browser** greift auf `doing-it.de/wiki` zu -2. **Next.js Wiki-Seite** (`app/wiki/page.tsx`) zeigt das Wiki als iframe -3. **iframe** lädt `/api/wiki/*` (Next.js API-Route) -4. **API-Route** (`app/api/wiki/[...path]/route.ts`) leitet Requests an den internen Wiki-Service weiter -5. **Wiki-Service** läuft nur im Docker-Netzwerk, Port 8080 ist nicht nach außen exponiert - -## Änderungen - -### 1. Docker Compose (`docker-compose.yml`) -- Wiki-Service verwendet jetzt `expose` statt `ports` -- Port 8080 ist nur im Docker-Netzwerk erreichbar, nicht von außen -- Kommunikation zwischen Services erfolgt über Service-Namen (`wiki:8080`) - -### 2. Next.js API-Route (`app/api/wiki/[...path]/route.ts`) -- Proxied alle Requests an den Wiki-Service -- Unterstützt alle HTTP-Methoden (GET, POST, PUT, DELETE) -- Weiterleitung von Headers und Query-Parametern - -### 3. Wiki-Seite (`app/wiki/page.tsx`) -- Zeigt das Wiki als iframe -- Lädt über `/api/wiki` (API-Route) -- Enthält Navigation zurück zur Website - -### 4. Navigation -- Link zu `/wiki` wurde bereits hinzugefügt -- Führt direkt zur Wiki-Seite mit eingebettetem Wiki - -## Vorteile - -✅ **Sicherheit**: Port 8080 ist nicht nach außen exponiert -✅ **Einheitliche Domain**: Alles über `doing-it.de` -✅ **Einfache Integration**: Wiki ist nahtlos in die Website eingebettet -✅ **Proxy-Funktionalität**: Alle Wiki-Ressourcen (CSS, JS, Bilder) werden korrekt weitergeleitet - -## Konfiguration - -### Environment Variables - -Die API-Route verwendet die Umgebungsvariable `WIKI_SERVICE_URL`: -- **Standard**: `http://wiki:8080` (Docker-Service-Name) -- **Anpassung**: Kann in `docker-compose.yml` gesetzt werden - -### Docker Compose - -```yaml -wiki: - expose: - - "8080" # Nur intern, nicht nach außen -``` - -Die Services kommunizieren automatisch über das Docker-Netzwerk. - -## Testing - -### Lokales Testen - -1. Services starten: -```powershell -docker-compose up -d -``` - -2. Wiki-Seite öffnen: -``` -http://localhost:3001/wiki -``` - -3. API-Route direkt testen: -``` -http://localhost:3001/api/wiki -``` - -### Produktion - -Nach dem Deployment hinter einem Reverse Proxy (z.B. Nginx): -- Wiki ist erreichbar über `https://doing-it.de/wiki` -- Kein direkter Zugriff auf Port 8080 erforderlich -- Alle Requests gehen über die Next.js-Anwendung - -## Troubleshooting - -### Problem: Wiki lädt nicht im iframe - -**Lösung**: -- Prüfen Sie die Browser-Konsole auf Fehler -- Überprüfen Sie, ob der Wiki-Service läuft: `docker-compose ps` -- Prüfen Sie die API-Route-Logs: `docker-compose logs web` - -### Problem: CORS-Fehler - -**Lösung**: -- Die API-Route setzt bereits `Access-Control-Allow-Origin: *` -- Falls weitere CORS-Header benötigt werden, in `route.ts` hinzufügen - -### Problem: Wiki-Service nicht erreichbar - -**Lösung**: -- Überprüfen Sie, ob beide Services im gleichen Docker-Netzwerk sind -- Prüfen Sie die Service-Namen in `docker-compose.yml` -- Testen Sie die interne Kommunikation: `docker-compose exec web ping wiki` - -## Nächste Schritte - -1. ✅ Wiki über Proxy erreichbar -2. ✅ Port 8080 nicht mehr exponiert -3. ✅ Einheitliche Domain (`doing-it.de/wiki`) -4. Optional: Reverse Proxy (Nginx/Traefik) für HTTPS und Domain-Routing konfigurieren - diff --git a/WIKI-SETUP.md b/WIKI-SETUP.md deleted file mode 100755 index 820979b..0000000 --- a/WIKI-SETUP.md +++ /dev/null @@ -1,147 +0,0 @@ -# Wiki Setup mit Obsidian Quartz - -## Übersicht - -Das Wiki wurde erfolgreich in die doing-it.de Website integriert. Es verwendet Obsidian Quartz als statischen Site-Generator und läuft als Docker-Container. - -## Struktur - -``` -doing-it.de/ -├── wiki-vault/ # Obsidian Vault mit Markdown-Dateien -│ ├── Home.md -│ ├── IT-Grundlagen.md -│ ├── Schulungsmethoden.md -│ └── Ressourcen.md -├── quartz-setup/ # Quartz Docker Setup -│ ├── Dockerfile -│ ├── entrypoint.sh -│ ├── package.json -│ └── quartz.config.ts -├── app/wiki/ # Next.js Wiki-Seite -│ └── page.tsx -└── docker-compose.yml # Erweitert um Wiki-Service -``` - -## Was wurde implementiert - -### 1. Obsidian Vault (`wiki-vault/`) -- Enthält Beispiel-Markdown-Dateien -- Kann durch eigene Obsidian-Vault-Dateien ersetzt werden - -### 2. Quartz Docker Setup (`quartz-setup/`) -- Dockerfile: Klont Quartz Repository und richtet es ein -- entrypoint.sh: Baut die Quartz-Site und startet den Server -- Fallback: Erstellt einfache statische Site, falls Quartz-Build fehlschlägt - -### 3. Docker Compose Service -- Service `wiki` läuft auf Port 8080 -- Bindet `wiki-vault` als Volume ein -- Build-Output in `quartz-setup/public` - -### 4. Next.js Integration -- Neue Seite unter `/wiki` -- Wiki-Link in Navigation (Desktop & Mobile) -- Link zur Quartz-Instanz auf Port 8080 - -## Testing & Debugging in PowerShell - -### 1. Docker Compose Validierung -```powershell -docker-compose config -``` - -### 2. Wiki-Service bauen -```powershell -docker-compose build wiki -``` - -### 3. Alle Services starten -```powershell -docker-compose up -d -``` - -### 4. Logs prüfen -```powershell -# Alle Logs -docker-compose logs - -# Nur Wiki-Logs -docker-compose logs wiki - -# Follow Logs (Live) -docker-compose logs -f wiki -``` - -### 5. Container-Status prüfen -```powershell -docker-compose ps -docker ps -a -``` - -### 6. In Container einsteigen (falls nötig) -```powershell -docker-compose exec wiki sh -``` - -### 7. Services stoppen -```powershell -docker-compose down -``` - -### 8. Alles neu bauen -```powershell -docker-compose down -docker-compose build --no-cache -docker-compose up -d -``` - -## Erwartete Ports - -- **Next.js Web**: http://localhost:3001 -- **Wiki (Quartz)**: http://localhost:8080 - -## Häufige Probleme - -### Problem: Quartz Build schlägt fehl -**Lösung**: Der Entrypoint-Script erstellt automatisch einen Fallback mit einfacher HTML-Seite. Die Markdown-Dateien werden trotzdem angezeigt. - -### Problem: Port 8080 bereits belegt -**Lösung**: Port in `docker-compose.yml` ändern: -```yaml -ports: - - "8081:8080" # Ändere 8081 zu gewünschtem Port -``` - -### Problem: Container startet nicht -**Lösung**: -1. Logs prüfen: `docker-compose logs wiki` -2. Container neu bauen: `docker-compose build --no-cache wiki` -3. Container-Status: `docker ps -a` - -### Problem: Keine Inhalte im Wiki -**Lösung**: -1. Prüfen ob `wiki-vault` Dateien enthält -2. Volume-Mount prüfen: `docker-compose exec wiki ls -la /app/content` -3. Container neu starten: `docker-compose restart wiki` - -## Wiki-Inhalte aktualisieren - -1. Markdown-Dateien in `wiki-vault/` bearbeiten oder hinzufügen -2. Container neu starten: `docker-compose restart wiki` -3. Oder für kompletten Rebuild: `docker-compose up -d --build wiki` - -## Navigation - -Der Wiki-Link wurde zur Navigation hinzugefügt: -- Desktop: Zwischen "Über uns" und "Kontakt" -- Mobile: Im Hamburger-Menü - -Die Wiki-Seite (`/wiki`) zeigt einen Link zur Quartz-Instanz, der in einem neuen Tab geöffnet wird. - -## Nächste Schritte - -1. Eigene Obsidian-Vault-Dateien in `wiki-vault/` kopieren -2. Quartz-Konfiguration in `quartz-setup/quartz.config.ts` anpassen -3. Wiki-Styling an Website-Design anpassen (falls gewünscht) - diff --git a/app/api/wiki/[...path]/route.ts b/app/api/wiki/[...path]/route.ts deleted file mode 100755 index 2402e6d..0000000 --- a/app/api/wiki/[...path]/route.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { NextRequest, NextResponse } from 'next/server' - -const WIKI_SERVICE_URL = process.env.WIKI_SERVICE_URL || 'http://wiki:8080' - -export async function GET( - request: NextRequest, - { params }: { params: Promise<{ path?: string[] }> } -) { - try { - const resolvedParams = await params - const path = resolvedParams.path || [] - const searchParams = request.nextUrl.searchParams.toString() - const queryString = searchParams ? `?${searchParams}` : '' - const wikiPath = path.length > 0 ? `/${path.join('/')}` : '/' - - // Ensure no double slashes - const baseUrl = WIKI_SERVICE_URL.endsWith('/') ? WIKI_SERVICE_URL.slice(0, -1) : WIKI_SERVICE_URL - const wikiUrl = `${baseUrl}${wikiPath}${queryString}` - - console.log(`[Wiki Proxy] Fetching: ${wikiUrl}`) - - const response = await fetch(wikiUrl, { - headers: { - 'User-Agent': request.headers.get('user-agent') || 'Next.js', - }, - // Add timeout - signal: AbortSignal.timeout(10000), // 10 second timeout - }) - - if (!response.ok) { - console.error(`Wiki service returned ${response.status}: ${response.statusText} for ${wikiUrl}`) - return new NextResponse(`Wiki not found: ${response.status} ${response.statusText}`, { - status: response.status - }) - } - - const contentType = response.headers.get('content-type') || 'text/html' - const content = await response.text() - - // Pass through headers - const headers = new Headers() - headers.set('Content-Type', contentType) - - // Handle CORS if needed - headers.set('Access-Control-Allow-Origin', '*') - - // Preserve cache headers - const cacheControl = response.headers.get('cache-control') - if (cacheControl) { - headers.set('Cache-Control', cacheControl) - } - - return new NextResponse(content, { - status: response.status, - headers, - }) - } catch (error: any) { - console.error('Wiki proxy error:', error) - return new NextResponse(`Error loading wiki: ${error.message || 'Unknown error'}`, { - status: 500 - }) - } -} - -// Handle other HTTP methods -export async function POST(request: NextRequest, { params }: { params: Promise<{ path?: string[] }> }) { - return GET(request, { params }) -} - -export async function PUT(request: NextRequest, { params }: { params: Promise<{ path?: string[] }> }) { - return GET(request, { params }) -} - -export async function DELETE(request: NextRequest, { params }: { params: Promise<{ path?: string[] }> }) { - return GET(request, { params }) -} - diff --git a/app/api/wiki/route.ts b/app/api/wiki/route.ts deleted file mode 100755 index 73fbd37..0000000 --- a/app/api/wiki/route.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { NextRequest, NextResponse } from 'next/server' - -const WIKI_SERVICE_URL = process.env.WIKI_SERVICE_URL || 'http://wiki:8080' - -export async function GET(request: NextRequest) { - try { - const searchParams = request.nextUrl.searchParams.toString() - const queryString = searchParams ? `?${searchParams}` : '' - // Ensure no double slashes - const baseUrl = WIKI_SERVICE_URL.endsWith('/') ? WIKI_SERVICE_URL.slice(0, -1) : WIKI_SERVICE_URL - const wikiUrl = `${baseUrl}/${queryString}` - - console.log(`[Wiki Proxy] Fetching: ${wikiUrl}`) - - const response = await fetch(wikiUrl, { - headers: { - 'User-Agent': request.headers.get('user-agent') || 'Next.js', - }, - // Add timeout - signal: AbortSignal.timeout(10000), // 10 second timeout - }) - - if (!response.ok) { - console.error(`Wiki service returned ${response.status}: ${response.statusText}`) - return new NextResponse(`Wiki service error: ${response.status} ${response.statusText}`, { - status: response.status - }) - } - - const contentType = response.headers.get('content-type') || 'text/html' - const content = await response.text() - - // Pass through headers - const headers = new Headers() - headers.set('Content-Type', contentType) - - // Handle CORS if needed - headers.set('Access-Control-Allow-Origin', '*') - - // Preserve cache headers - const cacheControl = response.headers.get('cache-control') - if (cacheControl) { - headers.set('Cache-Control', cacheControl) - } - - return new NextResponse(content, { - status: response.status, - headers, - }) - } catch (error: any) { - console.error('Wiki proxy error:', error) - return new NextResponse(`Error loading wiki: ${error.message || 'Unknown error'}`, { - status: 500 - }) - } -} - -// Handle other HTTP methods -export async function POST(request: NextRequest) { - return GET(request) -} - -export async function PUT(request: NextRequest) { - return GET(request) -} - -export async function DELETE(request: NextRequest) { - return GET(request) -} - diff --git a/app/wiki/page.tsx b/app/wiki/page.tsx index 247b71d..481d6f4 100755 --- a/app/wiki/page.tsx +++ b/app/wiki/page.tsx @@ -1,204 +1,26 @@ -'use client' - -import { motion } from 'framer-motion' -import Navigation from '@/components/Navigation' -import Footer from '@/components/Footer' -import { useState, useEffect } from 'react' - -export default function Wiki() { - const [showFullPage, setShowFullPage] = useState(true) - const [iframeError, setIframeError] = useState(false) - - // Wiki URL - konfigurierbar über Umgebungsvariable, Standard: localhost:3033 - const wikiUrl = process.env.NEXT_PUBLIC_WIKI_URL || 'http://localhost:3033' - - useEffect(() => { - // Reset error when URL changes - setIframeError(false) - }, [wikiUrl]) - - if (showFullPage) { - // Vollständige Wiki-Seite als iframe - return ( - <> - -
-
-

doing-it Wiki

- -
- {iframeError ? ( -
-

- Wiki konnte nicht geladen werden -

-

- Bitte versuchen Sie es später erneut oder kontaktieren Sie den Support. -

- -
- ) : ( -