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 |