Skip to content

☁️ Cloudflare Pages Setup Guide

This guide covers deploying the ArticDBM website and documentation to Cloudflare Pages.

🌐 Website Deployment (articdbm.penguintech.io)

Prerequisites

  • Cloudflare account
  • GitHub repository access
  • Custom domain configured in Cloudflare DNS

Step 1: Connect Repository

  1. Login to Cloudflare Pages
  2. Go to dash.cloudflare.com
  3. Navigate to Pages in the sidebar
  4. Click Create a project

  5. Connect to Git

  6. Select Connect to Git
  7. Choose GitHub and authorize Cloudflare
  8. Select your articdbm/articdbm repository
  9. Choose the main branch (or v0.1 if using feature branch)

Step 2: Configure Build Settings

Framework preset: None (Static HTML)
Build command: npm install && npm run build
Build output directory: website/dist
Root directory: (leave empty - use repository root)

Step 3: Environment Variables

No environment variables are required for the static website.

Step 4: Deploy Settings

Production branch: main
Preview deployments: Enabled
Build system: V2 (recommended)
Node.js version: 18.x (not needed but good to set)

Step 5: Custom Domain

  1. Add Custom Domain
  2. In your Pages project, go to Custom domains
  3. Click Set up a custom domain
  4. Enter articdbm.penguintech.io

  5. DNS Configuration

    Type: CNAME
    Name: articdbm
    Target: your-project.pages.dev
    Proxy status: Proxied (orange cloud)
    

Security Headers

The website includes _headers file with security configurations:

