π₯ Make videos programmatically with React
cleaned up permissions, finished cli docs
Matt McGillivray42b21ce58f0b
diff --git a/packages/cloudrun/src/cli/commands/permissions/validate.ts b/packages/cloudrun/src/cli/commands/permissions.tssimilarity index 72%rename from packages/cloudrun/src/cli/commands/permissions/validate.tsrename to packages/cloudrun/src/cli/commands/permissions.tsindex 89b18c3363..8c04744729 100644--- a/packages/cloudrun/src/cli/commands/permissions/validate.ts+++ b/packages/cloudrun/src/cli/commands/permissions.ts@@ -2,12 +2,12 @@ import {CliInternals} from '@remotion/cli';import {logPermissionOutput,simulatePermissions,-} from '../../../api/iam-validation/simulate';-import {Log} from '../../log';+} from '../../api/iam-validation/simulate';+import {Log} from '../log';-export const VALIDATE_SUBCOMMAND = 'validate';+export const PERMISSIONS_COMMAND = 'permissions';-export const validateSubcommand = async () => {+export const permissionsCommand = async () => {try {Log.info(CliInternals.chalk.blueBright(diff --git a/packages/cloudrun/src/cli/commands/permissions/index.ts b/packages/cloudrun/src/cli/commands/permissions/index.tsdeleted file mode 100644index 6305208f43..0000000000--- a/packages/cloudrun/src/cli/commands/permissions/index.ts+++ /dev/null@@ -1,58 +0,0 @@-import {CliInternals} from '@remotion/cli';-import {BINARY_NAME} from '../../../shared/constants';-import {quit} from '../../helpers/quit';-import {Log} from '../../log';-// import {roleSubcommand, ROLE_SUBCOMMAND} from './role';-// import {userSubcommand, USER_SUBCOMMAND} from './user';-import {validateSubcommand, VALIDATE_SUBCOMMAND} from './validate';--export const POLICIES_COMMAND = 'permissions';--const printPoliciesHelp = () => {- Log.info(`${BINARY_NAME} ${POLICIES_COMMAND} <subcommand>`);- Log.info();- Log.info('Available subcommands:');- Log.info('');- // Log.info(`${BINARY_NAME} ${POLICIES_COMMAND} ${USER_SUBCOMMAND}`);- // Log.info(- // CliInternals.chalk.gray(- // 'Print the suggested policy to be applied to the user that is attached to the access token.'- // )- // );- // Log.info();- // Log.info(`${BINARY_NAME} ${POLICIES_COMMAND} ${ROLE_SUBCOMMAND}`);- // Log.info(- // CliInternals.chalk.gray(- // 'Print the suggested policy to be applied to the role that is attached to the lambda function.'- // )- // );- // Log.info();- Log.info(`${BINARY_NAME} ${POLICIES_COMMAND} ${VALIDATE_SUBCOMMAND}`);- Log.info(- CliInternals.chalk.gray(- 'Validate that the current permissions on the service account are correct in GCP.'- )- );-};--export const policiesCommand = (args: string[]) => {- // if (args[0] === USER_SUBCOMMAND) {- // return userSubcommand();- // }-- // if (args[0] === ROLE_SUBCOMMAND) {- // return roleSubcommand();- // }-- if (args[0] === VALIDATE_SUBCOMMAND) {- return validateSubcommand();- }-- if (args[0]) {- Log.error(`Subcommand ${args[0]} not found.`);- printPoliciesHelp();- quit(1);- }-- printPoliciesHelp();-};diff --git a/packages/cloudrun/src/cli/help.ts b/packages/cloudrun/src/cli/help.tsindex a9a9cc11f2..7ce860cd2a 100644--- a/packages/cloudrun/src/cli/help.ts+++ b/packages/cloudrun/src/cli/help.ts@@ -1,5 +1,7 @@import {CliInternals} from '@remotion/cli';import {BINARY_NAME} from '../shared/constants';+import {PERMISSIONS_COMMAND} from './commands/permissions';+import {REGIONS_COMMAND} from './commands/regions';import {RENDER_COMMAND} from './commands/render';import {SERVICES_COMMAND} from './commands/services';import {SITES_COMMAND} from './commands/sites';@@ -17,23 +19,29 @@ export const printHelp = () => {Log.info('Available commands:');Log.info('');- // Log.info(`${BINARY_NAME} ${RENDER_COMMAND} <s3-url> <composition-id>`);- // Log.info(CliInternals.chalk.gray('Render a video in the cloud.'));+ Log.info();+ Log.info(`${BINARY_NAME} ${RENDER_COMMAND}`);+ Log.info(+ CliInternals.chalk.gray('Render Remotion media/still on GCP Cloud Run.')+ );- // Log.info(`${BINARY_NAME} ${STILL_COMMAND} <s3-url> <composition-id>`);- // Log.info(CliInternals.chalk.gray('Render a still image in the cloud.'));+ Log.info();+ Log.info(`${BINARY_NAME} ${SERVICES_COMMAND}`);+ Log.info(+ CliInternals.chalk.gray('Deploy and manage Cloud Run services on GCP.')+ );Log.info();Log.info(`${BINARY_NAME} ${SITES_COMMAND}`);Log.info(CliInternals.chalk.gray('Deploy and manage Remotion projects.'));Log.info();- Log.info(`${BINARY_NAME} ${SERVICES_COMMAND}`);+ Log.info(`${BINARY_NAME} ${PERMISSIONS_COMMAND}`);Log.info(- CliInternals.chalk.gray('Deploy and manage Cloud Run services on GCP.')+ CliInternals.chalk.gray('View and validate required GCP permissions.'));Log.info();- Log.info(`${BINARY_NAME} ${RENDER_COMMAND}`);- Log.info(CliInternals.chalk.gray('Render Remotion media on GCP Cloud Run.'));+ Log.info(`${BINARY_NAME} ${REGIONS_COMMAND}`);+ Log.info(CliInternals.chalk.gray('Show the list of GCP regions supported.'));};diff --git a/packages/cloudrun/src/cli/index.ts b/packages/cloudrun/src/cli/index.tsindex 2d343c5841..d0ee4a360f 100644--- a/packages/cloudrun/src/cli/index.ts+++ b/packages/cloudrun/src/cli/index.ts@@ -3,7 +3,7 @@ import {compositionsCommand,COMPOSITIONS_COMMAND,} from './commands/compositions';-import {policiesCommand, POLICIES_COMMAND} from './commands/permissions';+import {permissionsCommand, PERMISSIONS_COMMAND} from './commands/permissions';import {regionsCommand, REGIONS_COMMAND} from './commands/regions';import {renderCommand, RENDER_COMMAND} from './commands/render';import {servicesCommand, SERVICES_COMMAND} from './commands/services';@@ -38,8 +38,8 @@ const matchCommand = (args: string[], remotionRoot: string) => {return regionsCommand();}- if (args[0] === POLICIES_COMMAND) {- return policiesCommand(args.slice(1));+ if (args[0] === PERMISSIONS_COMMAND) {+ return permissionsCommand();}if (args[0] === 'deploy') {@@ -57,7 +57,7 @@ export const executeCommand = async (args: string[], remotionRoot: string) => {await matchCommand(args, remotionRoot);} catch (err) {const error = err as Error;- // catch errors and print a message. Check lambda cli for example+ // todo: catch errors and print a message. Check lambda cli for exampleLog.error(error.stack);quit(1);diff --git a/packages/docs/docs/cloudrun/cli.md b/packages/docs/docs/cloudrun/cli.mdindex ed7d16653c..e443d69120 100644--- a/packages/docs/docs/cloudrun/cli.md+++ b/packages/docs/docs/cloudrun/cli.md@@ -13,6 +13,6 @@ To use the Remotion Cloudrun CLI, you first need to [install it](/docs/cloudrun/- [sites](/docs/cloudrun/cli/sites)- [services](/docs/cloudrun/cli/services)- [render](/docs/cloudrun/cli/render)+- [permissions](/docs/cloudrun/cli/permissions)- [compositions](/docs/cloudrun/cli/compositions)-- [policies](/docs/cloudrun/cli/policies)-- [quotas](/docs/cloudrun/cli/quotas)+- [regions](/docs/cloudrun/cli/regions)diff --git a/packages/docs/docs/cloudrun/cli/compositions.md b/packages/docs/docs/cloudrun/cli/compositions.mdnew file mode 100644index 0000000000..0aa2be3c44--- /dev/null+++ b/packages/docs/docs/cloudrun/cli/compositions.md@@ -0,0 +1,87 @@+---+image: /generated/articles-docs-cloudrun-cli-compositions.png+title: npx remotion cloudrun compositions+sidebar_label: compositions+crumb: "Cloud Run CLI Reference"+---++_Available from v3.3.2._++Print list of composition IDs from a serve URL, fetched from inside a Lambda function.++```bash+npx remotion lambda compositions <serve-url>+```++- The serve URL is obtained by deploying a project to Remotion using the [`sites create`](/docs/lambda/cli/sites#create) command or calling [`deploySite()`](/docs/lambda/deploysite).++Note that you can also get the compositions of a site that is hosted on Lambda using [`npx remotion compositions`](/docs/cli/compositions). Vice versa, you can also get the compositions from a serve URL that is not hosted on AWS Lambda using `npx remotion lambda compositions`.++You should use `npx remotion lambda compositions` if you cannot use [`npx remotion compositions`](/docs/cli/compositions) because the machine cannot run Chrome.++## Example commands++Rendering a still:++```+npx remotion lambda compositions https://remotionlambda-abcdef.s3.eu-central-1.amazonaws.com/sites/testbed/index.html+```++## Flags++### `--props`++[React Props that can be retrieved using `getInputProps()`.](/docs/get-input-props) Must be a serialized JSON string (`--props='{"hello": "world"}'`) or a path to a JSON file (`./path/to/props.json`).++:::info+Inline JSON string isn't supported on Windows because it removes the `"` character, use a temporary file instead.+:::++### `--config`++Specify a location for the Remotion config file.++### `--env-file`++Specify a location for a dotenv file. Default `.env`.++### `--log`++[Set the log level](/docs/config#setlevel). Increase or decrease the amount of output. Acceptable values: `error`, `warn`, `info` (_default_), `verbose`++:::info+If you don't feel like passing command line flags every time, consider creating a `remotion.config.ts` [config file](/docs/config).+:::++### `--timeout`++Define how long it may take to resolve all [`delayRender()`](/docs/delay-render) calls before the composition fetching times out in milliseconds. Default: `30000`.++:::info+Not to be confused with the [`--timeout` flag when deploying a Lambda function](/docs/lambda/cli/functions#--timeout).+:::++### `--ignore-certificate-errors`++Results in invalid SSL certificates in Chrome, such as self-signed ones, being ignored.++### `--disable-web-security`++This will most notably disable CORS in Chrome among other security features.++### `--disable-headless`++Opens an actual browser to observe the composition fetching.++### `--quiet`, `--q`++Only prints the composition IDs, separated by a space.++### `--force-bucket-name` <AvailableFrom v="3.3.42" />++Specify a specific bucket name to be used. [This is not recommended](/docs/lambda/multiple-buckets), instead let Remotion discover the right bucket automatically.++## See also++- [`getCompositionsOnLambda()`](/docs/lambda/getcompositionsonlambda)+- [`npx remotion compositions`](/docs/cli/compositions)diff --git a/packages/docs/docs/cloudrun/cli/permissions.md b/packages/docs/docs/cloudrun/cli/permissions.mdnew file mode 100644index 0000000000..aeb9b2ac94--- /dev/null+++ b/packages/docs/docs/cloudrun/cli/permissions.md@@ -0,0 +1,43 @@+---+image: /generated/articles-docs-cloudrun-cli-permissions.png+id: permissions+sidebar_label: permissions+title: "npx remotion cloudrun permissions"+slug: /cloudrun/cli/permissions+crumb: "Cloud Run CLI Reference"+---++Prints and validates the permissions that should be on the IAM role that is attached to the Service Account in GCP, as per the [setup steps](/docs/cloudrun/setup).++```+npx remotion cloudrun permissions+```++<details>+<summary>Show output+</summary>+<pre>+β iam.serviceAccounts.actAs++β run.operations.get+β run.routes.invoke+β run.services.create+β run.services.get+β run.services.delete+β run.services.list+β run.services.update+β storage.buckets.create+β storage.buckets.get+β storage.buckets.list+β storage.objects.create+β storage.objects.delete+β storage.objects.list+β run.services.getIamPolicy+β run.services.setIamPolicy++</pre>+</details>++## See also++- [Setup guide](/docs/cloudrun/setup)diff --git a/packages/docs/docs/lambda/cli.md b/packages/docs/docs/lambda/cli.mdindex 9aa3f4ea36..961c4a171b 100644--- a/packages/docs/docs/lambda/cli.md+++ b/packages/docs/docs/lambda/cli.md@@ -14,8 +14,9 @@ To use the Remotion Lambda CLI, you first need to [install it](/docs/lambda/setu- [functions](/docs/lambda/cli/functions)- [render](/docs/lambda/cli/render)- [still](/docs/lambda/cli/still)-- [compositions](/docs/lambda/cli/compositions)- [policies](/docs/lambda/cli/policies)+- [compositions](/docs/lambda/cli/compositions)+- [regions](/docs/lambda/cli/regions)- [quotas](/docs/lambda/cli/quotas)## Global optionsdiff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex 44ac568cba..ad3781edd0 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -43,11 +43,9 @@ module.exports = {"cloudrun/cli/sites","cloudrun/cli/services","cloudrun/cli/render",- "lambda/cli/still",- "lambda/cli/policies",- "lambda/cli/compositions",+ "cloudrun/cli/permissions",+ "cloudrun/cli/compositions","cloudrun/cli/regions",- "lambda/cli/quotas",],},"cli/benchmark",