Skip to main content

生产清单

EXPERIMENTAL

你已经使用 Remotion Cloud Run 实现了你的解决方案,并准备将项目推向世界。恭喜!在上线之前,请通过这个清单,确保 Cloud Run 运行稳定。

🌐 You have implemented your solution with Remotion Cloud Run and are ready to launch your project into the world. Congrats! Before you go live, go through this checklist to make sure Cloud Run is running stable.

优化内存

🌐 Optimizing for memory

向你的 Cloud Run 服务添加过多的内存可能会使渲染成本增加。多次重新部署你的服务,并尽可能降低内存大小,直到你觉得找到了成本低廉与对视频能够可靠渲染的信心之间的最佳平衡点。

🌐 Adding too much memory to your Cloud Run services can make rendering more costly. Redeploy your service multiple times and lower the memory size as much as possible until you feel you hit the sweet spot between low costs and confidence that your video will render reliably.

最大文件大小

🌐 Maximum file size

Cloud Run 上的输出文件大小受内存限制约束,减去在该服务上运行 Remotion Cloud Run 所需的支持软件的大小。调整 Cloud Run 的磁盘空间参数,以适应你希望支持的最大视频长度。测试输出文件的大小,并确保它们不会有超过限制的风险。如果你的视频基于用户输入,请防止用户渲染可能超过 Remotion Cloud Run 可用空间的超长视频。

🌐 The output file size on Cloud Run is constrained by the memory limit, minus the size of the supporting software for Remotion Cloud Run running on the service. Adjust the disk space parameter of Cloud Run to accommodate for the maximum video length that you would like to support. Test the file sizes of your outputs and make sure they don't run at risk of exceeding the limit. If your video is based on user input, prevent your users from rendering very long videos that would exceed the space available in Remotion Cloud Run.

权限

🌐 Permissions

确保你的 GCP 服务账号仅拥有所需的权限,并将你的凭据作为环境变量存储。查看 权限 页面以了解最低权限要求。

🌐 Make sure your GCP Service Account only has as many permissions as needed and store your credentials as environment variables. Review the Permissions page to see what the minimum amount of permissions is.

选择合适的并发

🌐 Selecting the right concurrency

使用 Remotion API,服务将以并发为 1(即没有并发)进行部署。这是为了确保不会因无关渲染共享 CPU 和内存而产生问题。如果你希望更改此设置,你需要在 GCP 控制台的 Cloud Run 部分点击“编辑并部署新版本”,然后选择所需的并发数。

🌐 Using the Remotion API, services will be deployed with a concurrency of 1 (i.e no concurrency). This is to ensure no issues arise from shared CPU and memory of unrelated renders. If you wish to change this, you will need to click 'Edit and Deploy New Revision' from within the Cloud Run section of the GCP Console, and select the desired concurrency.

选择正确的实例限制

🌐 Selecting the right instance limit

默认情况下,Cloud Run 服务的最少实例数设置为 0,最大实例数限制为 100。如果一次性发起超过 100 个同时渲染请求,将返回 503 服务不可用。在这里阅读更多关于实例限制的信息

🌐 By default, the Cloud Run service will have a minimum number of instances set to 0, and a maximum instance limit of 100. If more than 100 simultaneous render requests are made at once, a 503 service unavailable will be returned. Read more about the instance limit here.

桶隐私

🌐 Bucket privacy

默认情况下,渲染的视频在你的存储桶中是公开可访问的。如果你希望渲染的视频为私密,可以使用 renderMediaOnCloudrun()renderStillOnCloudrun() 中的 privacy 设置。

🌐 By default the rendered videos are publicly accessible in your bucket. Use the privacy setting in renderMediaOnCloudrun() and renderStillOnCloudrun() to make renders private if you'd like so.

速率限制

🌐 Rate limiting

考虑用户是否可能调用许多视频渲染,这将最终计入你的 GCP 账单,并实现速率限制器以防止恶意行为者渲染许多视频。

🌐 Consider if it's possible for a user to invoke many video renders that will end up on your GCP bill, and implement a rate limiter to prevent a malicious actor from rendering many videos.

超时

🌐 Timeout

你的 Cloud Run 服务的默认超时为 300 秒。请根据你的需求测量并调整超时,并确保时间足够长,以避免视频渲染失败。

有效的公司许可

🌐 Valid Company license

拥有3人以上的公司需要购买云渲染席位才能使用 Remotion Cloud Run。请在启动前熟悉许可证购买所需的云席位

🌐 Companies with more than 3 people need to buy cloud rendering seats in order to use Remotion Cloud Run. Please familiarize yourself with the license and buy the necessary cloud seats before launching.