|
| 1 | +# ReadTheDocs Deployment Guide |
| 2 | + |
| 3 | +This guide walks you through deploying the MongoDB Query Builder documentation to ReadTheDocs.io. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- GitHub repository with the documentation |
| 8 | +- ReadTheDocs account (free at readthedocs.org) |
| 9 | +- MkDocs documentation set up (already done!) |
| 10 | + |
| 11 | +## Local Testing |
| 12 | + |
| 13 | +First, test the documentation locally: |
| 14 | + |
| 15 | +```bash |
| 16 | +# Install MkDocs dependencies |
| 17 | +pip install -r docs/requirements.txt |
| 18 | + |
| 19 | +# Serve documentation locally |
| 20 | +mkdocs serve |
| 21 | + |
| 22 | +# Visit http://localhost:8000 to preview |
| 23 | +``` |
| 24 | + |
| 25 | +## ReadTheDocs Setup |
| 26 | + |
| 27 | +### 1. Import Project |
| 28 | + |
| 29 | +1. Log in to [ReadTheDocs.org](https://readthedocs.org) |
| 30 | +2. Click "Import a Project" |
| 31 | +3. Select "Import from GitHub" |
| 32 | +4. Choose your `mongodb-builder` repository |
| 33 | +5. Click "Next" |
| 34 | + |
| 35 | +### 2. Project Configuration |
| 36 | + |
| 37 | +ReadTheDocs will automatically detect the `.readthedocs.yaml` file. Verify these settings: |
| 38 | + |
| 39 | +- **Name**: MongoDB Query Builder |
| 40 | +- **Repository URL**: Your GitHub repo URL |
| 41 | +- **Default branch**: main (or master) |
| 42 | +- **Documentation type**: MkDocs (auto-detected) |
| 43 | + |
| 44 | +### 3. Advanced Settings |
| 45 | + |
| 46 | +In the project admin panel: |
| 47 | + |
| 48 | +1. **Domains**: |
| 49 | + - Default: `mongodb-query-builder.readthedocs.io` |
| 50 | + - Can add custom domain later |
| 51 | + |
| 52 | +2. **Versions**: |
| 53 | + - Enable version tags for releases |
| 54 | + - Set "latest" as default version |
| 55 | + |
| 56 | +3. **Build Settings**: |
| 57 | + - Build on push: ✓ |
| 58 | + - Build pull requests: ✓ (optional) |
| 59 | + |
| 60 | +### 4. Environment Variables (if needed) |
| 61 | + |
| 62 | +If you need any environment variables, add them in: |
| 63 | +Admin → Environment Variables |
| 64 | + |
| 65 | +## GitHub Integration |
| 66 | + |
| 67 | +### Webhook Setup |
| 68 | + |
| 69 | +ReadTheDocs automatically sets up a webhook. Verify in your GitHub repo: |
| 70 | + |
| 71 | +1. Go to Settings → Webhooks |
| 72 | +2. You should see a ReadTheDocs webhook |
| 73 | +3. It triggers on push events |
| 74 | + |
| 75 | +### Build Status Badge |
| 76 | + |
| 77 | +Add to your README.md: |
| 78 | + |
| 79 | +```markdown |
| 80 | +[](https://mongodb-query-builder.readthedocs.io/en/latest/?badge=latest) |
| 81 | +``` |
| 82 | + |
| 83 | +## Version Management |
| 84 | + |
| 85 | +For version management with `mike`: |
| 86 | + |
| 87 | +```bash |
| 88 | +# Install mike |
| 89 | +pip install mike |
| 90 | + |
| 91 | +# Deploy initial version |
| 92 | +mike deploy --push --update-aliases 0.1.0 latest |
| 93 | + |
| 94 | +# Deploy new version |
| 95 | +mike deploy --push --update-aliases 0.2.0 latest |
| 96 | + |
| 97 | +# List versions |
| 98 | +mike list |
| 99 | + |
| 100 | +# Set default version |
| 101 | +mike set-default --push latest |
| 102 | +``` |
| 103 | + |
| 104 | +## Troubleshooting |
| 105 | + |
| 106 | +### Build Failures |
| 107 | + |
| 108 | +1. Check build logs in ReadTheDocs dashboard |
| 109 | +2. Common issues: |
| 110 | + - Missing dependencies in `docs/requirements.txt` |
| 111 | + - Incorrect `mkdocs.yml` syntax |
| 112 | + - Python version mismatch |
| 113 | + |
| 114 | +### Custom Domain |
| 115 | + |
| 116 | +To use a custom domain: |
| 117 | + |
| 118 | +1. Add CNAME record pointing to `readthedocs.io` |
| 119 | +2. Add domain in ReadTheDocs admin panel |
| 120 | +3. Enable HTTPS |
| 121 | + |
| 122 | +### Search Not Working |
| 123 | + |
| 124 | +Ensure in `mkdocs.yml`: |
| 125 | +- Search plugin is enabled |
| 126 | +- Language is set correctly |
| 127 | + |
| 128 | +## Maintenance |
| 129 | + |
| 130 | +### Updating Documentation |
| 131 | + |
| 132 | +1. Make changes to documentation files |
| 133 | +2. Commit and push to GitHub |
| 134 | +3. ReadTheDocs automatically rebuilds |
| 135 | + |
| 136 | +### Monitoring |
| 137 | + |
| 138 | +- Check build status in ReadTheDocs dashboard |
| 139 | +- Monitor 404 errors in analytics |
| 140 | +- Review search queries for missing content |
| 141 | + |
| 142 | +## Next Steps |
| 143 | + |
| 144 | +1. Complete placeholder documentation files |
| 145 | +2. Add more examples and tutorials |
| 146 | +3. Set up documentation versioning |
| 147 | +4. Consider adding: |
| 148 | + - API changelog |
| 149 | + - Contributing guide |
| 150 | + - Architecture diagrams |
| 151 | + - Video tutorials |
| 152 | + |
| 153 | +## Resources |
| 154 | + |
| 155 | +- [ReadTheDocs Documentation](https://docs.readthedocs.io/) |
| 156 | +- [MkDocs Documentation](https://www.mkdocs.org/) |
| 157 | +- [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) |
| 158 | +- [Mike Documentation](https://github.com/jimporter/mike) |
0 commit comments