docs: add cloudflare pages, cache rules docs and fix relative links
This commit is contained in:
1 parent
87e9eff1bd
commit
80f4d9f198
6 files changed
+74
-5
No files matched your search
@@ -0,0 +1,64 @@
|
||||
# Cloudflare Pages & Workers Setup — Linear Void
|
||||
|
||||
Linear Void uses two Cloudflare products:
|
||||
|
||||
| Product | Purpose | What |
|
||||
| ----------- | ------------------ | ------------------------------------------------------------------------------------ |
|
||||
| **Pages** | Static SPA hosting | Vite-built frontend (`frontend/dist`) deployed via Git integration or Direct Upload |
|
||||
| **Workers** | Edge cache logic | `infrastructure/cloudflare/worker.js` — adds immutable cache headers to HLS segments |
|
||||
|
||||
Both are managed under **Workers & Pages** in the Cloudflare dashboard.
|
||||
|
||||
## Dashboard URLs
|
||||
|
||||
| Resource | URL |
|
||||
| ------------------------ | ---------------------------------------------------------------------------------------------- |
|
||||
| Workers & Pages overview | `https://dash.cloudflare.com/{accountId}/workers-and-pages` |
|
||||
| Worker: linearvoid | `https://dash.cloudflare.com/{accountId}/workers/services/view/linearvoid/production/settings` |
|
||||
| Pages project | `https://dash.cloudflare.com/{accountId}/pages/view/linearvoid` |
|
||||
| API tokens | <https://dash.cloudflare.com/profile/api-tokens> |
|
||||
|
||||
## 1) Worker: `linearvoid` (edge cache headers)
|
||||
|
||||
The Worker at `infrastructure/cloudflare/worker.js` runs on the `linearvoid` Workers service. It intercepts requests and adds immutable `Cache-Control` headers to `.m4s` segment files.
|
||||
|
||||
Deploy via Wrangler CLI:
|
||||
|
||||
```bash
|
||||
npx wrangler deploy infrastructure/cloudflare/worker.js
|
||||
```
|
||||
|
||||
Or paste into the Workers dashboard at the URL above (Quick Edit).
|
||||
|
||||
## 2) Pages: Static frontend
|
||||
|
||||
Two approaches — pick one:
|
||||
|
||||
### Option A: Git integration (recommended)
|
||||
|
||||
Connect the Gitea repository directly in Cloudflare Pages:
|
||||
|
||||
1. Pages → Create a project → Connect to Git
|
||||
2. Link `git.allucanget.biz/zwitschi/linearvoid`
|
||||
3. Build command: `cd frontend && npm run build`
|
||||
4. Output directory: `frontend/dist`
|
||||
5. Add custom domain: `linearvoid.tv`
|
||||
|
||||
Cloudflare handles builds and deploys automatically on push.
|
||||
|
||||
### Option B: Direct Upload via Gitea Actions
|
||||
|
||||
Use `.gitea/workflows/pages-deploy.yml` to build in Gitea Actions and upload via the Cloudflare API.
|
||||
|
||||
See [gitea-cloudflare-pages.md](./gitea-cloudflare-pages.md) for the workflow.
|
||||
|
||||
## 3) Custom domains
|
||||
|
||||
- `linearvoid.tv` → Pages project
|
||||
- `www.linearvoid.tv` → redirect to `linearvoid.tv`
|
||||
- `media.linearvoid.tv` → R2 bucket (separate; not Pages)
|
||||
|
||||
## Related
|
||||
|
||||
- [Gitea to Cloudflare Pages deployment guide](./gitea-cloudflare-pages.md)
|
||||
- [Cloudflare & UptimeRobot checklist](./cloudflare-uptimerobot-checklist.md)
|
||||
@@ -102,3 +102,8 @@ If the `cloudflare/pages-action@v1` action is unavailable from Gitea, use the di
|
||||
- Multi-page SPA (`vite.config.ts`) produces three entry points — Cloudflare Pages serves them correctly.
|
||||
- For SPA fallback routing, add a `frontend/public/_redirects` file with `/* /index.html 200` before building.
|
||||
- If deployments fail with 403, verify the API token has `Account → Cloudflare Pages → Edit` permission.
|
||||
|
||||
## Related resources
|
||||
|
||||
- Cloudflare Workers dashboard: `https://dash.cloudflare.com/{accountId}/workers/services/view/linearvoid/production/settings` — for managing the `infrastructure/cloudflare/worker.js` deployment
|
||||
- Cloudflare Pages project: `https://dash.cloudflare.com/{accountId}/pages/view/linearvoid` — deployment history and custom domain settings
|
||||
Reference in new issue
Block a user