MkDocs Deployment to Cloudflare Pages
This project uses MkDocs with the Material for MkDocs theme to generate documentation that can be deployed to Cloudflare Pages.
Local Developmentβ
Prerequisitesβ
- Python 3.11+
- pip
Setupβ
# Install dependencies
pip install -r requirements.txt
# Serve locally
mkdocs serve
The documentation will be available at http://localhost:8000
Buildβ
# Build static site
mkdocs build
# Output will be in site/ directory
Cloudflare Pages Deploymentβ
Automatic Deployment (Recommended)β
-
Connect Repository to Cloudflare Pages
- Go to Cloudflare Pages dashboard
- Click "Create a project"
- Connect your GitHub repository
- Select the
axelites/logidavrepository
-
Configure Build Settings
- Framework preset: None (or Other)
- Build command:
mkdocs build - Build output directory:
site - Root directory:
/(leave empty or root) - Environment variables:
PYTHON_VERSION:3.11
-
Deploy
- Click "Save and Deploy"
- Cloudflare will automatically build and deploy on every push to the main branch
Build Configurationβ
The build uses:
- Python 3.11 (specified in
.python-version) - MkDocs with Material theme
- Dependencies from
requirements.txt
Build command installs dependencies automatically:
pip install -r requirements.txt
mkdocs build
Preview Deploymentsβ
Cloudflare Pages creates preview deployments for:
- Pull requests
- Non-production branches
Each preview gets a unique URL for testing before merging.
Documentation Structureβ
docs/
βββ index.md # Home page
βββ README.md # System overview
βββ system-crontab.md # Source crontab
βββ cronjobs/
β βββ index.md # Cronjobs overview
β βββ critical/ # Critical risk commands
β βββ high/ # High risk commands
β βββ all/ # Alphabetical listing
β βββ [115 cronjob docs] # Individual command docs
βββ meta/
β βββ documentation-progress.md
βββ stylesheets/
β βββ extra.css # Custom styles
βββ [other docs]
Configurationβ
mkdocs.ymlβ
Main configuration file defining:
- Site metadata
- Theme (Material for MkDocs)
- Navigation structure
- Plugins and extensions
- Custom styling
Key Featuresβ
- Material Design theme with light/dark mode
- Search functionality
- Code syntax highlighting with copy button
- Mermaid diagrams support
- Responsive design
- Navigation tabs for main sections
- Table of contents tracking
Updating Documentationβ
Regenerate Cronjob Docsβ
# After crontab changes
python3 tools/cronjob_doc_generator.py
# Test locally
mkdocs serve
# Commit and push
git add docs/ mkdocs.yml
git commit -m "docs: update cronjobs"
git push
Cloudflare will automatically rebuild and redeploy.
Custom Pagesβ
- Create/edit markdown files in
docs/ - Update navigation in
mkdocs.ymlif needed - Test locally with
mkdocs serve - Commit and push
Troubleshootingβ
Build Fails on Cloudflareβ
- Check build logs in Cloudflare Pages dashboard
- Verify
requirements.txtis present - Ensure
PYTHON_VERSIONenvironment variable is set - Test build locally:
mkdocs build
Missing Dependenciesβ
# Install/update dependencies
pip install -r requirements.txt --upgrade
Navigation Issuesβ
- Check
mkdocs.ymlnav section - Ensure all referenced files exist
- Verify file paths are relative to
docs/
Resourcesβ
Site URLβ
Once deployed, the documentation will be available at:
- Production:
https://docs-logidav.pages.dev(or custom domain) - Preview:
https://[hash].docs-logidav.pages.dev