Documentation Site Deployment Guide
Complete guide for deploying the VitePress documentation site to docs.ourlantern.app and docs.dev.ourlantern.app.
Overview
The documentation site is separate from the main Lantern app and has its own deployment pipeline:
| Component | Production | Development |
|---|---|---|
| Main App | ourlantern.app | dev.ourlantern.app |
| Docs Site | docs.ourlantern.app | docs.dev.ourlantern.app |
Key Benefits:
- Independent deployment cycles
- Faster docs updates without rebuilding the app
- Cleaner separation of concerns
- Can update docs without affecting app stability
Deployment Flow
Push to GitHub (main or dev branch)
↓
GitHub Actions (deploy-docs.yml)
↓
Build VitePress site (npm run docs:build)
↓
Deploy to Cloudflare Pages
↓
Available at docs.ourlantern.app (main) or docs.dev.ourlantern.app (dev)Automatic Deployments
- main branch →
docs.ourlantern.app(production) - dev branch →
docs.dev.ourlantern.app(development) - feature branches → Preview URLs (e.g.,
feature-xyz.lantern-docs-dev.pages.dev)
Quick Start
Local Development
# Start the docs dev server
npm run docs:dev
# Build docs for production
npm run docs:build
# Preview the production build locally
npm run docs:previewThe dev server runs on http://localhost:5173 by default.
Initial Setup in Cloudflare
Step 1: Create Production Docs Project
- Go to Cloudflare Dashboard → Pages
- Click "Create a project" → "Connect to Git"
- Select
cattreedev/lantern_apprepository - Configure:
- Project name:
lantern-docs - Production branch:
main - Build command:
npm run docs:build - Build output directory:
docs/.vitepress/dist - Root directory: (leave empty)
- Project name:
- Click "Save and Deploy"
Step 2: Create Development Docs Project
- Click "Create a project" again
- Select same repo
cattreedev/lantern_app - Configure:
- Project name:
lantern-docs-dev - Production branch:
dev(not main!) - Build command:
npm run docs:build - Build output directory:
docs/.vitepress/dist - Root directory: (leave empty)
- Project name:
- Click "Save and Deploy"
Step 3: Add Custom Domains
Production Docs
- In
lantern-docsproject, go to Settings → Domains & accounts - Click Add domain
- Enter
docs.ourlantern.app - Cloudflare will auto-create the required DNS records
Development Docs
- In
lantern-docs-devproject, go to Settings → Domains & accounts - Click Add domain
- Enter
docs.dev.ourlantern.app - Cloudflare will auto-create the required DNS records
Step 4: Verify DNS Configuration
In Cloudflare dashboard, DNS tab should show:
CNAME docs → lantern-docs.pages.dev (Proxied)
CNAME docs-dev → lantern-docs-dev.pages.dev (Proxied)Note: These are in addition to your existing app DNS records:
CNAME @ → lantern-app.pages.dev (Proxied)
CNAME dev → lantern-app-dev.pages.dev (Proxied)GitHub Actions Setup
Required Secrets
Add these secrets in your GitHub repository:
- Go to Settings → Secrets and variables → Actions
- Add the following repository secrets:
| Secret Name | How to Get It |
|---|---|
CLOUDFLARE_API_TOKEN | Cloudflare Dashboard → My Profile → API Tokens → Create Token → "Edit Cloudflare Workers" template |
CLOUDFLARE_ACCOUNT_ID | Cloudflare Dashboard → Workers & Pages → Account ID (right sidebar) |
Note: The GITHUB_TOKEN is automatically provided by GitHub Actions.
Workflow File
The workflow is configured in .github/workflows/deploy-docs.yml. It:
- Triggers on pushes to
mainordevbranches (when docs files change) - Triggers on pull requests (for preview deployments)
- Can be manually triggered via workflow_dispatch
- Builds the VitePress site
- Deploys to the appropriate Cloudflare Pages project
Deployment Workflow
Updating Documentation
1. Make Changes
# Create a feature branch
git checkout -b feature/update-docs dev
# Edit documentation files in docs/
# ... make changes ...
# Test locally
npm run docs:dev
# Visit http://localhost:5173 to preview2. Build and Test
# Build docs to verify no errors
npm run docs:build
# Preview the built site
npm run docs:preview3. Push to GitHub
git add docs/
git commit -m "docs: Update XYZ documentation"
git push origin feature/update-docsResult: GitHub Actions creates a preview deployment
- Preview URL:
https://feature-update-docs.lantern-docs-dev.pages.dev - Check the Actions tab for deployment status
- Preview link appears in the PR
4. Merge to Dev
git checkout dev
git merge feature/update-docs
git push origin devResult: Automatically deploys to https://docs.dev.ourlantern.app
5. Deploy to Production
git checkout main
git merge dev
git push origin mainResult: Automatically deploys to https://docs.ourlantern.app
Monitoring Deployments
Via GitHub Actions
- Go to your repository on GitHub
- Click Actions tab
- Select Deploy Documentation workflow
- View recent runs and their status
- Click on a run to see detailed logs
Via Cloudflare Dashboard
- Go to Pages in Cloudflare Dashboard
- Select
lantern-docsorlantern-docs-dev - View deployment history
- See build logs and deployment status
Troubleshooting
Build Fails with "vitepress: not found"
Cause: Dependencies not installed
Fix: Ensure npm ci runs before build (this is automatic in GitHub Actions)
Deployment Succeeds but Site Shows 404
Cause: Wrong build output directory
Fix: Verify in Cloudflare Pages settings:
- Build output directory:
docs/.vitepress/dist - NOT
distor.vitepress/dist
Changes Not Appearing After Deployment
Cause: Browser cache or Cloudflare cache
Fix:
- Hard refresh browser (Ctrl+Shift+R or Cmd+Shift+R)
- Or purge Cloudflare cache: Pages project → Deployments → "Retry deployment"
GitHub Actions Fails with Permission Error
Cause: Missing or invalid Cloudflare API token
Fix:
- Verify
CLOUDFLARE_API_TOKENsecret is set correctly - Ensure token has "Edit Cloudflare Workers" permissions
- Check token hasn't expired
Preview Deployments Not Working
Cause: GitHub Actions not triggered on PRs
Fix: Ensure the workflow file has:
on:
pull_request:
paths:
- 'docs/**'Features Enabled
Dark Theme
- Dark mode is enabled by default (
appearance: 'dark'in config) - Users can toggle between light/dark with the theme switcher in the nav
Search
- Local search is enabled (
search: { provider: 'local' }) - Indexes all markdown content automatically
- No external dependencies or API keys needed
Sidebar Navigation
- Organized by category (Getting Started, Engineering, Features, etc.)
- Collapsible sections for better organization
- Auto-generated from file structure
Markdown Enhancements
- Line numbers enabled for code blocks
- Syntax highlighting
- Frontmatter support
- Custom containers (tip, warning, danger, etc.)
Updating Documentation
Adding New Pages
- Create a new
.mdfile in the appropriate directory underdocs/ - Add the page to the sidebar in
docs/.vitepress/config.mjs:js{ text: 'My Section', items: [ { text: 'New Page', link: '/path/to/NEW_PAGE' } ] }
Linking Between Pages
Use relative links without the .md extension:
See [Quick Start](../business/QUICK_START_PILOT) for details.Adding Images
Place images in docs/ subdirectories (e.g., docs/screenshots/) and reference them:
Access Control
Option 1: Public Docs (Recommended)
Make docs publicly accessible:
- Do NOT add Cloudflare Access policy to
docs.ourlantern.app - This allows anyone to view documentation
- Common practice for open-source projects
Option 2: Protected Docs
Add Cloudflare Access protection:
- Go to Cloudflare Zero Trust → Access → Applications
- Add application:
- Domain:
docs.ourlantern.app - Policy: One-time PIN or email authentication
- Domain:
- Repeat for
docs.dev.ourlantern.appif needed
Recommendation: Keep production docs public, protect dev docs if they contain unreleased features.
Migration from /docs Path
What Changed
Before:
- Docs built into
dist/docs/alongside main app - Accessed via
ourlantern.app/docs/ - VitePress base:
/docs/ - Deployed together with app
After:
- Docs deployed separately to Cloudflare Pages
- Accessed via
docs.ourlantern.app - VitePress base:
/ - Independent deployment pipeline
Benefits
- Faster Updates: Update docs without rebuilding/redeploying the app
- Independent Scaling: Docs can scale separately from app
- Cleaner URLs:
docs.ourlantern.app/guidevsourlantern.app/docs/guide - Better SEO: Separate subdomain is more discoverable
- Reduced Build Time: App builds faster without docs
Quick Reference
Commands
# Development
npm run docs:dev # Start dev server with hot reload
# Building
npm run docs:build # Build for production
# Preview
npm run docs:preview # Preview production build locallyURLs
| Environment | URL |
|---|---|
| Production | https://docs.ourlantern.app |
| Development | https://docs.dev.ourlantern.app |
| Local Dev | http://localhost:5173 |
| Local Preview | http://localhost:4173 |
Cloudflare Projects
| Project | Branch | Domain |
|---|---|---|
lantern-docs | main | docs.ourlantern.app |
lantern-docs-dev | dev | docs.dev.ourlantern.app |