added quartz external wiki
This commit is contained in:
110
DEPLOYMENT-CHECKLIST.md
Executable file
110
DEPLOYMENT-CHECKLIST.md
Executable file
@@ -0,0 +1,110 @@
|
||||
# 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
|
||||
|
||||
127
QUARTZ-SETUP-SERVER.md
Executable file
127
QUARTZ-SETUP-SERVER.md
Executable file
@@ -0,0 +1,127 @@
|
||||
# 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
|
||||
|
||||
159
WIKI-404-FIX.md
Executable file
159
WIKI-404-FIX.md
Executable file
@@ -0,0 +1,159 @@
|
||||
# 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
|
||||
|
||||
120
WIKI-EXTERNAL-SETUP.md
Executable file
120
WIKI-EXTERNAL-SETUP.md
Executable file
@@ -0,0 +1,120 @@
|
||||
# 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
|
||||
|
||||
81
WIKI-FIX.md
Executable file
81
WIKI-FIX.md
Executable file
@@ -0,0 +1,81 @@
|
||||
# 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
|
||||
|
||||
@@ -4,24 +4,34 @@ const WIKI_SERVICE_URL = process.env.WIKI_SERVICE_URL || 'http://wiki:8080'
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { path: string[] } }
|
||||
{ params }: { params: Promise<{ path?: string[] }> }
|
||||
) {
|
||||
try {
|
||||
const path = params.path || []
|
||||
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('/')}` : '/'
|
||||
|
||||
const wikiUrl = `${WIKI_SERVICE_URL}${wikiPath}${queryString}`
|
||||
// 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) {
|
||||
return new NextResponse('Wiki not found', { status: response.status })
|
||||
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'
|
||||
@@ -44,22 +54,24 @@ export async function GET(
|
||||
status: response.status,
|
||||
headers,
|
||||
})
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error('Wiki proxy error:', error)
|
||||
return new NextResponse('Error loading wiki', { status: 500 })
|
||||
return new NextResponse(`Error loading wiki: ${error.message || 'Unknown error'}`, {
|
||||
status: 500
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Handle other HTTP methods
|
||||
export async function POST(request: NextRequest, { params }: { params: { path: string[] } }) {
|
||||
export async function POST(request: NextRequest, { params }: { params: Promise<{ path?: string[] }> }) {
|
||||
return GET(request, { params })
|
||||
}
|
||||
|
||||
export async function PUT(request: NextRequest, { params }: { params: { path: string[] } }) {
|
||||
export async function PUT(request: NextRequest, { params }: { params: Promise<{ path?: string[] }> }) {
|
||||
return GET(request, { params })
|
||||
}
|
||||
|
||||
export async function DELETE(request: NextRequest, { params }: { params: { path: string[] } }) {
|
||||
export async function DELETE(request: NextRequest, { params }: { params: Promise<{ path?: string[] }> }) {
|
||||
return GET(request, { params })
|
||||
}
|
||||
|
||||
|
||||
70
app/api/wiki/route.ts
Executable file
70
app/api/wiki/route.ts
Executable file
@@ -0,0 +1,70 @@
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -3,13 +3,19 @@
|
||||
import { motion } from 'framer-motion'
|
||||
import Navigation from '@/components/Navigation'
|
||||
import Footer from '@/components/Footer'
|
||||
import { useState } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
|
||||
export default function Wiki() {
|
||||
const [showFullPage, setShowFullPage] = useState(true)
|
||||
const [iframeError, setIframeError] = useState(false)
|
||||
|
||||
// Wiki URL über den Next.js API Proxy
|
||||
const wikiUrl = '/api/wiki'
|
||||
// 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
|
||||
@@ -39,6 +45,34 @@ export default function Wiki() {
|
||||
Zur Übersicht
|
||||
</button>
|
||||
</div>
|
||||
{iframeError ? (
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: '100%',
|
||||
padding: '40px',
|
||||
marginTop: '50px',
|
||||
textAlign: 'center'
|
||||
}}>
|
||||
<h2 style={{ fontSize: '24px', fontWeight: '600', marginBottom: '20px' }}>
|
||||
Wiki konnte nicht geladen werden
|
||||
</h2>
|
||||
<p style={{ color: 'var(--color-text-secondary)', marginBottom: '30px' }}>
|
||||
Bitte versuchen Sie es später erneut oder kontaktieren Sie den Support.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => {
|
||||
setIframeError(false)
|
||||
window.location.reload()
|
||||
}}
|
||||
className="btn btn-primary"
|
||||
>
|
||||
Seite neu laden
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<iframe
|
||||
src={wikiUrl}
|
||||
style={{
|
||||
@@ -49,7 +83,21 @@ export default function Wiki() {
|
||||
background: '#fff'
|
||||
}}
|
||||
title="doing-it Wiki"
|
||||
onError={() => setIframeError(true)}
|
||||
onLoad={(e) => {
|
||||
// Check if iframe loaded successfully
|
||||
try {
|
||||
const iframe = e.target as HTMLIFrameElement
|
||||
if (iframe.contentDocument?.location.href === 'about:blank') {
|
||||
// Iframe might have error
|
||||
setTimeout(() => setIframeError(true), 3000)
|
||||
}
|
||||
} catch (err) {
|
||||
// Cross-origin - can't check, assume it's working
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</main>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -7,11 +7,17 @@ services:
|
||||
- "3001:3000"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
# Wiki URL - kann über .env oder Umgebungsvariable gesetzt werden
|
||||
# Standard: http://localhost:3033 (für separate Quartz-Instanz)
|
||||
- NEXT_PUBLIC_WIKI_URL=${NEXT_PUBLIC_WIKI_URL:-http://localhost:3033}
|
||||
volumes:
|
||||
- .:/app
|
||||
- /app/node_modules
|
||||
- /app/.next
|
||||
restart: unless-stopped
|
||||
# Wiki-Service ist optional - kann entfernt werden, wenn separate Instanz verwendet wird
|
||||
# depends_on:
|
||||
# - wiki
|
||||
|
||||
wiki:
|
||||
build:
|
||||
|
||||
@@ -24,14 +24,43 @@ cp -r /app/content/* /app/quartz-repo/content/ 2>/dev/null || true
|
||||
echo "Building Quartz site..."
|
||||
cd /app/quartz-repo
|
||||
|
||||
# Build the site with default Quartz setup
|
||||
npx quartz build 2>&1 || {
|
||||
echo "Default Quartz build failed, trying alternative method..."
|
||||
# Try building with explicit paths
|
||||
npx quartz build --contentDir ./content --outputDir /app/public 2>&1 || {
|
||||
echo "Default build also failed, creating fallback static site..."
|
||||
# Check if Quartz CLI exists and try different methods
|
||||
QUARTZ_CLI="/app/quartz-repo/node_modules/@jackyzha0/quartz/cli/index.js"
|
||||
QUARTZ_BUILD_SUCCESS=false
|
||||
|
||||
# Create fallback static site
|
||||
# Method 1: Direct node call to Quartz CLI (avoids npx BusyBox issue)
|
||||
if [ -f "$QUARTZ_CLI" ]; then
|
||||
echo "Trying direct node call to Quartz CLI..."
|
||||
if node "$QUARTZ_CLI" build --contentDir ./content --outputDir /app/public 2>&1; then
|
||||
QUARTZ_BUILD_SUCCESS=true
|
||||
echo "Quartz build successful!"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Method 2: Try using npm run script
|
||||
if [ "$QUARTZ_BUILD_SUCCESS" = false ] && [ -f "package.json" ]; then
|
||||
echo "Trying npm run build..."
|
||||
if npm run build 2>&1; then
|
||||
QUARTZ_BUILD_SUCCESS=true
|
||||
echo "Quartz build successful via npm!"
|
||||
# Copy output if it went to default location
|
||||
if [ -d "./public" ] && [ -n "$(ls -A ./public 2>/dev/null)" ]; then
|
||||
cp -r ./public/* /app/public/ 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# If Quartz build succeeded, copy output
|
||||
if [ "$QUARTZ_BUILD_SUCCESS" = true ]; then
|
||||
if [ -d "/app/quartz-repo/public" ] && [ -n "$(ls -A /app/quartz-repo/public 2>/dev/null)" ]; then
|
||||
echo "Copying Quartz output to public directory..."
|
||||
cp -r /app/quartz-repo/public/* /app/public/ 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
# If build failed, create fallback static site
|
||||
if [ "$QUARTZ_BUILD_SUCCESS" = false ]; then
|
||||
echo "Quartz build failed, creating fallback static site..."
|
||||
mkdir -p /app/public
|
||||
cd /app/content
|
||||
|
||||
@@ -94,12 +123,6 @@ npx quartz build 2>&1 || {
|
||||
color: #d4d4d4;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.content-preview {
|
||||
background: #1c1c1e;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -111,11 +134,15 @@ npx quartz build 2>&1 || {
|
||||
EOFHTML
|
||||
|
||||
# Find all markdown files and create links
|
||||
if [ -n "$(find /app/content -name "*.md" -type f 2>/dev/null)" ]; then
|
||||
find /app/content -name "*.md" -type f | while read file; do
|
||||
title=$(basename "$file" .md)
|
||||
relative_path=$(echo "$file" | sed "s|/app/content/||")
|
||||
echo " <li><a href=\"/$relative_path\">$title</a></li>" >> /app/public/index.html
|
||||
done
|
||||
else
|
||||
echo " <li><em>Keine Inhalte gefunden</em></li>" >> /app/public/index.html
|
||||
fi
|
||||
|
||||
echo " </ul>" >> /app/public/index.html
|
||||
echo " </div>" >> /app/public/index.html
|
||||
@@ -124,13 +151,6 @@ EOFHTML
|
||||
|
||||
# Copy markdown files to public
|
||||
cp -r /app/content/* /app/public/ 2>/dev/null || true
|
||||
}
|
||||
}
|
||||
|
||||
# If Quartz build succeeded, check if public directory exists
|
||||
if [ -d "/app/quartz-repo/public" ] && [ -n "$(ls -A /app/quartz-repo/public 2>/dev/null)" ]; then
|
||||
echo "Copying Quartz output to public directory..."
|
||||
cp -r /app/quartz-repo/public/* /app/public/ 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Ensure public directory exists
|
||||
|
||||
2
quartz-setup/public/Doing IT!.md
Executable file
2
quartz-setup/public/Doing IT!.md
Executable file
@@ -0,0 +1,2 @@
|
||||
|
||||
This Knowledge Database is about to get greatly organized and will grow soon for you!
|
||||
5
quartz-setup/public/Test Note linked.md
Executable file
5
quartz-setup/public/Test Note linked.md
Executable file
@@ -0,0 +1,5 @@
|
||||
|
||||
this note is linked to a test note :D
|
||||
|
||||
[[Welcome]]
|
||||
|
||||
5
quartz-setup/public/Welcome.md
Executable file
5
quartz-setup/public/Welcome.md
Executable file
@@ -0,0 +1,5 @@
|
||||
This is your new *vault*.
|
||||
|
||||
Make a note of something, [[create a link]], or try [the Importer](https://help.obsidian.md/Plugins/Importer)!
|
||||
|
||||
When you're ready, delete this note and make the vault your own.
|
||||
@@ -55,12 +55,6 @@
|
||||
color: #d4d4d4;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.content-preview {
|
||||
background: #1c1c1e;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -69,10 +63,13 @@
|
||||
<p class="intro">Willkommen im doing-it Wiki! Hier finden Sie nützliche Informationen rund um IT-Weiterbildung und Schulungen.</p>
|
||||
<h2>Inhalte</h2>
|
||||
<ul id="content-list">
|
||||
<li><a href="/Doing IT!.md">Doing IT!</a></li>
|
||||
<li><a href="/Home.md">Home</a></li>
|
||||
<li><a href="/IT-Grundlagen.md">IT-Grundlagen</a></li>
|
||||
<li><a href="/Ressourcen.md">Ressourcen</a></li>
|
||||
<li><a href="/Schulungsmethoden.md">Schulungsmethoden</a></li>
|
||||
<li><a href="/Test Note linked.md">Test Note linked</a></li>
|
||||
<li><a href="/Welcome.md">Welcome</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user