Skip to main content

升级 Lambda

  1. 将所有软件包升级到最新版本(@remotion/lambda,还有 remotion@remotion/cli 等等)
npx remotion upgrade
- "@remotion/bundler": "4.0.0" + "@remotion/bundler": "4.0.1"
- "@remotion/renderer": "4.0.0" + "@remotion/renderer": "4.0.1"
- "@remotion/lambda": "4.0.0" + "@remotion/lambda": "4.0.1"
- "remotion": "4.0.0" + "remotion": "4.0.1"
  1. (可选):删除函数的旧版本:
info

只有在函数不再使用时你才应该这样做。如果你仍在生产中使用它,你可以直接跳过这一步。

npx remotion lambda functions rmall -y
  1. 部署最新版本的 Remotion Lambda 函数:
npx remotion lambda functions deploy
  1. 更新网站:
npx remotion lambda sites create src/index.ts --site-name=my-name

传递 --site-name 以及现有站点的名称以更新它。网址将保持不变,但较旧的功能可能无法呈现更新后的站点。

🌐 Pass --site-name with the name of an existing site to update it. The URL will stay the same but older functions may not be able to render the updated site.

如果你不传入 --site-name,将会生成一个新的站点 URL。你需要在你的 renderMediaOnLambda() 调用中更新 serveUrl 参数。旧的已部署函数仍然可以通过指定旧的服务 URL 来渲染。

🌐 If you don't pass --site-name a new site URL will be generated. You'll need to update the serveUrl parameter in your renderMediaOnLambda() calls. Old deployed functions can still render by specifying the old serve URL.

将生产环境和测试环境分开

🌐 Separating production and testing environments

如果你已经将 Remotion Lambda 部署到生产环境,你可以在不产生任何停机时间的情况下进行升级:

🌐 If you already shipped Remotion Lambda to production, you can upgrade without incurring any downtime:

  • 每个已部署的函数都有一个版本(使用 npx remotion lambda functions ls 查看它们)。使用相同版本的 @remotion/lambda 包来调用该函数。
  • 你可以部署具有不同版本的多个函数。使用 compatibleOnly 参数查找与 @remotion/lambda 包版本匹配的函数。
  • Sites/serveUrl' 也依赖于版本。请使用与渲染它们时相同版本的 Remotion 创建它们。如果没有不兼容的情况,Remotion 可以容忍版本不匹配,但会发出警告,提示你可能无法在打包的网站中获得所有最新功能和错误修复。

另见:分离生产和测试环境

🌐 See also: Separating production and testing environments