Skip to content

🎥 Make videos programmatically with React

consistent cli display of service pre-deploy, deploy, list

Matt McGillivray18d58dc6e9a8
diff --git a/packages/cloudrun/package.json b/packages/cloudrun/package.json
index 5de4cf4c0a..c84584fb2f 100644
--- a/packages/cloudrun/package.json
+++ b/packages/cloudrun/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/cloudrun",
- "version": "3.3.94",
+ "version": "3.3.95",
"description": "GCP Cloud Run alternative to lambda rendering",
"main": "dist/index.js",
"scripts": {
@@ -49,4 +49,4 @@
]
}
}
-}
+}
\ No newline at end of file
diff --git a/packages/cloudrun/src/api/deploy-service.ts b/packages/cloudrun/src/api/deploy-service.ts
index 6bee3d2b12..094d8d961b 100644
--- a/packages/cloudrun/src/api/deploy-service.ts
+++ b/packages/cloudrun/src/api/deploy-service.ts
@@ -18,7 +18,7 @@ export type DeployServiceInput = {
export type DeployServiceOutput = {
fullName: string | null | undefined;
shortName: string | null | undefined;
- uri: string | null | undefined;
+ uri: string;
alreadyExists: boolean;
};
@@ -78,7 +78,7 @@ export const deployService = async ({
return {
fullName: `projects/${projectID}/locations/${region}/services/${serviceName}`,
shortName: serviceName,
- uri: null,
+ uri: existingService.uri as string,
alreadyExists: true,
};
}
@@ -103,7 +103,7 @@ export const deployService = async ({
return {
fullName: response.name,
shortName: serviceName,
- uri: response.uri,
+ uri: response.uri as string,
alreadyExists: false,
};
};
diff --git a/packages/cloudrun/src/cli/commands/services/deploy.ts b/packages/cloudrun/src/cli/commands/services/deploy.ts
index d296f34431..923e315e27 100644
--- a/packages/cloudrun/src/cli/commands/services/deploy.ts
+++ b/packages/cloudrun/src/cli/commands/services/deploy.ts
@@ -1,5 +1,6 @@
import {CliInternals} from '@remotion/cli';
import {VERSION} from 'remotion/version';
+import {displayServiceInfo, LEFT_COL} from '.';
import {deployService} from '../../../api/deploy-service';
import {generateServiceName} from '../../../shared/generate-service-name';
import {validateGcpRegion} from '../../../shared/validate-gcp-region';
@@ -24,16 +25,17 @@ export const cloudRunDeploySubcommand = async () => {
`
Validating Deployment of Cloud Run Service:
-Remotion Version = ${VERSION}
-Service Memory Limit = ${memoryLimit}
-Service CPU Limit = ${cpuLimit}
-Service Timeout In Seconds = ${timeoutSeconds}
-Project Name = ${projectID}
-Region = ${region}
+${[
+ 'Remotion Version: '.padEnd(LEFT_COL, ' ') + ' ' + VERSION,
+ 'Memory Limit: '.padEnd(LEFT_COL, ' ') + ' ' + memoryLimit,
+ 'CPU Limit: '.padEnd(LEFT_COL, ' ') + ' ' + cpuLimit,
+ 'Timeout: '.padEnd(LEFT_COL, ' ') + ' ' + timeoutSeconds,
+ 'Project Name: '.padEnd(LEFT_COL, ' ') + ' ' + projectID,
+ 'Region: '.padEnd(LEFT_COL, ' ') + ' ' + region,
+].join('\n')}
`.trim()
)
);
-
Log.info();
}
@@ -75,6 +77,8 @@ Region = ${region}
Log.error('service uri not returned from Cloud Run API.');
}
+ const consoleUrl = `https://console.cloud.google.com/run/detail/${region}/${deployResult.shortName}/logs`;
+
if (deployResult.alreadyExists) {
Log.info();
@@ -84,11 +88,18 @@ Region = ${region}
Log.info(
CliInternals.chalk.blueBright(
`
-Service Already Deployed! Check GCP Console for Cloud Run URL.
+Service already exists, skipping deployment;
-Full Service Name = ${deployResult.fullName}
-Project = ${projectID}
-GCP Console URL = https://console.cloud.google.com/run/detail/${region}/${deployResult.shortName}/logs
+${displayServiceInfo({
+ serviceName: deployResult.shortName,
+ timeoutInSeconds: timeoutSeconds,
+ memoryLimit,
+ cpuLimit,
+ remotionVersion: VERSION,
+ uri: deployResult.uri,
+ region,
+ consoleUrl,
+})}
`.trim()
)
);
@@ -103,11 +114,18 @@ GCP Console URL = https://console.cloud.google.com/run/detail/${region}/${deploy
CliInternals.chalk.blueBright(
`
Cloud Run Deployed!
-Full Service Name = ${deployResult.fullName}
-Cloud Run URL = ${deployResult.uri}
-Project = ${projectID}
-GCP Console URL = https://console.cloud.google.com/run/detail/${region}/${deployResult.shortName}/logs
- `.trim()
+
+${displayServiceInfo({
+ serviceName: deployResult.shortName,
+ timeoutInSeconds: timeoutSeconds,
+ memoryLimit,
+ cpuLimit,
+ remotionVersion: VERSION,
+ uri: deployResult.uri,
+ region,
+ consoleUrl,
+})}
+ `.trim()
)
);
}
diff --git a/packages/cloudrun/src/cli/commands/services/index.ts b/packages/cloudrun/src/cli/commands/services/index.ts
index 61ecc5e3d0..163cb31b5a 100644
--- a/packages/cloudrun/src/cli/commands/services/index.ts
+++ b/packages/cloudrun/src/cli/commands/services/index.ts
@@ -10,8 +10,9 @@ import {servicesRmallCommand, SERVICES_RMALL_SUBCOMMAND} from './rmall';
export const SERVICES_COMMAND = 'services';
+export const LEFT_COL = 18;
+
export const displayServiceInfo = (service: ServiceInfo) => {
- const LEFT_COL = 18;
return [
'Service name: '.padEnd(LEFT_COL, ' ') + ' ' + service.serviceName,
'Version: '.padEnd(LEFT_COL, ' ') + ' ' + service.remotionVersion,
diff --git a/packages/docs/docs/cloudrun/cli/services.md b/packages/docs/docs/cloudrun/cli/services.md
index 639069b2c3..31b1d2e0d5 100644
--- a/packages/docs/docs/cloudrun/cli/services.md
+++ b/packages/docs/docs/cloudrun/cli/services.md
@@ -29,27 +29,23 @@ Creates a new service in your GCP project. If a service exists in the same regio
Example output
</summary>
<pre>
-Validating Deployment of Cloud Run Service:
-
-Remotion Version = 3.3.82
-Service Memory Limit = 512Mi
-Service CPU Limit = 1.0
-Service Timeout In Seconds = 300
-Project Name = remotion-6
-Region = us-east1
-
-Deploying Cloud Run Service...
-
-<br/>
-Cloud Run Deployed!
-
-Full Service Name = projects/remotion-6/locations/us-east1/services/remotion--3-3-82--mem512mi--cpu1-0--t-300
-Cloud Run URL = https://remotion--3-3-82--mem512mi--cpu1-0--t-300-abcdefg-ue.a.run.app
-Project = remotion-6
-GCP Console URL = https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-82--mem512mi--cpu1-0--t-300/logs
-
-<br/>
-
+Validating Deployment of Cloud Run Service:<br/><br/>
+Remotion Version: 3.3.95<br/>
+Memory Limit: 2Gi<br/>
+CPU Limit: 1.0<br/>
+Timeout: 300<br/>
+Project Name: remotion-example<br/>
+Region: us-east1<br/><br/>
+Deploying Cloud Run Service...<br/><br/><br/>
+Cloud Run Deployed!<br/><br/>
+Service name: remotion--3-3-95--mem512mi--cpu2--t-1200<br/>
+Version: 3.3.95<br/>
+CPU Limit: 2<br/>
+Memory Limit: 512Mi<br/>
+Timeout: 1200sec<br/>
+Region: us-east1<br/>
+Service URL: https://remotion--3-3-95--mem512mi--cpu2--t-1200-1a2b3c4d5e-ue.a.run.app<br/>
+GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-95--mem512mi--cpu2--t-1200/logs<br/><br/>
</pre>
</details>
@@ -91,14 +87,14 @@ Example output
</summary>
<pre>
2 services in us-east1<br/><br/>
-Service name: remotion--3-3-92--mem512mi--cpu2--t-1200<br/>
-Version: 3.3.92<br/>
+Service name: remotion--3-3-95--mem512mi--cpu2--t-1200<br/>
+Version: 3.3.95<br/>
CPU Limit: 2<br/>
Memory Limit: 512Mi<br/>
Timeout: 1200sec<br/>
Region: us-east1<br/>
-Service URL: https://remotion--3-3-92--mem512mi--cpu2--t-1200-1a2b3c4d5e-ue.a.run.app<br/>
-GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-92--mem512mi--cpu2--t-1200/logs<br/><br/>
+Service URL: https://remotion--3-3-95--mem512mi--cpu2--t-1200-1a2b3c4d5e-ue.a.run.app<br/>
+GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-95--mem512mi--cpu2--t-1200/logs<br/><br/>
Service name: remotion--3-3-82--mem512mi--cpu1-0--t-800<br/>
Version: 3.3.82<br/>
CPU Limit: 1.0<br/>
@@ -136,14 +132,14 @@ Timeout: 800sec<br/>
Region: us-central1<br/>
Service URL: https://remotion--3-3-82--mem512mi--cpu1-0--t-800-1a2b3c4d5e-uc.a.run.app<br/>
GCP Console URL: https://console.cloud.google.com/run/detail/us-central1/remotion--3-3-82--mem512mi--cpu1-0--t-800/logs<br/><br/>
-Service name: remotion--3-3-92--mem512mi--cpu2--t-1200<br/>
-Version: 3.3.92<br/>
+Service name: remotion--3-3-95--mem512mi--cpu2--t-1200<br/>
+Version: 3.3.95<br/>
CPU Limit: 2<br/>
Memory Limit: 512Mi<br/>
Timeout: 1200sec<br/>
Region: us-east1<br/>
-Service URL: https://remotion--3-3-92--mem512mi--cpu2--t-1200-1a2b3c4d5e-ue.a.run.app<br/>
-GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-92--mem512mi--cpu2--t-1200/logs<br/><br/>
+Service URL: https://remotion--3-3-95--mem512mi--cpu2--t-1200-1a2b3c4d5e-ue.a.run.app<br/>
+GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-95--mem512mi--cpu2--t-1200/logs<br/><br/>
Service name: remotion--3-3-82--mem512mi--cpu1-0--t-800<br/>
Version: 3.3.82<br/>
CPU Limit: 1.0<br/>
@@ -214,16 +210,16 @@ Example output
</summary>
<pre>
2 services in us-east1<br/><br/>
-Service name: remotion--3-3-92--mem512mi--cpu2--t-1200<br/>
-Version: 3.3.92<br/>
+Service name: remotion--3-3-95--mem512mi--cpu2--t-1200<br/>
+Version: 3.3.95<br/>
CPU Limit: 2<br/>
Memory Limit: 512Mi<br/>
Timeout: 1200sec<br/>
Region: us-east1<br/>
-Service URL: https://remotion--3-3-92--mem512mi--cpu2--t-1200-1a2b3c4d5e-ue.a.run.app<br/>
-GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-92--mem512mi--cpu2--t-1200/logs<br/><br/>
+Service URL: https://remotion--3-3-95--mem512mi--cpu2--t-1200-1a2b3c4d5e-ue.a.run.app<br/>
+GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-95--mem512mi--cpu2--t-1200/logs<br/><br/>
Delete? (Y/n) n<br/>
-Skipping service - remotion--3-3-92--mem512mi--cpu2--t-1200.<br/><br/>
+Skipping service - remotion--3-3-95--mem512mi--cpu2--t-1200.<br/><br/>
Service name: remotion--3-3-82--mem512mi--cpu1-0--t-800<br/>
Version: 3.3.82<br/>
CPU Limit: 1.0<br/>
@@ -264,16 +260,16 @@ Region: us-central1<br/>
Service URL: https://remotion--3-3-82--mem512mi--cpu1-0--t-800-1a2b3c4d5e-ue.a.run.app<br/>
GCP Console URL: https://console.cloud.google.com/run/detail/us-central1/remotion--3-3-82--mem512mi--cpu1-0--t-800/logs<br/><br/>
Delete? (Y/n) n<br/>
-Service name: remotion--3-3-92--mem512mi--cpu2--t-1200<br/>
-Version: 3.3.92<br/>
+Service name: remotion--3-3-95--mem512mi--cpu2--t-1200<br/>
+Version: 3.3.95<br/>
CPU Limit: 2<br/>
Memory Limit: 512Mi<br/>
Timeout: 1200sec<br/>
Region: us-east1<br/>
-Service URL: https://remotion--3-3-92--mem512mi--cpu2--t-1200-1a2b3c4d5e-ue.a.run.app<br/>
-GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-92--mem512mi--cpu2--t-1200/logs<br/><br/>
+Service URL: https://remotion--3-3-95--mem512mi--cpu2--t-1200-1a2b3c4d5e-ue.a.run.app<br/>
+GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-95--mem512mi--cpu2--t-1200/logs<br/><br/>
Delete? (Y/n) n<br/>
-Skipping service - remotion--3-3-92--mem512mi--cpu2--t-1200.<br/><br/>
+Skipping service - remotion--3-3-95--mem512mi--cpu2--t-1200.<br/><br/>
Service name: remotion--3-3-82--mem512mi--cpu1-0--t-800<br/>
Version: 3.3.82<br/>
CPU Limit: 1.0<br/>
diff --git a/packages/docs/docs/cloudrun/cli/sites.md b/packages/docs/docs/cloudrun/cli/sites.md
index f24af8118f..04d7f1e461 100644
--- a/packages/docs/docs/cloudrun/cli/sites.md
+++ b/packages/docs/docs/cloudrun/cli/sites.md
@@ -45,9 +45,11 @@ Example output
(2/3) [====================] Created bucket 457ms<br/>
(3/3) [====================] Uploaded to GCP Storage Bucket 25118ms<br/>
<br/>
-Deployed to GCP Cloud Storage!<br/>
-Serve URL: https://storage.googleapis.com/remotioncloudrun-12345/sites/mySite123/index.html<br/>
-Site Name: mySite123<br/>
+Deployed to GCP Cloud Storage!<br/><br/>
+Site: mySite123<br/>
+Bucket: remotioncloudrun-12345<br/>
+Region: us-east1<br/>
+Serve Url: https://storage.googleapis.com/remotioncloudrun-12345/sites/mySite123/index.html<br/>
</pre>
</details>
@@ -93,7 +95,7 @@ Get a list of sites. The URL that is printed can be passed to the `render` comma
Example output
</summary>
<pre>
-2 sites in us-east1, in the remotion-6 project.<br/><br/>
+2 sites in us-east1, in the remotion-example project.<br/><br/>
Site: another-site<br/>
Bucket: remotioncloudrun-12345<br/>
Region: us-east1<br/>
@@ -122,7 +124,7 @@ npx remotion cloudrun sites ls --all-regions
Example output
</summary>
<pre>
-3 sites in all regions, in the remotion-6 project.<br/><br/>
+3 sites in all regions, in the remotion-example project.<br/><br/>
Site: another-site<br/>
Bucket: remotioncloudrun-12345<br/>
Region: us-east1<br/>
diff --git a/packages/zod-types/package.json b/packages/zod-types/package.json
index 67cf7a14e7..f6ed99a735 100644
--- a/packages/zod-types/package.json
+++ b/packages/zod-types/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/zod-types",
- "version": "3.3.94",
+ "version": "3.3.95",
"description": "A color validator for Zod",
"main": "dist/cjs/index.js",
"types": "dist/cjs/index.d.ts",
@@ -54,4 +54,4 @@
"require": "./dist/cjs/index.js"
}
}
-}
+}
\ No newline at end of file