|
| 1 | +# Deployment Summary |
| 2 | + |
| 3 | +This document provides a quick reference for the GitHub Pages deployment configuration. |
| 4 | + |
| 5 | +## Deployment Files |
| 6 | + |
| 7 | +### 1. `.github/workflows/deploy.yml` |
| 8 | + |
| 9 | +✅ **Status**: Production-ready |
| 10 | + |
| 11 | +**Key Features:** |
| 12 | +- Uses official GitHub Actions: `upload-pages-artifact@v3` and `deploy-pages@v4` |
| 13 | +- Proper permissions: `pages: write`, `id-token: write` |
| 14 | +- Concurrency control to prevent concurrent deployments |
| 15 | +- Environment variables configurable via repository settings |
| 16 | +- Two-job workflow: build → deploy |
| 17 | +- Bun for fast installs and builds |
| 18 | + |
| 19 | +**Environment Variables:** |
| 20 | +- `VITE_BASE_PATH` - Auto-detected or set manually |
| 21 | +- `VITE_DATASET_URL` - Optional custom dataset location |
| 22 | +- `VITE_DATASET_BASE_URL` - Optional dataset base path |
| 23 | + |
| 24 | +### 2. `vite.config.ts` |
| 25 | + |
| 26 | +✅ **Status**: Auto-detection enabled |
| 27 | + |
| 28 | +**Key Features:** |
| 29 | +- Automatic base path detection from `GITHUB_REPOSITORY` |
| 30 | +- Handles both user sites (username.github.io) and project sites |
| 31 | +- Manual override via `VITE_BASE_PATH` environment variable |
| 32 | +- Optimized build with code splitting |
| 33 | +- Source maps enabled for debugging |
| 34 | + |
| 35 | +**Auto-detection Logic:** |
| 36 | +``` |
| 37 | +If VITE_BASE_PATH is set → use it |
| 38 | +Else if in GitHub Actions: |
| 39 | + - If repo is username.github.io → use / |
| 40 | + - Otherwise → use /repo-name/ |
| 41 | +Else → use / |
| 42 | +``` |
| 43 | + |
| 44 | +### 3. `src/App.tsx` |
| 45 | + |
| 46 | +✅ **Status**: HashRouter implemented |
| 47 | + |
| 48 | +**Router Choice:** HashRouter (not BrowserRouter) |
| 49 | + |
| 50 | +**Why HashRouter?** |
| 51 | +- ✅ No server configuration needed |
| 52 | +- ✅ Works on GitHub Pages out of the box |
| 53 | +- ✅ Refresh works on any page |
| 54 | +- ✅ Direct links work (/#/matrix, /#/ext/redis) |
| 55 | +- ✅ Query parameters preserved (/#/matrix?platform=alpine) |
| 56 | + |
| 57 | +**Trade-off:** |
| 58 | +- URLs have `#` (e.g., `/#/matrix` instead of `/matrix`) |
| 59 | +- This is standard for GitHub Pages SPAs |
| 60 | + |
| 61 | +### 4. `README.md` |
| 62 | + |
| 63 | +✅ **Status**: Comprehensive documentation |
| 64 | + |
| 65 | +**Sections:** |
| 66 | +1. Quick Start - Get running in 3 commands |
| 67 | +2. Configuration - All environment variables explained |
| 68 | +3. GitHub Pages Deployment - Step-by-step setup |
| 69 | +4. Dataset Publishing - 3 different approaches |
| 70 | +5. Troubleshooting - 7 common issues with solutions |
| 71 | +6. Project Structure - Complete file tree |
| 72 | +7. Performance Features - Optimization details |
| 73 | + |
| 74 | +## Deployment Checklist |
| 75 | + |
| 76 | +### First-Time Setup |
| 77 | + |
| 78 | +- [ ] Fork/clone repository |
| 79 | +- [ ] Enable GitHub Pages (Settings → Pages → Source: GitHub Actions) |
| 80 | +- [ ] (Optional) Set repository variables if needed |
| 81 | +- [ ] Push to main branch |
| 82 | +- [ ] Wait for Actions workflow to complete |
| 83 | +- [ ] Visit your site at `https://username.github.io/repo-name/` |
| 84 | + |
| 85 | +### Updating Content |
| 86 | + |
| 87 | +- [ ] Make changes locally |
| 88 | +- [ ] Test with `bun run dev` |
| 89 | +- [ ] Build with `bun run build` |
| 90 | +- [ ] Commit and push to main |
| 91 | +- [ ] GitHub Actions deploys automatically |
| 92 | + |
| 93 | +### Custom Dataset |
| 94 | + |
| 95 | +**Option 1: Include in repository** |
| 96 | +```bash |
| 97 | +# Add dataset to public folder |
| 98 | +mkdir -p public/data |
| 99 | +cp manifest.json public/data/ |
| 100 | +cp -r snapshots public/data/ |
| 101 | + |
| 102 | +# Set repository variable |
| 103 | +VITE_DATASET_BASE_URL=/data/ |
| 104 | + |
| 105 | +# Commit and push |
| 106 | +git add public/data |
| 107 | +git commit -m "Add dataset" |
| 108 | +git push |
| 109 | +``` |
| 110 | + |
| 111 | +**Option 2: External dataset** |
| 112 | +```bash |
| 113 | +# Set repository variable to external URL |
| 114 | +VITE_DATASET_URL=https://data.example.com/manifest.json |
| 115 | + |
| 116 | +# Ensure CORS is configured on the external server |
| 117 | +# Then commit any code changes and push |
| 118 | +``` |
| 119 | + |
| 120 | +## Verification |
| 121 | + |
| 122 | +After deployment, verify: |
| 123 | + |
| 124 | +1. **Site loads**: Visit your GitHub Pages URL |
| 125 | +2. **Routing works**: Navigate to `/#/matrix` and `/#/ext/gd` |
| 126 | +3. **Refresh works**: Hard refresh (Ctrl+Shift+R) on any page |
| 127 | +4. **Filters work**: Apply filters, check URL parameters |
| 128 | +5. **Data loads**: Check browser console for errors |
| 129 | +6. **Assets load**: Check Network tab, all CSS/JS should load |
| 130 | + |
| 131 | +## Monitoring |
| 132 | + |
| 133 | +- **Build status**: Check Actions tab for workflow status |
| 134 | +- **Deploy logs**: Click on workflow run for detailed logs |
| 135 | +- **Console errors**: Use browser DevTools to check for runtime errors |
| 136 | +- **Performance**: Use Lighthouse to audit performance |
| 137 | + |
| 138 | +## Rollback |
| 139 | + |
| 140 | +If a deployment fails: |
| 141 | + |
| 142 | +```bash |
| 143 | +# Revert the commit |
| 144 | +git revert HEAD |
| 145 | + |
| 146 | +# Push to trigger new deployment |
| 147 | +git push origin main |
| 148 | +``` |
| 149 | + |
| 150 | +Or use GitHub's deployment history: |
| 151 | +1. Go to Settings → Pages |
| 152 | +2. Find previous successful deployment |
| 153 | +3. Click to redeploy |
| 154 | + |
| 155 | +## Common Issues |
| 156 | + |
| 157 | +### Issue: 404 on refresh |
| 158 | +**Solution**: Should not happen with HashRouter. If it does, verify: |
| 159 | +- `src/App.tsx` uses `HashRouter` (not `BrowserRouter`) |
| 160 | +- Browser URL includes `#` (e.g., `/#/matrix`) |
| 161 | + |
| 162 | +### Issue: Assets not loading |
| 163 | +**Solution**: Check base path configuration: |
| 164 | +```bash |
| 165 | +# In browser console |
| 166 | +console.log(import.meta.env.BASE_URL) |
| 167 | + |
| 168 | +# Should match your deployment path |
| 169 | +# User site: "/" |
| 170 | +# Project site: "/repo-name/" |
| 171 | +``` |
| 172 | + |
| 173 | +### Issue: Data not loading |
| 174 | +**Solution**: Check CORS and dataset URL: |
| 175 | +1. Open browser DevTools → Network tab |
| 176 | +2. Look for manifest.json request |
| 177 | +3. Check response status (should be 200) |
| 178 | +4. If CORS error, configure server headers |
| 179 | +5. If 404, verify VITE_DATASET_URL is correct |
| 180 | + |
| 181 | +## Support |
| 182 | + |
| 183 | +- **Documentation**: See README.md for detailed guides |
| 184 | +- **Issues**: GitHub Issues for bug reports |
| 185 | +- **Discussions**: GitHub Discussions for questions |
| 186 | + |
| 187 | +## File Locations |
| 188 | + |
| 189 | +``` |
| 190 | +.github/workflows/deploy.yml # Deployment workflow |
| 191 | +vite.config.ts # Build configuration |
| 192 | +src/App.tsx # Router setup |
| 193 | +README.md # User documentation |
| 194 | +DEPLOYMENT_SUMMARY.md # This file |
| 195 | +``` |
| 196 | + |
| 197 | +## Quick Commands |
| 198 | + |
| 199 | +```bash |
| 200 | +# Local development |
| 201 | +bun run dev |
| 202 | + |
| 203 | +# Build for production |
| 204 | +bun run build |
| 205 | + |
| 206 | +# Preview production build |
| 207 | +bun run preview |
| 208 | + |
| 209 | +# Check TypeScript |
| 210 | +bunx tsc --noEmit |
| 211 | + |
| 212 | +# Check bundle size |
| 213 | +ls -lh dist/assets/ |
| 214 | + |
| 215 | +# Serve dist folder locally |
| 216 | +bunx serve dist |
| 217 | +``` |
0 commit comments