feat(ops): replace Cloudflare Pages with Workers for frontend hosting
This commit is contained in:
1 parent
9ac1a8b79d
commit
9e56ff7859
16 files changed
+214
-283
No files matched your search
+10
-10
@@ -164,7 +164,7 @@ flowchart TD
|
||||
|
||||
subgraph "Cloudflare Global Edge"
|
||||
CDN[Cloudflare CDN<br/>Cache Rules + WAF + TLS]
|
||||
Pages[Cloudflare Pages<br/>Static SPA Hosting]
|
||||
Workers[Cloudflare Workers<br/>Static SPA Hosting]
|
||||
R2[Cloudflare R2<br/>HLS Segments + Source MP4s<br/>enam location hint]
|
||||
end
|
||||
|
||||
@@ -177,17 +177,17 @@ flowchart TD
|
||||
Admins -->|HTTPS - Schedule/Playlist| Playout
|
||||
Playout -->|S3-compatible Upload| R2
|
||||
R2 -->|Cached HLS| CDN
|
||||
Viewers -->|HTTPS| Pages
|
||||
Viewers -->|HTTPS| Workers
|
||||
Viewers -->|HLS Requests| CDN
|
||||
Viewers -->|WSS Chat| Chat
|
||||
Chat --> VPS
|
||||
VPS -->|Proxy / Static| Pages
|
||||
VPS -->|Proxy / Static| Workers
|
||||
CDN -->|Origin Pull on Miss| R2
|
||||
```
|
||||
|
||||
**External Interfaces**:
|
||||
|
||||
- **Cloudflare**: CDN (cache rules for `.m4s` and `.ts` vs `.m3u8`), R2 (object storage, $0 egress), Pages (static hosting), WAF/TLS.
|
||||
- **Cloudflare**: CDN (cache rules for `.m4s` and `.ts` vs `.m3u8`), R2 (object storage, $0 egress), Workers (static hosting), WAF/TLS.
|
||||
- **Hetzner VPS**: Compute for playout and chat (low-cost US-East with good peering).
|
||||
- **Browsers**: Native HLS (`<video>` + hls.js) and WebSocket APIs.
|
||||
- **Source**: Pre-normalized MP4 files uploaded to R2.
|
||||
@@ -233,7 +233,7 @@ graph TD
|
||||
subgraph Cloudflare
|
||||
CDN[CDN + Cache Rules<br/>.m4s and .ts immutable long TTL<br/>.m3u8 short TTL]
|
||||
R2[R2 - HLS + Source]
|
||||
Pages[Pages - Static SPA]
|
||||
Workers[Workers - Static SPA]
|
||||
end
|
||||
VPS[VPS Hetzner Ashburn]
|
||||
Playout[FFmpeg + MediaMTX/SRS<br/>Playlist → HLS]
|
||||
@@ -244,7 +244,7 @@ graph TD
|
||||
Admin --> Playout
|
||||
Playout --> R2
|
||||
R2 --> CDN
|
||||
Viewer --> Pages
|
||||
Viewer --> Workers
|
||||
Viewer --> CDN
|
||||
Viewer --> Chat
|
||||
Chat --> VPS
|
||||
@@ -274,7 +274,7 @@ graph TB
|
||||
subgraph "Cloudflare Edge"
|
||||
CF[CDN + WAF<br/>Cache Rules]
|
||||
R2[R2 Bucket<br/>media + HLS]
|
||||
PAGES[Pages<br/>SPA hosting]
|
||||
WORKERS[Workers<br/>SPA hosting]
|
||||
end
|
||||
|
||||
subgraph "Docker Host (Hetzner CX22)"
|
||||
@@ -461,7 +461,7 @@ flowchart LR
|
||||
|
||||
### Infrastructure Level 1
|
||||
|
||||
**Overview Diagram**: See Mermaid in Building Block section (VPS + Cloudflare R2/Pages/CDN).
|
||||
**Overview Diagram**: See Mermaid in Building Block section (VPS + Cloudflare R2/Workers/CDN).
|
||||
|
||||
**Motivation**: Low-cost US-East origin with global edge caching. Hetzner provides excellent price/performance and included traffic; Cloudflare eliminates egress fees.
|
||||
|
||||
@@ -470,7 +470,7 @@ flowchart LR
|
||||
**Mapping of Building Blocks to Infrastructure**:
|
||||
|
||||
- Playout + Chat + Nginx → Hetzner Cloud CX22 (Ashburn, VA).
|
||||
- HLS storage, caching, static SPA → Cloudflare R2 + CDN + Pages (custom domains, `enam` location hint).
|
||||
- HLS storage, caching, static SPA → Cloudflare R2 + CDN + Workers (custom domains, `enam` location hint).
|
||||
- All public traffic routed through Cloudflare.
|
||||
|
||||
### Infrastructure Level 2
|
||||
@@ -482,7 +482,7 @@ flowchart LR
|
||||
- R2 bucket for media.
|
||||
- Cache Rules (`.m4s` and `.ts`: Cache Everything, immutable, long TTL; `.m3u8`: short TTL/must-revalidate).
|
||||
- WAF, rate limiting, Tiered Cache.
|
||||
- Pages for SPA hosting.
|
||||
- Workers for SPA hosting.
|
||||
|
||||
Future evolution: Docker Compose, managed DB, secondary regions (detailed in subsequent ADRs).
|
||||
|
||||
|
||||
Reference in new issue
Block a user