π₯ Make videos programmatically with React
created update and generate pages for Cloud Run
Matt McGillivray69e11672e9e2
diff --git a/packages/cloudrun/install.mjs b/packages/cloudrun/install.mjsindex 127242e7a4..d68a2c0dee 100644--- a/packages/cloudrun/install.mjs+++ b/packages/cloudrun/install.mjs@@ -60,7 +60,7 @@ function taskPrompt() {});rl.question(- `What would you like to do?\n[1] Setup the GCP project ${projectID} as a Remotion Cloud Run environment.\n[2] ${projectID} is already set up for Remotion, update to a newer Remotion version.\n[3] ${projectID} is already set up for Remotion, generate a new .env file for the Remotion Service Account.\n${blueTextColor}`,+ `What would you like to do?\n[1] Setup the GCP project ${projectID} as a Remotion Cloud Run environment.\n[2] ${projectID} is already set up for Remotion, update to a newer Remotion version.\n[3] ${projectID} is already set up for Remotion, generate a new .env file or manage keys for the Remotion Service Account.\n${blueTextColor}`,async (answer) => {// reset terminal colorrl.output.write(`\n${resetTextColor}`);diff --git a/packages/docs/docs/cloudrun/generateEnvFile.md b/packages/docs/docs/cloudrun/generateEnvFile.mdnew file mode 100644index 0000000000..1cd65e2b60--- /dev/null+++ b/packages/docs/docs/cloudrun/generateEnvFile.md@@ -0,0 +1,55 @@+---+image: /generated/articles-docs-cloudrun-generateEnvFile.png+id: generateEnvFile+title: Generate .env File+slug: /cloudrun/generateEnvFile+crumb: "Cloudrun"+---++As GCP Cloud Shell has access to the project, a script can be run to generate a .env file with the required Service Account keys and Project ID. As Cloud Shell makes use of the logged-in user's credentials for permissions in the project, it is assumed you have the owner role on the project. If you were the one that created the project, you will be an owner.++It is important to have strict control over the service account keys, as they are used to authenticate the Remotion project to GCP. The .env file should not be committed to source control, and not shared with anyone. Any time you no longer require a service account key, it should be deleted.++GCP allows a maximum of 10 keys per service account. If you have already created 10 keys, you will need to delete one before you can create another. The following script provides you with an opportunity to do this from within the terminal.++1. Open the [Project Dashboard](https://console.cloud.google.com/home/dashboard) in the GCP console, and select your existing Remotion project.++2. In the top right hand corner of the screen, click the Activate Cloud Shell icon++ <img src="/img/cloudrun/selectCloudShell.jpg" width="200" />++3. Within the Cloud Shell, type the following command, and select option 3. Follow the remaining prompts.++ ```bash+ curl --remote-name-all https://raw.githubusercontent.com/UmungoBungo/remotion/gcp-lambda-alternative/packages/cloudrun/{terraform/main.tf,install.mjs} && node install.mjs+ ```++ <!-- ToDo - host this in the official Remotion repo -->++4. Download the .env file by clicking the vertical ellipsis, in the top right of the cloud shell window, and selecting Download. Then type .env at the end of the prefilled path, and click DOWNLOAD;+ <img src="/img/cloudrun/downloadEnv.jpg" width="350" />+ <br />+ <br />+ <img src="/img/cloudrun/downloadEnvFolder.png" width="300" />++5. Remove the .env file from the virtual machine, using this command;++ ```bash+ rm .env+ ```++6. Place the downloaded .env file into the root of the Remotion project. You may need to rename it from `env.txt`, to `.env`. The file should have this format;++ ```txt title=".env"+ REMOTION_GCP_PRIVATE_KEY=<private key>+ REMOTION_GCP_CLIENT_EMAIL=<client email>+ REMOTION_GCP_PROJECT_ID=<project id>+ ```++## 5. Optional: Validate the permission setup++From within your code base, run the following command to validate the permissions are setup correctly in GCP. As long as your GCP project was setup with a matching Remotion version, this should pass.++```+npx remotion cloudrun policies validate+```diff --git a/packages/docs/docs/cloudrun/setup.md b/packages/docs/docs/cloudrun/setup.mdindex cb049af965..38b9c24534 100644--- a/packages/docs/docs/cloudrun/setup.md+++ b/packages/docs/docs/cloudrun/setup.md@@ -80,32 +80,36 @@ _Note, this process does not require an understanding of Terraform._Google Cloud Shell is fully integrated with GCP, which means that you can access your projects, resources, and services directly from the command line without having to switch between multiple interfaces. Additionally, Cloud Shell offers a persistent disk for storing your data and files, as well as a web-based code editor for editing files and running scripts.-This means that you can clone a github repo, run a couple of Terraform commands, and have a Remotion-ready GCP project in minutes π.+This means that you can pull in a script that runs a couple of gcloud and Terraform commands, and have a Remotion-ready GCP project in minutes π.1. In the top right hand corner of the screen, click the Activate Cloud Shell icon<img src="/img/cloudrun/selectCloudShell.jpg" width="200" />-2. Within the Cloud Shell, type+2. Within the Cloud Shell, type the following command and follow the prompts.+```bashcurl --remote-name-all https://raw.githubusercontent.com/UmungoBungo/remotion/gcp-lambda-alternative/packages/cloudrun/{terraform/main.tf,install.mjs} && node install.mjs```-<!-- ToDo - host this in the official Remotion repo -->+ If this is the first time initialising Remotion in the GCP project, you will want to select option 1.+ If you are updating the version of Remotion for this GCP project, you will want to select option 2.+ If you want to generate a new .env file, or manage keys already created, you will want to select option 3.+ <!-- ToDo - host this in the official Remotion repo -->-5. Download the .env file by clicking the vertical ellipsis, in the top right of the cloud shell window, and selecting Download. Then type .env at the end of the prefilled path, and click DOWNLOAD;+3. Download the .env file by clicking the vertical ellipsis, in the top right of the cloud shell window, and selecting Download. Then type .env at the end of the prefilled path, and click DOWNLOAD;<img src="/img/cloudrun/downloadEnv.jpg" width="350" /><br /><br /><img src="/img/cloudrun/downloadEnvFolder.png" width="300" />-6. Remove the .env file from the virtual machine, using this command;+4. Remove the .env file from the virtual machine, using this command;```bashrm .env```-7. Place the downloaded .env file into the root of the Remotion project. You may need to rename it from `env.txt`, to `.env`. The file should have this format;+5. Place the downloaded .env file into the root of the Remotion project. You may need to rename it from `env.txt`, to `.env`. The file should have this format;```txt title=".env"REMOTION_GCP_PRIVATE_KEY=<private key>@@ -115,7 +119,7 @@ This means that you can clone a github repo, run a couple of Terraform commands,## 5. Optional: Validate the permission setup-From within your code base, run the following command to validate the permissions are setup correctly in GCP.+From within your code base, run the following command to validate the permissions are setup correctly in GCP. As long as your GCP project was setup with a matching Remotion version, this should pass.```npx remotion cloudrun policies validatediff --git a/packages/docs/docs/cloudrun/updateGcpProject.md b/packages/docs/docs/cloudrun/updateGcpProject.mdnew file mode 100644index 0000000000..23446b3e80--- /dev/null+++ b/packages/docs/docs/cloudrun/updateGcpProject.md@@ -0,0 +1,51 @@+---+image: /generated/articles-docs-cloudrun-updateGcpProject.png+id: updateGcpProject+title: Update GCP Project+slug: /cloudrun/updateGcpProject+crumb: "Cloudrun"+---++The permissions on the Service Account role may change as Remotion evolves in the future. To ensure that the permissions in GCP match the requirements of the version of your Remotion project, follow these steps;++1. Open the [Project Dashboard](https://console.cloud.google.com/home/dashboard) in the GCP console, and select your existing Remotion project.++2. In the top right hand corner of the screen, click the Activate Cloud Shell icon++ <img src="/img/cloudrun/selectCloudShell.jpg" width="200" />++3. Within the Cloud Shell, type the following command, and select option 2. Follow the remaining prompts.++ ```bash+ curl --remote-name-all https://raw.githubusercontent.com/UmungoBungo/remotion/gcp-lambda-alternative/packages/cloudrun/{terraform/main.tf,install.mjs} && node install.mjs+ ```++ <!-- ToDo - host this in the official Remotion repo -->++4. Download the .env file by clicking the vertical ellipsis, in the top right of the cloud shell window, and selecting Download. Then type .env at the end of the prefilled path, and click DOWNLOAD;+ <img src="/img/cloudrun/downloadEnv.jpg" width="350" />+ <br />+ <br />+ <img src="/img/cloudrun/downloadEnvFolder.png" width="300" />++5. Remove the .env file from the virtual machine, using this command;++ ```bash+ rm .env+ ```++6. Place the downloaded .env file into the root of the Remotion project. You may need to rename it from `env.txt`, to `.env`. The file should have this format;++ ```txt title=".env"+ REMOTION_GCP_PRIVATE_KEY=<private key>+ REMOTION_GCP_CLIENT_EMAIL=<client email>+ REMOTION_GCP_PROJECT_ID=<project id>+ ```++## 5. Optional: Validate the permission setup++From within your code base, run the following command to validate the permissions are setup correctly in GCP. As long as your GCP project was setup with a matching Remotion version, this should pass.++```+npx remotion cloudrun policies validate+```diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex 720b7df364..fea6179ec3 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -472,7 +472,8 @@ module.exports = {"lambda/upgrading","lambda/uninstall",],- },{+ },+ {type: "category",label: "Cloudrun",link: {@@ -481,7 +482,9 @@ module.exports = {},items: ["cloudrun/setup",- "cloudrun/region-selection"+ "cloudrun/updateGcpProject",+ "cloudrun/generateEnvFile",+ "cloudrun/region-selection",],},{