Skip to content

🎥 Make videos programmatically with React

should take version from remotion

Jonny Burgere0f6dc5f831d
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/tasks/setupGcpProject.mjs b/packages/cloudrun/gcpInstaller/installerScripts/tasks/setupGcpProject.mjs
index 1e58be0a84..d33e3f968a 100644
--- a/packages/cloudrun/gcpInstaller/installerScripts/tasks/setupGcpProject.mjs
+++ b/packages/cloudrun/gcpInstaller/installerScripts/tasks/setupGcpProject.mjs
@@ -14,6 +14,7 @@ export async function setupGcpProject(projectID) {
/****************************************
* Prompt user for Remotion version
****************************************/
+ // TODO: Should take version from Remotion
const remotionVersion = await remotionVersionPrompt();
/****************************************
diff --git a/packages/cloudrun/readme.md b/packages/cloudrun/readme.md
index fb923db73a..c7b105ba42 100644
--- a/packages/cloudrun/readme.md
+++ b/packages/cloudrun/readme.md
@@ -289,7 +289,6 @@ To render a still, send a POST request to the URL with the following body:
### deploy cloud-run command
-- add remotionVersion validation
- add cpu and memory limit arguments
- returning error from deployNewCloudRun - typed as any, can I get a type from the protos?
- sprinkle quietFlagProvided() throughout
@@ -300,7 +299,6 @@ To render a still, send a POST request to the URL with the following body:
### create sites command
-- add remotionVersion validation
- sprinkle quietFlagProvided() throughout
- time for uploading to GCP Storage Bucket is always 0ms
- add LS, RM, RMALL subcommands
diff --git a/packages/cloudrun/src/api/check-if-service-exists.ts b/packages/cloudrun/src/api/check-if-service-exists.ts
index 9cf500001c..ad998f79b5 100644
--- a/packages/cloudrun/src/api/check-if-service-exists.ts
+++ b/packages/cloudrun/src/api/check-if-service-exists.ts
@@ -7,7 +7,6 @@ import {validateProjectID} from '../shared/validate-project-id';
import {getCloudRunClient} from './helpers/get-cloud-run-client';
export type CheckIfServiceExistsInput = {
- remotionVersion: string;
memoryLimit: string;
cpuLimit: string;
timeoutSeconds: number;
@@ -24,7 +23,6 @@ export type CheckIfServiceExistsInput = {
* @returns {Promise<protos.google.cloud.run.v2.IService>} If the service exists, the service object will be returned, otherwise false.
*/
export const checkIfServiceExists = async ({
- remotionVersion,
memoryLimit,
cpuLimit,
timeoutSeconds,
@@ -39,7 +37,6 @@ export const checkIfServiceExists = async ({
const parent = `projects/${projectID}/locations/${region}`;
const serviceName = generateServiceName({
- remotionVersion,
memoryLimit,
cpuLimit,
timeoutSeconds,
diff --git a/packages/cloudrun/src/api/deploy-service.ts b/packages/cloudrun/src/api/deploy-service.ts
index 9f2277f58b..ad1b88e407 100644
--- a/packages/cloudrun/src/api/deploy-service.ts
+++ b/packages/cloudrun/src/api/deploy-service.ts
@@ -32,7 +32,6 @@ export type DeployServiceOutput = {
* @returns {Promise<IService>} An object that contains the `functionName` property
*/
export const deployService = async ({
- remotionVersion,
performImageVersionValidation = true, // default value set here
memoryLimit,
cpuLimit,
@@ -43,7 +42,7 @@ export const deployService = async ({
validateGcpRegion(region);
validateProjectID(projectID);
if (performImageVersionValidation) {
- validateImageRemotionVersion(remotionVersion);
+ validateImageRemotionVersion();
}
if (!memoryLimit) {
@@ -63,7 +62,6 @@ export const deployService = async ({
const cloudRunClient = getCloudRunClient();
const existingService = await checkIfServiceExists({
- remotionVersion,
memoryLimit,
cpuLimit,
timeoutSeconds,
@@ -75,7 +73,6 @@ export const deployService = async ({
memoryLimit,
cpuLimit,
timeoutSeconds,
- remotionVersion,
});
if (existingService) {
@@ -92,7 +89,6 @@ export const deployService = async ({
service: {
// service structure: https://googleapis.dev/nodejs/run/latest/google.cloud.run.v2.IService.html
template: constructServiceTemplate({
- remotionVersion,
memoryLimit,
cpuLimit,
timeoutSeconds,
diff --git a/packages/cloudrun/src/api/get-services.ts b/packages/cloudrun/src/api/get-services.ts
index ea654792a8..b0737846d0 100644
--- a/packages/cloudrun/src/api/get-services.ts
+++ b/packages/cloudrun/src/api/get-services.ts
@@ -1,5 +1,4 @@
import {JWT} from 'google-auth-library';
-import {VERSION} from 'remotion/version';
import type {GcpRegion} from '../pricing/gcp-regions';
import {RENDER_SERVICE_PREFIX} from '../shared/constants';
import {serviceVersionString} from '../shared/service-version-string';
@@ -99,9 +98,7 @@ export const getServices = async (
if (options.compatibleOnly) {
remotionServices = services.filter((s) => {
return s.name?.startsWith(
- `${parent}/services/${RENDER_SERVICE_PREFIX}--${serviceVersionString(
- VERSION
- )}--`
+ `${parent}/services/${RENDER_SERVICE_PREFIX}--${serviceVersionString()}--`
);
});
} else {
diff --git a/packages/cloudrun/src/api/helpers/construct-service-deploy-request.ts b/packages/cloudrun/src/api/helpers/construct-service-deploy-request.ts
index f1e77d873e..62aa940d82 100644
--- a/packages/cloudrun/src/api/helpers/construct-service-deploy-request.ts
+++ b/packages/cloudrun/src/api/helpers/construct-service-deploy-request.ts
@@ -1,10 +1,10 @@
+import {VERSION} from 'remotion/version';
+
export const constructServiceTemplate = ({
- remotionVersion,
memoryLimit,
cpuLimit,
timeoutSeconds,
}: {
- remotionVersion: string;
memoryLimit: string;
cpuLimit: string;
timeoutSeconds: number;
@@ -15,7 +15,7 @@ export const constructServiceTemplate = ({
},
containers: [
{
- image: `us-docker.pkg.dev/remotion-dev/cloud-run/render:${remotionVersion}`,
+ image: `us-docker.pkg.dev/remotion-dev/cloud-run/render:${VERSION}`,
resources: {
limits: {
memory: memoryLimit,
diff --git a/packages/cloudrun/src/api/speculate-service-name.ts b/packages/cloudrun/src/api/speculate-service-name.ts
index 04cbe72a18..9229b74ba7 100644
--- a/packages/cloudrun/src/api/speculate-service-name.ts
+++ b/packages/cloudrun/src/api/speculate-service-name.ts
@@ -13,17 +13,14 @@ export const speculateFunctionName = ({
memoryLimit,
cpuLimit,
timeoutSeconds,
- remotionVersion,
}: {
memoryLimit: string;
cpuLimit: string;
timeoutSeconds: number;
- remotionVersion: string;
}): string => {
return generateServiceName({
memoryLimit,
cpuLimit,
timeoutSeconds,
- remotionVersion,
});
};
diff --git a/packages/cloudrun/src/cli/commands/services/deploy.ts b/packages/cloudrun/src/cli/commands/services/deploy.ts
index c57e208b4a..13635b9d11 100644
--- a/packages/cloudrun/src/cli/commands/services/deploy.ts
+++ b/packages/cloudrun/src/cli/commands/services/deploy.ts
@@ -15,7 +15,6 @@ export const CLOUD_RUN_DEPLOY_SUBCOMMAND = 'deploy';
export const cloudRunDeploySubcommand = async () => {
const region = getGcpRegion();
const projectID = process.env.REMOTION_GCP_PROJECT_ID as string;
- const remotionVersion = parsedCloudrunCli['remotion-version'] ?? VERSION;
const allowUnauthenticated =
parsedCloudrunCli['allow-unauthenticated'] ?? false;
let memoryLimit = parsedCloudrunCli.memoryLimit ?? '2Gi';
@@ -31,7 +30,7 @@ export const cloudRunDeploySubcommand = async () => {
`
Validating Deployment of Cloud Run Service:
- Remotion Version = ${remotionVersion}
+ Remotion Version = ${VERSION}
Service Memory Limit = ${memoryLimit}
Service CPU Limit = ${cpuLimit}
Service Timeout In Seconds = ${timeoutSeconds}
@@ -46,7 +45,7 @@ Validating Deployment of Cloud Run Service:
}
validateGcpRegion(region);
- await validateImageRemotionVersion(remotionVersion);
+ await validateImageRemotionVersion();
if (projectID === undefined) {
Log.error(`REMOTION_GCP_PROJECT_ID not found in the .env file.`);
@@ -61,7 +60,7 @@ Validating Deployment of Cloud Run Service:
try {
const deployResult = await deployService({
- remotionVersion,
+ remotionVersion: VERSION,
performImageVersionValidation: false, // this is already performed above
memoryLimit,
cpuLimit,
@@ -127,14 +126,13 @@ Service Already Deployed! Check GCP Console for Cloud Run URL.
deployResult.fullName,
allowUnauthenticated
);
- } catch (e: any) {
+ } catch (e) {
Log.error(
CliInternals.chalk.red(
`Failed to deploy service - ${generateServiceName({
memoryLimit,
cpuLimit,
timeoutSeconds,
- remotionVersion,
})}.`
)
);
diff --git a/packages/cloudrun/src/shared/generate-service-name.ts b/packages/cloudrun/src/shared/generate-service-name.ts
index 0009a4de71..dcf305eda8 100644
--- a/packages/cloudrun/src/shared/generate-service-name.ts
+++ b/packages/cloudrun/src/shared/generate-service-name.ts
@@ -5,12 +5,10 @@ export const generateServiceName = ({
memoryLimit,
cpuLimit,
timeoutSeconds,
- remotionVersion,
}: {
memoryLimit: string;
cpuLimit: string;
timeoutSeconds: number;
- remotionVersion: string;
}): string => {
const sanitisedCPU = cpuLimit.replace(/\./g, '-').substring(0, 10);
@@ -21,7 +19,7 @@ export const generateServiceName = ({
return [
RENDER_SERVICE_PREFIX,
- serviceVersionString(remotionVersion),
+ serviceVersionString(),
`mem${sanitisedMem}`,
`cpu${sanitisedCPU}`,
`t-${String(timeoutSeconds)}`,
diff --git a/packages/cloudrun/src/shared/service-version-string.ts b/packages/cloudrun/src/shared/service-version-string.ts
index a79c969763..e4640656c5 100644
--- a/packages/cloudrun/src/shared/service-version-string.ts
+++ b/packages/cloudrun/src/shared/service-version-string.ts
@@ -1,3 +1,5 @@
-export const serviceVersionString = (version: string) => {
- return version.replace(/\./g, '-').replace(/\+/g, '-').substring(0, 10);
+import {VERSION} from 'remotion/version';
+
+export const serviceVersionString = () => {
+ return VERSION.replace(/\./g, '-').replace(/\+/g, '-').substring(0, 10);
};
diff --git a/packages/cloudrun/src/shared/validate-image-remotion-version.ts b/packages/cloudrun/src/shared/validate-image-remotion-version.ts
index 744e47f0a4..c0c08d7a30 100644
--- a/packages/cloudrun/src/shared/validate-image-remotion-version.ts
+++ b/packages/cloudrun/src/shared/validate-image-remotion-version.ts
@@ -1,6 +1,7 @@
import {ArtifactRegistryClient} from '@google-cloud/artifact-registry';
+import {VERSION} from 'remotion/version';
-export const validateImageRemotionVersion = async (remotionVersion: string) => {
+export const validateImageRemotionVersion = async () => {
const client = new ArtifactRegistryClient();
const listedTags = await client.listTags({
parent:
@@ -8,13 +9,13 @@ export const validateImageRemotionVersion = async (remotionVersion: string) => {
});
for (const tag of listedTags[0]) {
- if (remotionVersion === tag.name?.split('/').pop()) {
+ if (VERSION === tag.name?.split('/').pop()) {
// if match is found, exit the function
return;
}
}
throw new Error(
- `The tag for Remotion version ${remotionVersion} was not found in the cloud run registry image.`
+ `The tag for Remotion version ${VERSION} was not found in the cloud run registry image.`
);
};
diff --git a/packages/docs/docs/cloudrun/deployservice.md b/packages/docs/docs/cloudrun/deployservice.md
index ee744d3164..fcc402bb1f 100644
--- a/packages/docs/docs/cloudrun/deployservice.md
+++ b/packages/docs/docs/cloudrun/deployservice.md
@@ -19,7 +19,6 @@ If a service with the same Remotion version, memory limit, cpu limit and timeout
import { deployService } from "@remotion/cloudrun";
const { shortName } = await deployService({
- remotionVersion: "3.3.82",
memoryLimit: "2Gi",
cpuLimit: "2.0",
timeoutSeconds: 500,
@@ -33,10 +32,6 @@ console.log(shortName);
An object with the following properties:
-### `remotionVersion`
-
-The Remotion version of the service. Remotion is versioning the Cloud Run service and a render can only be triggered from a version of `@remotion/cloudrun` that is matching the service.
-
### `memoryLimit`
The upper bound on the amount of RAM that the Cloud Run service can consume. By default we recommend a value of 2GiB. You may increase or decrease it depending on how memory-consuming your video is. The minimum allowed number is `512MiB`, the maximum allowed number is `32GiB`. Since the costs of Remotion Cloud Run is directly proportional to the amount of RAM, we recommend to keep this amount as low as possible. As the Memory limit is raised, there is a [corresponding minimum CPU Limit](https://cloud.google.com/run/docs/configuring/memory-limits#cpu-minimum) that must be observed.
diff --git a/packages/docs/docs/cloudrun/getServiceinfo.md b/packages/docs/docs/cloudrun/getServiceinfo.md
index 41c1d1a736..226379e481 100644
--- a/packages/docs/docs/cloudrun/getServiceinfo.md
+++ b/packages/docs/docs/cloudrun/getServiceinfo.md
@@ -28,7 +28,7 @@ console.log(info.serviceName); // remotion--3-3-82--mem512mi--cpu1-0--t-500
console.log(info.timeoutInSeconds); // 500
console.log(info.memoryLimit); // 1500
console.log(info.cpuLimit); // 2048
-console.log(info.remotionVersion); // '2021-07-14'
+console.log(info.remotionVersion); // '4.0.1'
console.log(info.uri); // "https://remotion--3-3-82--mem512mi--cpu1-0--t-500-1a2b3c4d5e-ue.a.run.app"
console.log(info.region); // "us-east1"
console.log(info.consoleUrl); // "https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-82--mem512mi--cpu1-0--t-500/logs"
diff --git a/packages/docs/docs/cloudrun/getservices.md b/packages/docs/docs/cloudrun/getservices.md
index 766dcb284d..3ddb546a45 100644
--- a/packages/docs/docs/cloudrun/getservices.md
+++ b/packages/docs/docs/cloudrun/getservices.md
@@ -36,7 +36,7 @@ for (const service of info) {
console.log(service.timeoutInSeconds); // 300
console.log(service.memoryLimit); // 512Mi
console.log(service.cpuLimit); // 1.0
- console.log(service.remotionVersion); // "3.3.82"
+ console.log(service.remotionVersion); // "4.0.1"
console.log(service.uri); // "https://remotion--3-3-82--mem512mi--cpu1-0--t-300-1a2b3c4d5e-ue.a.run.app"
console.log(service.region); // "us-east1"
console.log(service.consoleUrl); // "https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-82--mem512mi--cpu1-0--t-300/logs"
@@ -67,7 +67,7 @@ for (const service of info) {
console.log(service.timeoutInSeconds); // 1100
console.log(service.memoryLimit); // 2Gi
console.log(service.cpuLimit); // 2
- console.log(service.remotionVersion); // "3.3.82"
+ console.log(service.remotionVersion); // "4.0.1"
console.log(service.uri); // "https://remotion--3-3-82--mem2gi--cpu2--t-1100-1a2b3c4d5e-uc.a.run.app"
console.log(service.region); // "us-central1"
console.log(service.consoleUrl); // "https://console.cloud.google.com/run/detail/us-central1/remotion--3-3-82--mem2gi--cpu2--t-1100/logs"
diff --git a/packages/docs/docs/cloudrun/setup.md b/packages/docs/docs/cloudrun/setup.md
index df0668c8e4..645be6dbde 100644
--- a/packages/docs/docs/cloudrun/setup.md
+++ b/packages/docs/docs/cloudrun/setup.md
@@ -166,7 +166,6 @@ import { deployService } from "@remotion/cloudrun";
// ---cut---
const deployResult = await deployService({
- remotionVersion: "3.3.75",
projectID: "my-remotion-project",
region: "us-east1",
});