mirror of
https://github.com/tiennm99/mathmax.git
synced 2026-06-17 16:49:01 +00:00
3.2 KiB
3.2 KiB
Runbook — MathMax
Deployment
Production deploys from main via GitHub Actions (.github/workflows/deploy.yml).
- Live URL:
https://tiennm99.github.io/mathmax/ - Build:
npm run build(SvelteKit static, output tobuild/) - Deploy mechanism:
actions/upload-pages-artifact@v3+actions/deploy-pages@v4 - Concurrency:
pages-deploygroup, cancel-in-progress disabled (so a force-pushed retry doesn't abort an in-flight rollback)
Rollback
GitHub Pages keeps the last successful deployment. To roll back:
- Find the offending commit on
main:git log --oneline main - Revert it:
git revert <sha>and push tomain - The next workflow run rebuilds and re-deploys the prior good state
- Verify the live site
If the workflow itself is broken (e.g., bad deploy.yml change), use the GitHub UI to re-run a previous successful deployment from the Deployments tab.
CI
.github/workflows/ci.ymlruns build on every PR and push tomain. Build failure onmainblocks the deploy job.- Local equivalent:
npm install && npm run build
Domain migration trigger
Per plan, buy a .vn / .com.vn domain only when ANY of:
- 500 unique sessions in any rolling 30-day window post-launch, OR
- 1 organic teacher share (Facebook group, Zalo, or school chat — verified, not founder-initiated), OR
- ≥5 modules shipped (signals content sustainability and amortizes the domain cost)
If none hit within 90 days of soft launch, stay on tiennm99.github.io/mathmax/.
When the trigger fires:
- Register the domain (VN registration: passport scan + address proof + MIC filing, 7–14 days)
- Add
CNAMEfile at repo root with the new domain (e.g.mathmax.vn) - Configure custom domain in GitHub Pages settings (Settings → Pages → Custom domain)
- Update
svelte.config.js: changepaths.basefrom/mathmaxto/, update any hardcoded references. Or update the workflowenv:block. - Update OpenGraph + canonical URLs (handled automatically once
svelte.config.jsreflects the new domain) - Wait 24h, then update sitemap submission in Google Search Console
- Set up 301 redirects (GitHub Pages handles this automatically once the custom domain is the primary)
Things to NOT do
- Never
git push --forcetomain. - Never edit
VERSIONorpackage.json.versionindependently — they must agree. - Never change
svelte.config.jspaths.basewithout simultaneously updating the deploy workflowenv:and any hardcoded internal links. - Never run
npm installin CI without committing the resultingpackage-lock.jsonlocally first.
Initial CI note
Initial CI uses npm install (no lockfile committed yet). After first successful run, user commits package-lock.json locally and we switch CI to npm ci in a follow-up PR.
Bundle notes
- KaTeX (
katex@^0.16) is loaded site-wide viaimport 'katex/dist/katex.min.css'in+layout.svelte. CSS + woff2 fonts add ~280KB total to the static asset payload. Math is server-rendered viakatex.renderToString(insrc/lib/components/tex.svelte), so KaTeX JavaScript runs only at build time — the runtime cost is the CSS + fonts, not the JS module. If Lighthouse perf drops below 90 after content growth, consider scoping CSS imports per-route.