/*
  X-Frame-Options: DENY
  X-Content-Type-Options: nosniff
  X-XSS-Protection: 1; mode=block
  Referrer-Policy: strict-origin-when-cross-origin
  Permissions-Policy: geolocation=(), microphone=(), camera=()
  Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'

URL Redirects

The _redirects file handles common redirects:

/docs/* https://github.com/penguintechinc/articdbm/blob/main/docs/:splat 301
/github https://github.com/penguintechinc/articdbm 301
/download https://github.com/penguintechinc/articdbm/archive/refs/heads/main.zip 301

📚 Documentation Site (docs.articdbm.penguintech.io)

The ArticDBM documentation is built with MkDocs Material and can be deployed to Cloudflare Pages for fast, global distribution.

MkDocs Material on Cloudflare Pages

Step 1: Create Documentation Pages Project

  1. New Pages Project
  2. Go to Cloudflare Pages dashboard
  3. Click Create a project
  4. Connect to the same articdbm/articdbm repository
  5. Use a different project name: articdbm-docs

  6. Build Configuration

    Framework preset: Other (or None)
    Build command: pip install -r requirements.txt && mkdocs build --strict
    Build output directory: site
    Root directory: (leave empty - uses repository root)
    Node.js version: Not needed (Python-based build)
    

Step 2: Python Runtime Configuration

The repository includes these files for proper Python environment:

  • requirements.txt - MkDocs and extensions:

    mkdocs>=1.5.0
    mkdocs-material>=9.4.0
    mkdocs-git-revision-date-localized-plugin>=1.2.0
    mkdocs-minify-plugin>=0.7.0
    pymdown-extensions>=10.3.0
    

  • runtime.txt - Python version:

    python-3.13
    

Step 3: Environment Variables

Set these in the Pages project settings:

PYTHON_VERSION: 3.13
MKDOCS_STRICT: true  # Optional: fail build on warnings

Step 4: Custom Domain Setup

  1. Add Custom Domain
  2. In the docs Pages project: Custom domains
  3. Add: docs.articdbm.penguintech.io

  4. DNS Configuration

    Type: CNAME
    Name: docs
    Target: articdbm-docs.pages.dev
    Proxy status: Proxied (orange cloud)
    TTL: Auto
    

Step 5: MkDocs Configuration

The mkdocs.yml includes Arctic theme colors and features:

theme:
  name: material
  palette:
    - media: "(prefers-color-scheme: light)"
      scheme: default
      primary: blue      # Arctic blue
      accent: cyan       # Ice blue
    - media: "(prefers-color-scheme: dark)"
      scheme: slate  
      primary: blue
      accent: cyan

nav:
  - Home: index.md
  - Getting Started:
    - Overview: ../README.md
    - Usage Guide: USAGE.md
  - Architecture:
    - System Design: architecture.md
  - Deployment:
    - Kubernetes: kubernetes.md
    - Cloudflare Setup: cloudflare-setup.md
  - Community:
    - Contributing: CONTRIBUTING.md

Features Enabled

  • Search: Full-text search across all documentation
  • Navigation: Tabbed navigation with auto-expand
  • Code Highlighting: Syntax highlighting for all languages
  • Mermaid Diagrams: Architecture diagrams support
  • Git Integration: Last modified dates from Git history
  • Responsive Design: Mobile-optimized layout
  • Dark Mode: Automatic theme switching

Option 2: GitHub Pages Integration

Alternatively, you can deploy MkDocs to GitHub Pages and use Cloudflare DNS:

  1. GitHub Actions Workflow (.github/workflows/docs.yml)

    name: Deploy Documentation
    on:
      push:
        branches: [main]
        paths: [docs/**, mkdocs.yml]
    
    jobs:
      deploy:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-python@v4
            with:
              python-version: 3.11
          - run: pip install mkdocs-material pymdown-extensions
          - run: mkdocs gh-deploy --force
    

  2. Cloudflare DNS

    Type: CNAME  
    Name: docs
    Target: articdbm.github.io
    Proxy status: Proxied
    

🎨 Customization

Website Theme Colors

The Arctic theme uses these CSS custom properties:

:root {
    --primary-blue: #1e3a8a;
    --light-blue: #3b82f6; 
    --ice-blue: #dbeafe;
    --frost-white: #f8fafc;
    --snow-white: #ffffff;
    --arctic-gray: #64748b;
    --deep-blue: #1e293b;
    --accent-cyan: #06b6d4;
}

Documentation Theme

MkDocs Material configuration in mkdocs.yml:

theme:
  name: material
  palette:
    - media: "(prefers-color-scheme: light)"
      scheme: default
      primary: blue
      accent: cyan
    - media: "(prefers-color-scheme: dark)" 
      scheme: slate
      primary: blue
      accent: cyan

📈 Analytics & Monitoring

Cloudflare Web Analytics

  1. Enable Web Analytics
  2. Go to Analytics > Web Analytics
  3. Add your domain: articdbm.penguintech.io
  4. Copy the beacon code

  5. Add to Website Add before closing </body> tag in index.html:

    <!-- Cloudflare Web Analytics -->
    <script defer src='https://static.cloudflareinsights.com/beacon.min.js' 
            data-cf-beacon='{"token": "your-token-here"}'></script>
    

Performance Monitoring

Cloudflare automatically provides: - Core Web Vitals monitoring - Page load times analytics
- Geographic performance data - Security threat blocking

🔒 Security Configuration

SSL/TLS Settings

  1. SSL/TLS Overview
  2. Set encryption mode to Full (strict)
  3. Enable Always Use HTTPS
  4. Set Minimum TLS Version to 1.2

  5. Security Features

    HSTS: Enabled (6 months)
    DNSSEC: Enabled
    Bot Fight Mode: Enabled
    Browser Integrity Check: Enabled
    

Firewall Rules

Add firewall rules for enhanced security:

# Block common attack patterns
(http.request.uri.path contains "/admin" and cf.threat_score > 10)

# Rate limiting for API endpoints  
(http.request.uri.path contains "/api/" and rate(1m) > 100)

# Geographic restrictions (if needed)
(ip.geoip.country ne "US" and http.request.uri.path contains "/download")

🚀 Deployment Workflow

Automatic Deployments

Every push to main branch triggers:

  1. Build Process
  2. Cloudflare fetches latest code
  3. Builds static assets (if needed)
  4. Runs security scans

  5. Preview Deployments

  6. Pull requests get preview URLs
  7. Test changes before merging
  8. Automatic cleanup after merge

  9. Production Deployment

  10. Atomic deployments (all-or-nothing)
  11. Instant global distribution
  12. Automatic rollback on errors

Manual Deployment

For manual deployments:

# Build locally (optional)
cd website
python -m http.server 8080  # Test locally

# Deploy via CLI (optional)
npx wrangler pages publish website --project-name=articdbm

# Or use Git workflow (recommended)
git push origin main

🌍 Global Distribution

Cloudflare Pages provides:

  • 275+ Edge Locations worldwide
  • Automatic caching with smart rules
  • HTTP/3 and Brotli compression
  • IPv6 support enabled by default

Performance Optimization

# Automatic optimizations:
Minification: HTML, CSS, JS
Image optimization: WebP conversion
Caching: Static assets (1 year)
Compression: Gzip + Brotli
HTTP/2 Push: Critical resources

🔧 Troubleshooting

Common Issues

  1. Build Failures

    # Check build logs in Cloudflare dashboard
    # Verify file paths are correct
    # Ensure _headers and _redirects are in root
    

  2. Custom Domain Issues

    # Verify DNS records with dig
    dig articdbm.penguintech.io CNAME
    
    # Check SSL certificate status
    # Wait up to 24 hours for propagation
    

  3. 404 Errors

    # Check file paths in repository
    # Verify build output directory
    # Review _redirects file syntax
    

Debug Commands

# Test DNS resolution
nslookup articdbm.penguintech.io

# Check SSL certificate
openssl s_client -servername articdbm.penguintech.io -connect articdbm.penguintech.io:443

# Test redirects
curl -I https://articdbm.penguintech.io/docs/

📊 Monitoring & Maintenance

Regular Checks

  • SSL certificate expiration (auto-renewed)
  • DNS record accuracy
  • Performance metrics via Cloudflare Analytics
  • Security threats in Firewall tab
  • Build status in Pages dashboard

Update Workflow

  1. Content Updates
  2. Edit files in repository
  3. Commit to main branch
  4. Automatic deployment to production

  5. Configuration Changes

  6. Update _headers or _redirects
  7. Modify DNS records in Cloudflare
  8. Test changes thoroughly

  9. Domain Changes

  10. Update custom domain settings
  11. Modify DNS records accordingly
  12. Update hardcoded URLs in content

🎯 Quick Setup Checklist

  • Create Cloudflare Pages project
  • Connect GitHub repository
  • Configure build settings (/website directory)
  • Set up custom domain (articdbm.penguintech.io)
  • Configure DNS records (CNAME)
  • Enable security features (HTTPS, HSTS)
  • Test website functionality
  • Set up documentation site (optional)
  • Enable Web Analytics
  • Configure firewall rules
  • Set up monitoring alerts

Deployment Time: ~15 minutes DNS Propagation: Up to 24 hours
SSL Certificate: Auto-provisioned in minutes


For additional help, check the Cloudflare Pages documentation or contact support.