Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
65 lines
1.8 KiB
HCL
65 lines
1.8 KiB
HCL
# Object CDN — a Cloudflare Worker that serves rendered reels/previews from R2
|
|
# behind signed URLs, with a cache rule for immutable derivatives. Supports
|
|
# reseller custom-domain routing (the gateway's white-label tier maps a custom
|
|
# hostname to this Worker).
|
|
terraform {
|
|
required_providers {
|
|
cloudflare = {
|
|
source = "cloudflare/cloudflare"
|
|
version = "~> 4.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
variable "account_id" { type = string }
|
|
variable "zone_id" { type = string }
|
|
variable "worker_name" {
|
|
type = string
|
|
default = "reelforge-cdn"
|
|
}
|
|
variable "bucket_name" { type = string }
|
|
variable "cdn_hostname" { type = string }
|
|
|
|
resource "cloudflare_worker_script" "cdn" {
|
|
account_id = var.account_id
|
|
name = var.worker_name
|
|
# The Worker validates a signed-URL token, streams the R2 object, and sets
|
|
# immutable cache headers for content-addressed derivatives.
|
|
content = file("${path.module}/worker.js")
|
|
|
|
r2_bucket_binding {
|
|
name = "ASSETS"
|
|
bucket_name = var.bucket_name
|
|
}
|
|
}
|
|
|
|
resource "cloudflare_worker_route" "cdn" {
|
|
zone_id = var.zone_id
|
|
pattern = "${var.cdn_hostname}/*"
|
|
script_name = cloudflare_worker_script.cdn.name
|
|
}
|
|
|
|
# Cache immutable derivatives (posters/previews are content-addressed) at the edge.
|
|
resource "cloudflare_ruleset" "cache" {
|
|
zone_id = var.zone_id
|
|
name = "reelforge-cdn-cache"
|
|
kind = "zone"
|
|
phase = "http_request_cache_settings"
|
|
|
|
rules {
|
|
action = "set_cache_settings"
|
|
action_parameters {
|
|
cache = true
|
|
edge_ttl {
|
|
mode = "override_origin"
|
|
default = 2592000 # 30d for immutable derivatives
|
|
}
|
|
}
|
|
expression = "(http.request.uri.path matches \"^/derivatives/\")"
|
|
description = "cache immutable derivatives at the edge"
|
|
enabled = true
|
|
}
|
|
}
|
|
|
|
output "worker_name" { value = cloudflare_worker_script.cdn.name }
|