MkDocs Deployment auf Cloudflare Pages
⚡️ Schnellstart - Manuelles Deployment
Voraussetzungen
Deployment
# 1. Build static site
python3 -m mkdocs build --strict
# 2. Deploy to Cloudflare Pages
npx wrangler pages deploy site --project-name=solarlog-docs
# Fertig! URL: https://solarlog-docs.pages.dev
🚀 Automatisches Deployment (GitHub Actions)
Option 1: Cloudflare Pages Dashboard (Empfohlen)
-
Push Code zu GitHub
-
Cloudflare Pages Setup
- Gehe zu: https://dash.cloudflare.com/pages
- Klicke "Create a project"
- Wähle "Connect to Git"
-
Wähle dein Repository
-
Build Konfiguration
-
Environment Variables (optional)
-
Keine erforderlich
-
Deploy!
- Jeder Push zu
maintriggert automatisch einen neuen Build - URL:
https://solarlog-docs.pages.dev
Option 2: GitHub Actions Workflow
Siehe .github/workflows/deploy-docs.yml für automatisches Deployment bei jedem Push.
🌐 Custom Domain Setup
Cloudflare Pages Domain hinzufügen
- In Cloudflare Pages Dashboard
- Gehe zu deinem Project → Settings → Custom domains
-
Klicke "Add a custom domain"
-
Domain konfigurieren
-
DNS automatisch konfiguriert
- Cloudflare erstellt automatisch CNAME Record
- SSL/TLS automatisch aktiviert
-
CDN automatisch aktiviert
-
Fertig!
- URL:
https://docs.karma.organic - Automatische HTTPS
- Weltweit auf 300+ Edge-Servern
📝 Frontend Links aktualisieren
Nach Deployment die Links in der React App aktualisieren:
frontend-web/src/components/AppBar.tsx:
// Vorher:
href="http://localhost:8001"
// Nachher:
href="https://docs.karma.organic"
// oder
href="https://solarlog-docs.pages.dev"
frontend-web/src/components/About.tsx:
🔄 Lokale Entwicklung
# Serve docs lokal (mit Live-Reload)
python3 -m mkdocs serve --dev-addr 127.0.0.1:8001
# Build und Preview
python3 -m mkdocs build --strict
cd site && python3 -m http.server 8002
📊 Deployment-Status
Produktions-URL
- Custom Domain: https://docs.karma.organic (nach Setup)
- Pages.dev URL: https://solarlog-docs.pages.dev
Build-Status
- Letzte Änderung: Automatisch bei Git Push
- Build-Zeit: ~30 Sekunden
- Deploy-Zeit: ~10 Sekunden
Features
✅ Automatische Deployments (Git Push) ✅ Instant Rollbacks ✅ Branch Previews ✅ Analytics (optional) ✅ Web Analytics (optional) ✅ Global CDN ✅ Kostenlos (Unlimited Requests)
🛠️ Troubleshooting
Build Failed
# Lokal testen
python3 -m mkdocs build --strict --verbose
# Dependencies prüfen
python3 -m pip list | grep mkdocs
Links funktionieren nicht
- Stelle sicher, dass
site_urlinmkdocs.ymlkorrekt ist - Bei Custom Domain:
site_url: https://docs.karma.organic - Bei Pages.dev:
site_url: https://solarlog-docs.pages.dev
404 Fehler
- Prüfe
build output directory: sitein Cloudflare Pages - Prüfe dass
mkdocs.ymlim Root-Verzeichnis ist
💡 Best Practices
- Immer
--strictverwenden beim Build - Findet broken Links
-
Erzwingt valide Markdown
-
Site URL konfigurieren
-
Branch Previews nutzen
- Jeder Branch bekommt eigene Preview-URL
-
Teste Änderungen vor Merge
-
Analytics aktivieren (optional)
- Cloudflare Web Analytics
- Kostenlos, privacy-friendly
🎯 Nächste Schritte
- ✅ Statische Seiten generiert (
site/Ordner) - ⏳ Push zu GitHub
- ⏳ Cloudflare Pages Projekt erstellen
- ⏳ Custom Domain konfigurieren
- ⏳ Frontend Links aktualisieren
Bereit für Deployment! 🚀