85453da49f
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
Docs / Validate docs (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Sync skills to ClawHub / Publish changed skills (push) Waiting to run
regression / regression-shards (style-16-prod style-9-prod style-17-prod iframe-render-compat variables-prod mp4-h265-sdr, shard-4) (push) Has been cancelled
regression / regression-shards (style-4-prod style-11-prod style-2-prod animejs-adapter typegpu-adapter parallel-capture-regression, shard-5) (push) Has been cancelled
regression / regression-shards (style-7-prod style-8-prod style-10-prod css-spinner-render-compat webm-transparency mp4-h264-sdr webm-vp9, shard-3) (push) Has been cancelled
regression / regression-shards (sub-composition-video style-18-prod raf-ball-render-compat font-variant-numeric sub-comp-t0 sub-comp-id-selector, shard-7) (push) Has been cancelled
Windows render verification / Detect changes (push) Has been cancelled
Windows render verification / Preflight (lint + format) (push) Has been cancelled
Windows render verification / Render on windows-latest (push) Has been cancelled
Windows render verification / Tests on windows-latest (push) Has been cancelled
CI / Detect changes (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Fallow audit (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Typecheck (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Producer: integration tests (push) Has been cancelled
CI / Producer: unit tests (push) Has been cancelled
CI / File size check (push) Has been cancelled
CI / Test: skills (push) Has been cancelled
CI / Skills: manifest in sync (push) Has been cancelled
CI / CLI: npx shim (macos-latest) (push) Has been cancelled
CI / CLI: npx shim (ubuntu-latest) (push) Has been cancelled
CI / CLI: npx shim (windows-latest) (push) Has been cancelled
CI / SDK: unit + contract + smoke (push) Has been cancelled
CI / Test: runtime contract (push) Has been cancelled
CI / Studio: load smoke (push) Has been cancelled
CI / Smoke: global install (push) Has been cancelled
CI / CLI smoke (required) (push) Has been cancelled
CI / Semantic PR title (push) Has been cancelled
Player perf / Detect changes (push) Has been cancelled
Player perf / Preflight (lint + format) (push) Has been cancelled
Player perf / player-perf (push) Has been cancelled
Player perf / Perf: drift (push) Has been cancelled
Player perf / Perf: fps (push) Has been cancelled
Player perf / Perf: parity (push) Has been cancelled
Player perf / Perf: scrub (push) Has been cancelled
Player perf / Perf: load (push) Has been cancelled
preview-regression / Detect changes (push) Has been cancelled
preview-regression / Preflight (lint + format) (push) Has been cancelled
preview-regression / Preview parity (push) Has been cancelled
preview-regression / preview-regression (push) Has been cancelled
regression / regression (push) Has been cancelled
regression / Detect changes (push) Has been cancelled
regression / Preflight (lint + format) (push) Has been cancelled
regression / regression-shards (hdr-regression style-5-prod style-3-prod mov-prores, shard-1) (push) Has been cancelled
regression / regression-shards (overlay-montage-prod style-12-prod chat missing-host-comp-id png-sequence portrait-edge-bleed, shard-6) (push) Has been cancelled
regression / regression-shards (style-13-prod style-6-prod vignelli-stacking gsap-letters-render-compat audio-mux-parity, shard-8) (push) Has been cancelled
regression / regression-shards (style-15-prod hdr-hlg-regression style-1-prod many-cuts vfr-screen-recording render-symlinked-assets, shard-2) (push) Has been cancelled
111 lines
4.3 KiB
Plaintext
111 lines
4.3 KiB
Plaintext
---
|
|
title: "@hyperframes/gcp-cloud-run"
|
|
description: "Google Cloud Run and Workflows adapter for distributed HyperFrames rendering."
|
|
---
|
|
|
|
The GCP Cloud Run package runs HyperFrames' distributed render primitives on Google Cloud. It ships a Cloud Run HTTP service, a Node client SDK, and a Terraform module for provisioning the bucket, service, workflow, and service accounts.
|
|
|
|
```bash
|
|
npm install @hyperframes/gcp-cloud-run
|
|
```
|
|
|
|
## When to Use
|
|
|
|
**Use `@hyperframes/gcp-cloud-run` when you need to:**
|
|
- Render large compositions on Google Cloud infrastructure
|
|
- Orchestrate `plan`, `renderChunk`, and `assemble` through Cloud Workflows
|
|
- Store project archives, chunk outputs, and final videos in GCS
|
|
- Deploy the renderer as a Cloud Run service with a pinned Chrome runtime
|
|
- Drive renders from CI, a backend service, or custom internal tooling
|
|
|
|
**Use a different package if you want to:**
|
|
- Render locally or inside a single Node process - use the [CLI](/packages/cli) or [producer](/packages/producer)
|
|
- Run the same distributed model on AWS - use [aws-lambda](/packages/aws-lambda)
|
|
- Build or edit composition HTML - use [studio](/packages/studio), [sdk](/packages/sdk), or [core](/packages/core)
|
|
|
|
<Tip>
|
|
Cloud Run uses a container image, so it avoids Lambda ZIP-size pressure and can install the same pinned `chrome-headless-shell` runtime used by the standard renderer.
|
|
</Tip>
|
|
|
|
## Package Exports
|
|
|
|
| Import | Description |
|
|
|--------|-------------|
|
|
| `@hyperframes/gcp-cloud-run` | Server handler, event types, GCS transport, and client SDK exports |
|
|
| `@hyperframes/gcp-cloud-run/server` | Cloud Run HTTP service entry point |
|
|
| `@hyperframes/gcp-cloud-run/sdk` | Lightweight Node SDK for deploying sites, starting renders, polling progress, and estimating cost |
|
|
|
|
The published package also includes `terraform/` and a `Dockerfile` for deployment.
|
|
|
|
## Architecture
|
|
|
|
Cloud Workflows invokes one Cloud Run service with different `Action` values:
|
|
|
|
<Steps>
|
|
<Step title="Plan">
|
|
Downloads the project archive from GCS, runs the producer planner, and uploads the plan directory.
|
|
</Step>
|
|
<Step title="Render chunks">
|
|
Cloud Workflows runs parallel `renderChunk` calls against the Cloud Run service. Each request renders one chunk and uploads it to GCS.
|
|
</Step>
|
|
<Step title="Assemble">
|
|
Downloads all chunks and audio assets, assembles the deliverable, and uploads the final file.
|
|
</Step>
|
|
</Steps>
|
|
|
|
The service is intentionally close to the AWS Lambda adapter: thin cloud transport around the same `@hyperframes/producer/distributed` primitives.
|
|
|
|
## Deploying
|
|
|
|
Build and push the container, then apply the Terraform module:
|
|
|
|
```bash
|
|
gcloud builds submit . \
|
|
--tag REGION-docker.pkg.dev/PROJECT/REPO/hyperframes-render:TAG
|
|
|
|
terraform -chdir=node_modules/@hyperframes/gcp-cloud-run/terraform init
|
|
terraform -chdir=node_modules/@hyperframes/gcp-cloud-run/terraform apply \
|
|
-var project_id=PROJECT \
|
|
-var region=us-central1 \
|
|
-var image=REGION-docker.pkg.dev/PROJECT/REPO/hyperframes-render:TAG
|
|
```
|
|
|
|
Terraform outputs the bucket name, service URL, workflow name, and region needed by the SDK.
|
|
|
|
## Using the SDK
|
|
|
|
```typescript
|
|
import { getRenderProgress, renderToCloudRun } from "@hyperframes/gcp-cloud-run/sdk";
|
|
|
|
const handle = await renderToCloudRun({
|
|
projectDir: "./my-composition",
|
|
config: { fps: 30, width: 1920, height: 1080, format: "mp4" },
|
|
bucketName: "hyperframes-render-my-project",
|
|
projectId: "my-project",
|
|
location: "us-central1",
|
|
workflowId: "hyperframes-render",
|
|
serviceUrl: "https://hyperframes-render-abc.us-central1.run.app",
|
|
});
|
|
|
|
let progress = await getRenderProgress({ executionName: handle.executionName });
|
|
while (progress.status === "running") {
|
|
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
progress = await getRenderProgress({ executionName: handle.executionName });
|
|
}
|
|
|
|
console.log(progress.status, progress.outputFile, progress.costs.displayCost);
|
|
```
|
|
|
|
Pass `projectDir` for one-shot uploads, or call `deploySite()` separately and reuse the returned site handle across many renders.
|
|
|
|
## Related Guides
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="GCP Cloud Run Deployment" icon="cloud" href="/deploy/gcp-cloud-run">
|
|
End-to-end deployment details and smoke-test notes.
|
|
</Card>
|
|
<Card title="@hyperframes/producer" icon="video" href="/packages/producer">
|
|
The distributed primitives that the Cloud Run service executes.
|
|
</Card>
|
|
</CardGroup>
|