|
| 1 | +# ServerlessLLM Documentation Versioning Guide |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +The ServerlessLLM documentation now supports versioning with two documentation tracks: |
| 6 | + |
| 7 | +1. **Stable versions** (0.7.0, 0.8.0, etc.) - Released, tested documentation for production use |
| 8 | +2. **Latest (dev)** - Bleeding-edge documentation synced from the main branch |
| 9 | + |
| 10 | +## URL Structure |
| 11 | + |
| 12 | +- `/docs/` or `/docs/intro` → **0.7.0 (stable)** - Default for users |
| 13 | +- `/docs/latest/` or `/docs/latest/intro` → **Latest (dev)** - For developers |
| 14 | +- `/docs/0.7.0/` → Specific stable version |
| 15 | +- `/docs/api/` → API documentation (same for all versions) |
| 16 | + |
| 17 | +## Version Dropdown |
| 18 | + |
| 19 | +Users can switch between versions using the dropdown in the navigation bar: |
| 20 | +- **0.7.0 (stable)** - Current stable release (default) |
| 21 | +- **Latest (dev)** - Development documentation with unreleased features |
| 22 | +- Older versions (0.6.0, 0.5.0, etc.) as they are added |
| 23 | + |
| 24 | +## Directory Structure |
| 25 | + |
| 26 | +``` |
| 27 | +serverlessllm.github.io/ |
| 28 | +├── docs/ # Latest (dev) - synced from main branch |
| 29 | +│ ├── intro.md |
| 30 | +│ ├── getting_started.md |
| 31 | +│ ├── deployment/ |
| 32 | +│ ├── features/ |
| 33 | +│ ├── store/ |
| 34 | +│ ├── api/ # API docs (shared across versions) |
| 35 | +│ └── ... |
| 36 | +├── versioned_docs/ # Stable version snapshots |
| 37 | +│ └── version-0.7.0/ # 0.7.0 stable release |
| 38 | +│ ├── intro.md |
| 39 | +│ ├── getting_started.md |
| 40 | +│ └── ... |
| 41 | +├── versioned_sidebars/ # Sidebar configs for each version |
| 42 | +│ └── version-0.7.0-sidebars.json |
| 43 | +└── versions.json # List of all versions: ["0.7.0"] |
| 44 | +``` |
| 45 | + |
| 46 | +## How Versioning Works |
| 47 | + |
| 48 | +### For Latest (Dev) Documentation |
| 49 | + |
| 50 | +1. Developer commits to `main` branch in ServerlessLLM repository |
| 51 | +2. Sync workflow triggers |
| 52 | +3. Documentation in `docs/` folder is updated |
| 53 | +4. Users accessing `/docs/latest/` see the new content |
| 54 | + |
| 55 | +### For Stable Version Documentation |
| 56 | + |
| 57 | +1. New release is published (e.g., v0.8.0) |
| 58 | +2. Version snapshot workflow triggers |
| 59 | +3. Creates `versioned_docs/version-0.8.0/` with frozen documentation |
| 60 | +4. Updates `versions.json` to include 0.8.0 |
| 61 | +5. Updates config to make 0.8.0 the new default |
| 62 | +6. Users accessing `/docs/` now see 0.8.0 by default |
| 63 | + |
| 64 | +## Sync Workflows |
| 65 | + |
| 66 | +### 1. Sync Latest Docs (Continuous) |
| 67 | + |
| 68 | +**Location:** `.github/workflows/sync-latest-docs.yml` |
| 69 | + |
| 70 | +**Trigger:** Repository dispatch event `sync-latest-docs` |
| 71 | + |
| 72 | +**Purpose:** Updates the "Latest (dev)" documentation from main branch |
| 73 | + |
| 74 | +**Testing:** |
| 75 | +```bash |
| 76 | +gh workflow run sync-latest-docs.yml |
| 77 | +``` |
| 78 | + |
| 79 | +### 2. Create Version Snapshot (On Release) |
| 80 | + |
| 81 | +**Location:** `.github/workflows/create-version-snapshot.yml` |
| 82 | + |
| 83 | +**Trigger:** Repository dispatch event `create-version-snapshot` or manual dispatch |
| 84 | + |
| 85 | +**Purpose:** Creates a versioned snapshot when a new release is published |
| 86 | + |
| 87 | +**Testing:** |
| 88 | +```bash |
| 89 | +gh workflow run create-version-snapshot.yml \ |
| 90 | + -f version=0.8.0 \ |
| 91 | + -f tag=v0.8.0 |
| 92 | +``` |
| 93 | + |
| 94 | +## Main Repository Setup |
| 95 | + |
| 96 | +The main ServerlessLLM repository needs workflow files to trigger documentation syncing. |
| 97 | + |
| 98 | +See `.github/MAIN_REPO_WORKFLOWS.md` for detailed instructions on: |
| 99 | +- Setting up sync workflows in the main repo |
| 100 | +- Creating GitHub tokens |
| 101 | +- Configuring repository dispatch events |
| 102 | + |
| 103 | +## Creating a New Version |
| 104 | + |
| 105 | +### Manual Process |
| 106 | + |
| 107 | +When releasing a new version (e.g., 0.8.0): |
| 108 | + |
| 109 | +1. **Sync docs from the release tag:** |
| 110 | +```bash |
| 111 | +# Clone the main repo at the specific tag |
| 112 | +git clone --depth 1 --branch v0.8.0 https://github.com/ServerlessLLM/ServerlessLLM.git temp_repo |
| 113 | + |
| 114 | +# Remove current docs (keep api/) |
| 115 | +find docs/ -mindepth 1 -maxdepth 1 ! -name 'api' ! -name 'images' ! -name 'README.md' -exec rm -rf {} + |
| 116 | + |
| 117 | +# Copy docs from release |
| 118 | +cp -r temp_repo/docs/* docs/ |
| 119 | + |
| 120 | +# Clean up |
| 121 | +rm -rf temp_repo |
| 122 | +``` |
| 123 | + |
| 124 | +2. **Create version snapshot:** |
| 125 | +```bash |
| 126 | +npm run docusaurus docs:version 0.8.0 |
| 127 | +``` |
| 128 | + |
| 129 | +3. **Update docusaurus.config.js:** |
| 130 | +```javascript |
| 131 | +docs: { |
| 132 | + lastVersion: '0.8.0', // Update to new stable version |
| 133 | + versions: { |
| 134 | + current: { |
| 135 | + label: 'Latest (dev)', |
| 136 | + path: 'latest', |
| 137 | + banner: 'unreleased', |
| 138 | + }, |
| 139 | + '0.8.0': { |
| 140 | + label: '0.8.0 (stable)', |
| 141 | + path: '/', |
| 142 | + banner: 'none', |
| 143 | + }, |
| 144 | + '0.7.0': { |
| 145 | + label: '0.7.0', |
| 146 | + // Older version, no longer default |
| 147 | + }, |
| 148 | + }, |
| 149 | +} |
| 150 | +``` |
| 151 | + |
| 152 | +4. **Commit and push:** |
| 153 | +```bash |
| 154 | +git add . |
| 155 | +git commit -m "docs: create version 0.8.0 snapshot" |
| 156 | +git push |
| 157 | +``` |
| 158 | + |
| 159 | +### Automated Process (Recommended) |
| 160 | + |
| 161 | +Use the `create-version-snapshot.yml` workflow: |
| 162 | + |
| 163 | +```bash |
| 164 | +# Trigger from main ServerlessLLM repo on release |
| 165 | +# OR manually trigger from this repo: |
| 166 | +gh workflow run create-version-snapshot.yml \ |
| 167 | + -f version=0.8.0 \ |
| 168 | + -f tag=v0.8.0 |
| 169 | +``` |
| 170 | + |
| 171 | +## Version Configuration |
| 172 | + |
| 173 | +### versions.json |
| 174 | + |
| 175 | +Lists all stable versions: |
| 176 | +```json |
| 177 | +[ |
| 178 | + "0.8.0", |
| 179 | + "0.7.0", |
| 180 | + "0.6.0" |
| 181 | +] |
| 182 | +``` |
| 183 | + |
| 184 | +### docusaurus.config.js |
| 185 | + |
| 186 | +Configure version behavior: |
| 187 | + |
| 188 | +```javascript |
| 189 | +docs: { |
| 190 | + lastVersion: '0.8.0', // Default version for /docs/ |
| 191 | + versions: { |
| 192 | + current: { |
| 193 | + label: 'Latest (dev)', // Label in dropdown |
| 194 | + path: 'latest', // URL path |
| 195 | + banner: 'unreleased', // Warning banner |
| 196 | + badge: true, // Show badge |
| 197 | + }, |
| 198 | + '0.8.0': { |
| 199 | + label: '0.8.0 (stable)', |
| 200 | + path: '/', // Root path (default) |
| 201 | + banner: 'none', |
| 202 | + }, |
| 203 | + '0.7.0': { |
| 204 | + label: '0.7.0', |
| 205 | + // Uses default path: /docs/0.7.0/ |
| 206 | + }, |
| 207 | + }, |
| 208 | +} |
| 209 | +``` |
| 210 | + |
| 211 | +## Migration Summary |
| 212 | + |
| 213 | +The migration from the old structure involved: |
| 214 | + |
| 215 | +1. ✅ Moved `docs/stable/*` → `docs/*` |
| 216 | +2. ✅ Updated `sidebars.js` to use root directory |
| 217 | +3. ✅ Created initial version 0.7.0 snapshot |
| 218 | +4. ✅ Configured versioning in `docusaurus.config.js` |
| 219 | +5. ✅ Fixed broken internal links |
| 220 | +6. ✅ Updated homepage link |
| 221 | +7. ✅ Created sync workflows |
| 222 | + |
| 223 | +## Breaking Changes |
| 224 | + |
| 225 | +### URL Changes |
| 226 | + |
| 227 | +Old URL structure: |
| 228 | +- `/docs/stable/intro` → Documentation |
| 229 | + |
| 230 | +New URL structure: |
| 231 | +- `/docs/intro` → Stable documentation (0.7.0) |
| 232 | +- `/docs/latest/intro` → Latest development docs |
| 233 | +- `/docs/0.7.0/intro` → Specific version |
| 234 | + |
| 235 | +**Impact:** External links to `/docs/stable/*` will break and need updating. |
| 236 | + |
| 237 | +### Recommendation |
| 238 | + |
| 239 | +Set up redirects for old URLs: |
| 240 | +```javascript |
| 241 | +// In docusaurus.config.js |
| 242 | +plugins: [ |
| 243 | + [ |
| 244 | + '@docusaurus/plugin-client-redirects', |
| 245 | + { |
| 246 | + redirects: [ |
| 247 | + { |
| 248 | + from: '/docs/stable/:path', |
| 249 | + to: '/docs/:path', |
| 250 | + }, |
| 251 | + ], |
| 252 | + }, |
| 253 | + ], |
| 254 | +], |
| 255 | +``` |
| 256 | + |
| 257 | +## Troubleshooting |
| 258 | + |
| 259 | +### Build Errors |
| 260 | + |
| 261 | +**Issue:** Broken links after restructuring |
| 262 | + |
| 263 | +**Solution:** Update all internal links: |
| 264 | +- `../stable/path.md` → `../path.md` |
| 265 | +- Ensure cross-references between `docs/` and `docs/api/` use correct relative paths |
| 266 | + |
| 267 | +### Version Not Showing in Dropdown |
| 268 | + |
| 269 | +**Issue:** New version not visible |
| 270 | + |
| 271 | +**Solution:** |
| 272 | +1. Check `versions.json` includes the version |
| 273 | +2. Verify `versioned_docs/version-X.X.X/` exists |
| 274 | +3. Rebuild: `npm run build` |
| 275 | + |
| 276 | +### Wrong Default Version |
| 277 | + |
| 278 | +**Issue:** Latest (dev) shows by default instead of stable |
| 279 | + |
| 280 | +**Solution:** Ensure `lastVersion` in config points to stable version: |
| 281 | +```javascript |
| 282 | +docs: { |
| 283 | + lastVersion: '0.7.0', // Should be stable, not 'current' |
| 284 | +} |
| 285 | +``` |
| 286 | + |
| 287 | +## Best Practices |
| 288 | + |
| 289 | +1. **Always sync from tagged releases** for stable versions, not from branches |
| 290 | +2. **Test versioned docs locally** before deploying |
| 291 | +3. **Update version labels** in config when creating new versions |
| 292 | +4. **Keep version history** - don't delete old versions unless necessary |
| 293 | +5. **Document breaking changes** between versions in release notes |
| 294 | + |
| 295 | +## Future Enhancements |
| 296 | + |
| 297 | +Potential improvements to consider: |
| 298 | + |
| 299 | +1. **Automatic version creation** on GitHub releases |
| 300 | +2. **Version deprecation banners** for outdated versions |
| 301 | +3. **Version-specific search** to filter results by version |
| 302 | +4. **Changelog integration** linking versions to release notes |
| 303 | +5. **Version comparison tools** to see changes between versions |
| 304 | + |
| 305 | +## Support |
| 306 | + |
| 307 | +For issues or questions about versioning: |
| 308 | +- Check Docusaurus versioning docs: https://docusaurus.io/docs/versioning |
| 309 | +- Report issues: https://github.com/ServerlessLLM/serverlessllm.github.io/issues |
0 commit comments