@remotion/cloudrun 4.1.0-alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +13 -0
- package/LICENSE.md +41 -0
- package/dist/admin/bundle-installer.d.ts +1 -0
- package/dist/admin/bundle-installer.js +32 -0
- package/dist/admin/bundle-renderLogic.d.ts +1 -0
- package/dist/admin/bundle-renderLogic.js +39 -0
- package/dist/api/check-if-service-exists.d.ts +18 -0
- package/dist/api/check-if-service-exists.js +50 -0
- package/dist/api/create-bucket.d.ts +13 -0
- package/dist/api/create-bucket.js +18 -0
- package/dist/api/delete-service.d.ts +12 -0
- package/dist/api/delete-service.js +19 -0
- package/dist/api/delete-site.d.ts +13 -0
- package/dist/api/delete-site.js +30 -0
- package/dist/api/deploy-service.d.ts +28 -0
- package/dist/api/deploy-service.js +90 -0
- package/dist/api/deploy-site.d.ts +35 -0
- package/dist/api/deploy-site.js +78 -0
- package/dist/api/download-file.d.ts +13 -0
- package/dist/api/download-file.js +30 -0
- package/dist/api/get-buckets.d.ts +10 -0
- package/dist/api/get-buckets.js +23 -0
- package/dist/api/get-or-create-bucket.d.ts +17 -0
- package/dist/api/get-or-create-bucket.js +42 -0
- package/dist/api/get-regions.d.ts +7 -0
- package/dist/api/get-regions.js +13 -0
- package/dist/api/get-service-info.d.ts +23 -0
- package/dist/api/get-service-info.js +36 -0
- package/dist/api/get-services.d.ts +14 -0
- package/dist/api/get-services.js +49 -0
- package/dist/api/get-sites.d.ts +23 -0
- package/dist/api/get-sites.js +49 -0
- package/dist/api/helpers/IService.d.ts +2 -0
- package/dist/api/helpers/IService.js +2 -0
- package/dist/api/helpers/construct-service-deploy-request.d.ts +32 -0
- package/dist/api/helpers/construct-service-deploy-request.js +36 -0
- package/dist/api/helpers/get-auth-client-for-url.d.ts +1 -0
- package/dist/api/helpers/get-auth-client-for-url.js +15 -0
- package/dist/api/helpers/get-cloud-run-client.d.ts +2 -0
- package/dist/api/helpers/get-cloud-run-client.js +15 -0
- package/dist/api/helpers/get-cloud-storage-client.d.ts +2 -0
- package/dist/api/helpers/get-cloud-storage-client.js +14 -0
- package/dist/api/helpers/get-cloudrun-endpoint.d.ts +14 -0
- package/dist/api/helpers/get-cloudrun-endpoint.js +36 -0
- package/dist/api/helpers/get-resource-manager-client.d.ts +2 -0
- package/dist/api/helpers/get-resource-manager-client.js +15 -0
- package/dist/api/iam-validation/testPermissions.d.ts +20 -0
- package/dist/api/iam-validation/testPermissions.js +48 -0
- package/dist/api/render-media-on-cloudrun.d.ts +70 -0
- package/dist/api/render-media-on-cloudrun.js +115 -0
- package/dist/api/render-still-on-cloudrun.d.ts +47 -0
- package/dist/api/render-still-on-cloudrun.js +68 -0
- package/dist/api/speculate-service-name.d.ts +13 -0
- package/dist/api/speculate-service-name.js +20 -0
- package/dist/api/upload-dir.d.ts +18 -0
- package/dist/api/upload-dir.js +81 -0
- package/dist/cli/args.d.ts +19 -0
- package/dist/cli/args.js +11 -0
- package/dist/cli/commands/permissions.d.ts +2 -0
- package/dist/cli/commands/permissions.js +23 -0
- package/dist/cli/commands/regions.d.ts +2 -0
- package/dist/cli/commands/regions.js +10 -0
- package/dist/cli/commands/render/helpers/renderArgsCheck.d.ts +9 -0
- package/dist/cli/commands/render/helpers/renderArgsCheck.js +75 -0
- package/dist/cli/commands/render/index.d.ts +2 -0
- package/dist/cli/commands/render/index.js +36 -0
- package/dist/cli/commands/render/renderMedia.d.ts +2 -0
- package/dist/cli/commands/render/renderMedia.js +156 -0
- package/dist/cli/commands/render/renderStill.d.ts +2 -0
- package/dist/cli/commands/render/renderStill.js +123 -0
- package/dist/cli/commands/services/deploy.d.ts +2 -0
- package/dist/cli/commands/services/deploy.js +129 -0
- package/dist/cli/commands/services/index.d.ts +5 -0
- package/dist/cli/commands/services/index.js +64 -0
- package/dist/cli/commands/services/ls.d.ts +2 -0
- package/dist/cli/commands/services/ls.js +40 -0
- package/dist/cli/commands/services/rm.d.ts +2 -0
- package/dist/cli/commands/services/rm.js +63 -0
- package/dist/cli/commands/services/rmall.d.ts +2 -0
- package/dist/cli/commands/services/rmall.js +52 -0
- package/dist/cli/commands/sites/create.d.ts +2 -0
- package/dist/cli/commands/sites/create.js +138 -0
- package/dist/cli/commands/sites/index.d.ts +4 -0
- package/dist/cli/commands/sites/index.js +60 -0
- package/dist/cli/commands/sites/ls.d.ts +2 -0
- package/dist/cli/commands/sites/ls.js +40 -0
- package/dist/cli/commands/sites/rm.d.ts +2 -0
- package/dist/cli/commands/sites/rm.js +59 -0
- package/dist/cli/commands/sites/rmall.d.ts +2 -0
- package/dist/cli/commands/sites/rmall.js +38 -0
- package/dist/cli/get-gcp-region.d.ts +2 -0
- package/dist/cli/get-gcp-region.js +19 -0
- package/dist/cli/help.d.ts +1 -0
- package/dist/cli/help.js +34 -0
- package/dist/cli/helpers/confirm.d.ts +4 -0
- package/dist/cli/helpers/confirm.js +12 -0
- package/dist/cli/helpers/date-string.d.ts +1 -0
- package/dist/cli/helpers/date-string.js +9 -0
- package/dist/cli/helpers/progress-bar.d.ts +23 -0
- package/dist/cli/helpers/progress-bar.js +81 -0
- package/dist/cli/helpers/quit.d.ts +1 -0
- package/dist/cli/helpers/quit.js +7 -0
- package/dist/cli/helpers/yes-or-no.d.ts +4 -0
- package/dist/cli/helpers/yes-or-no.js +44 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +52 -0
- package/dist/cli/log.d.ts +21 -0
- package/dist/cli/log.js +5 -0
- package/dist/defaults.d.ts +1 -0
- package/dist/defaults.js +17 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +31 -0
- package/dist/internals.d.ts +3 -0
- package/dist/internals.js +7 -0
- package/dist/pricing/gcp-regions.d.ts +5 -0
- package/dist/pricing/gcp-regions.js +77 -0
- package/dist/regions.d.ts +2 -0
- package/dist/regions.js +5 -0
- package/dist/shared/bundle-site.d.ts +2 -0
- package/dist/shared/bundle-site.js +5 -0
- package/dist/shared/constants.d.ts +13 -0
- package/dist/shared/constants.js +18 -0
- package/dist/shared/convert-to-serve-url.d.ts +4 -0
- package/dist/shared/convert-to-serve-url.js +14 -0
- package/dist/shared/docs-url.d.ts +1 -0
- package/dist/shared/docs-url.js +4 -0
- package/dist/shared/generate-service-name.d.ts +5 -0
- package/dist/shared/generate-service-name.js +20 -0
- package/dist/shared/get-etag.d.ts +1 -0
- package/dist/shared/get-etag.js +24 -0
- package/dist/shared/get-storage-operations.d.ts +10 -0
- package/dist/shared/get-storage-operations.js +36 -0
- package/dist/shared/make-storage-key.d.ts +1 -0
- package/dist/shared/make-storage-key.js +11 -0
- package/dist/shared/make-storage-url.d.ts +4 -0
- package/dist/shared/make-storage-url.js +7 -0
- package/dist/shared/random-hash.d.ts +3 -0
- package/dist/shared/random-hash.js +14 -0
- package/dist/shared/read-dir.d.ts +9 -0
- package/dist/shared/read-dir.js +57 -0
- package/dist/shared/sa-permissions.json +60 -0
- package/dist/shared/service-version-string.d.ts +1 -0
- package/dist/shared/service-version-string.js +8 -0
- package/dist/shared/validate-bucketname.d.ts +8 -0
- package/dist/shared/validate-bucketname.js +35 -0
- package/dist/shared/validate-cloudrun-url.d.ts +1 -0
- package/dist/shared/validate-cloudrun-url.js +10 -0
- package/dist/shared/validate-gcp-codec.d.ts +4 -0
- package/dist/shared/validate-gcp-codec.js +29 -0
- package/dist/shared/validate-gcp-region.d.ts +2 -0
- package/dist/shared/validate-gcp-region.js +10 -0
- package/dist/shared/validate-image-remotion-version.d.ts +1 -0
- package/dist/shared/validate-image-remotion-version.js +26 -0
- package/dist/shared/validate-privacy.d.ts +2 -0
- package/dist/shared/validate-privacy.js +12 -0
- package/dist/shared/validate-project-id.d.ts +1 -0
- package/dist/shared/validate-project-id.js +17 -0
- package/dist/shared/validate-region.d.ts +1 -0
- package/dist/shared/validate-region.js +15 -0
- package/dist/shared/validate-retries.d.ts +1 -0
- package/dist/shared/validate-retries.js +21 -0
- package/dist/shared/validate-serveurl.d.ts +1 -0
- package/dist/shared/validate-serveurl.js +30 -0
- package/dist/shared/validate-service-name.d.ts +1 -0
- package/dist/shared/validate-service-name.js +9 -0
- package/dist/shared/validate-site-name.d.ts +1 -0
- package/dist/shared/validate-site-name.js +17 -0
- package/package.json +59 -0
- package/readme.md +306 -0
- package/readmeImages/createSA.png +0 -0
- package/readmeImages/downloadEnv.jpg +0 -0
- package/readmeImages/downloadEnvFolder.png +0 -0
- package/readmeImages/saRole.png +0 -0
- package/readmeImages/selectCloudShell.jpg +0 -0
- package/tsconfig.tsbuildinfo +1 -0
package/readme.md
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
from the root, `pnpm i && pnpm build` will trigger a build command for all packages. For the GCP package, this will bundle the required code into `cloudrun/container`.
|
|
2
|
+
|
|
3
|
+
The /container folder contains a package.json that lists functions-framework as a dependency, and a Dockerfile that will build the container. Functions-framework is a nodejs framework that allows you to run nodejs code in a containerized environment.
|
|
4
|
+
|
|
5
|
+
This can be built and deployed to Cloud Run. Cloud Run is a serverless container platform that allows you to run containers in a managed environment.
|
|
6
|
+
|
|
7
|
+
## Deploying new artifact repo in GCP for new Remotion versions
|
|
8
|
+
|
|
9
|
+
Public artifact registry that contains the container images
|
|
10
|
+
us-docker.pkg.dev/remotion-dev/cloud-run/render
|
|
11
|
+
Image is tagged with the same semver as the remotion packages
|
|
12
|
+
us-docker.pkg.dev/remotion-dev/cloud-run/render:3.3.36-alpha
|
|
13
|
+
Part of the CI/CD pipeline should be to push a new container image to the artifact registry, with the right version:
|
|
14
|
+
`gcloud builds submit --tag us-docker.pkg.dev/remotion-dev/cloud-run/render:${version}`
|
|
15
|
+
|
|
16
|
+
# How to use the GCP CLI commands
|
|
17
|
+
|
|
18
|
+
## 1. Create a project in the Google Cloud Console
|
|
19
|
+
|
|
20
|
+
Navigate to the [Manage Resources](https://console.cloud.google.com/cloud-resource-manager?walkthrough_id=resource-manager--create-project&start_index=1#step_index=1) screen in Google Cloud Console.
|
|
21
|
+
|
|
22
|
+
- On the Select organization drop-down list at the top of the page, select the organization resource in which you want to create a project. If you are a free trial user, skip this step, as this list does not appear.
|
|
23
|
+
- Click Create Project.
|
|
24
|
+
- In the New Project window that appears, enter a project name and select a billing account as applicable. A project name can contain only letters, numbers, single quotes, hyphens, spaces, or exclamation points, and must be between 4 and 30 characters.
|
|
25
|
+
- Enter the parent organization or folder resource in the Location box. That resource will be the hierarchical parent of the new project. If No organization is an option, you can select it to create your new project as the top level of its own resource hierarchy.
|
|
26
|
+
- When you're finished entering new project details, click Create.
|
|
27
|
+
|
|
28
|
+
## 2. Enable billing in the GCP Project
|
|
29
|
+
|
|
30
|
+
In order to enable the Cloud Run API, billing must be enabled in this project. Navigate to the [Billing](https://console.cloud.google.com/billing) screen in Google Cloud Console. Follow the on-screen prompts to create a billing account, and then link the new project to this billing account.
|
|
31
|
+
|
|
32
|
+
## 3. Setup Permissions / APIs / Service Account in GCP
|
|
33
|
+
|
|
34
|
+
This can be achieved by either following the instructions for using Terraform within GCP Cloud Shell (recommended) or following the instructions for clicking through the GCP Console. The former is the preferred method as it minimises the risk of missing an instruction.
|
|
35
|
+
|
|
36
|
+
### Using Terraform within GCP Cloud Shell:
|
|
37
|
+
|
|
38
|
+
_Note, this process does not require an understanding of Terraform._
|
|
39
|
+
|
|
40
|
+
**What is Google Cloud Shell?**
|
|
41
|
+
Google Cloud Shell is a browser-based command-line interface (CLI) for managing resources and applications hosted on Google Cloud Platform (GCP). It provides a virtual machine with pre-installed command-line tools and utilities, including the Google Cloud SDK and Terraform.
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
This means that you can clone a github repo, run a couple of Terraform commands, and have a Remotion ready GCP project in minutes 🚀.
|
|
46
|
+
|
|
47
|
+
1. In the top right hand corner of the screen, click the Activate Cloud Shell icon
|
|
48
|
+
<img src="readmeImages/selectCloudShell.jpg" width="200" />
|
|
49
|
+
2. Within the Cloud Shell, type
|
|
50
|
+
`git clone https://github.com/UmungoBungo/remotion-gcp-terraform.git remotion-gcp-terraform/`
|
|
51
|
+
<!-- ToDo - host this in the official Remotion repo -->
|
|
52
|
+
3. Change directory into the new folder
|
|
53
|
+
`cd remotion-gcp-terraform/`
|
|
54
|
+
4. Within the terraform file, there is a variable named project_id. This needs to be set to your newly created Remotion project. Because we are already authenticated with GCP when using the Cloud Shell, we can set this variable using the following command:
|
|
55
|
+
`export TF_VAR_project_id=$(gcloud config get-value project)`
|
|
56
|
+
5. As terraform is natively available in Cloud Shell, we can begin using terraform commands without further installation. Run the following command;
|
|
57
|
+
`terraform init`
|
|
58
|
+
_Explanation: When you run `terraform init`, Terraform will download any required provider plugins and modules and create a .terraform directory in your working directory._
|
|
59
|
+
6. Run the following command;
|
|
60
|
+
`terraform plan`
|
|
61
|
+
_Explanation: When you run `terraform plan`, Terraform checks your code to see what resources you're trying to create, update or delete, and then shows you what it will do without actually making any changes._
|
|
62
|
+
7. Check the output from the above to ensure you are happy with the changes about to be made to your project. If so, run the following command;
|
|
63
|
+
`terraform apply`
|
|
64
|
+
_Explanation: When you run `terraform apply`, Terraform deploys the resources as defined in the .tf files._
|
|
65
|
+
8. When the apply is complete, it will output a script to run in the command line. Running this will create a key for the service account and store it on the virtual machine. **Note that these keys need to remain secret.** The command should look similar to the following;
|
|
66
|
+
`gcloud iam service-accounts keys create key.json --iam-account=remotion-sa@<project_name>.iam.gserviceaccount.com`
|
|
67
|
+
9. The key file has been generated on the virtual machine. You can now build the .env file that is needed at the root of your Remotion project in order to interact with GCP. Run the following command;
|
|
68
|
+
```
|
|
69
|
+
echo "REMOTION_GCP_PRIVATE_KEY=$(jq '.private_key' key.json)" >> .env && \
|
|
70
|
+
echo "REMOTION_GCP_CLIENT_EMAIL=$(jq '.client_email' key.json)" >> .env && \
|
|
71
|
+
echo "REMOTION_GCP_PROJECT_ID=$(gcloud config get-value project)" >> .env
|
|
72
|
+
```
|
|
73
|
+
10. 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;
|
|
74
|
+
<img src="readmeImages/downloadEnv.jpg" width="350" />
|
|
75
|
+
|
|
76
|
+
<img src="readmeImages/downloadEnvFolder.png" width="300" />
|
|
77
|
+
|
|
78
|
+
11. Remove the .env file and key.json from the virtual machine, using this command;
|
|
79
|
+
`rm key.json .env`
|
|
80
|
+
|
|
81
|
+
12. Place the .env file you've downloaded into the root of your Remotion project. You may need to rename it from `env.txt`, to `.env`.
|
|
82
|
+
|
|
83
|
+
### Clicking through the console:
|
|
84
|
+
|
|
85
|
+
### 1. Create a new role with permissions required by the service account
|
|
86
|
+
|
|
87
|
+
Navigate to the [Role](https://console.cloud.google.com/iam-admin/roles) screen in Google Cloud Console, within IAM & Admin.
|
|
88
|
+
|
|
89
|
+
- Select the Cloud project created in the previous step.
|
|
90
|
+
- Click + CREATE ROLE in the top menu.
|
|
91
|
+
- Under Title, type: `Remotion API Service Account`
|
|
92
|
+
- Under Description, type: `Allow the service account to manage necessary resources for Remotion Cloud Run rendering.`
|
|
93
|
+
- Under ID, type: `RemotionSA`
|
|
94
|
+
- For Role launch stage, select `General Availability`
|
|
95
|
+
- Click + Add Permissions, and add the following;
|
|
96
|
+
- iam.serviceAccounts.actAs
|
|
97
|
+
- run.operations.get
|
|
98
|
+
- run.routes.invoke
|
|
99
|
+
- run.services.create
|
|
100
|
+
- run.services.list
|
|
101
|
+
- run.services.update
|
|
102
|
+
- storage.buckets.get
|
|
103
|
+
- storage.buckets.list
|
|
104
|
+
- storage.objects.create
|
|
105
|
+
- storage.objects.delete
|
|
106
|
+
- storage.objects.list
|
|
107
|
+
- run.services.getIamPolicy
|
|
108
|
+
- run.services.setIamPolicy
|
|
109
|
+
- Click the CREATE button
|
|
110
|
+
|
|
111
|
+
#### 1a. Permission reasons
|
|
112
|
+
|
|
113
|
+
For information only, here are the reasons for the above permissions
|
|
114
|
+
|
|
115
|
+
- iam.serviceAccounts.actAs
|
|
116
|
+
- When deploying, act as the default service account, which will grant further permissions required during deployment.
|
|
117
|
+
- run.operations.get
|
|
118
|
+
- Required during deployment to confirm that deployment was successful.
|
|
119
|
+
- run.routes.invoke
|
|
120
|
+
- Call the deployed Cloud Run services, in order to perform a render.
|
|
121
|
+
- run.services.create
|
|
122
|
+
- Deploy new, and edit existing, Cloud Run services
|
|
123
|
+
- run.services.list
|
|
124
|
+
- Get a list of existing Cloud Run services, to ensure no unintended overwriting.
|
|
125
|
+
- run.services.update
|
|
126
|
+
- Update a Cloud Run service, for instance providing it with more Memory or CPU.
|
|
127
|
+
- storage.buckets.get
|
|
128
|
+
- ToDo...
|
|
129
|
+
- storage.buckets.list
|
|
130
|
+
- Get a list of existing Cloud Storage resources, to ensure no unintended overwriting of storage buckets.
|
|
131
|
+
- storage.objects.create
|
|
132
|
+
- Create new objects in storage. This could be bundled sites, or renders, or logs.
|
|
133
|
+
- storage.objects.delete
|
|
134
|
+
- ToDo...
|
|
135
|
+
- storage.objects.list
|
|
136
|
+
- ToDo...
|
|
137
|
+
- run.services.getIamPolicy
|
|
138
|
+
- used to check the existing IAM policy on a service
|
|
139
|
+
- run.services.setIamPolicy
|
|
140
|
+
- used to set the IAM policy on a service
|
|
141
|
+
|
|
142
|
+
### 2. Create a service account in the Google Cloud Console
|
|
143
|
+
|
|
144
|
+
Navigate to the [Service Accounts](https://console.cloud.google.com/projectselector2/iam-admin/serviceaccounts/create) screen in Google Cloud Console, within IAM & Admin.
|
|
145
|
+
|
|
146
|
+
- Select the Cloud project created in the previous step.
|
|
147
|
+
- Enter a service account name to display in the Google Cloud console.
|
|
148
|
+
- The Google Cloud console generates a service account ID based on this name. Edit the ID if necessary. You cannot change the ID later.
|
|
149
|
+
- Optional: Enter a description of the service account.
|
|
150
|
+
- Click 'Create and continue' and continue to the next step.
|
|
151
|
+
- Give the Service Account the role created in the previous step, Remotion API Service Account.
|
|
152
|
+
<img src="readmeImages/saRole.png" width="450" />
|
|
153
|
+
- Click Done to finish creating the service account.
|
|
154
|
+
|
|
155
|
+
### 3. Save Service Account credentials
|
|
156
|
+
|
|
157
|
+
Navigate to the [Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts) screen in Google Cloud Console, within IAM & Admin.
|
|
158
|
+
|
|
159
|
+
- Select the Cloud project created in the previous step.
|
|
160
|
+
- Click on the ellipsis under 'Actions', in the final column, and click 'Manage keys'.
|
|
161
|
+
- On the next screen, click ADD KEY, and then Create new key.
|
|
162
|
+
- select JSON, and click Create.
|
|
163
|
+
- Save the JSON file to your computer, and open it.
|
|
164
|
+
- Create/edit a .env file in the root of your Remotion project.
|
|
165
|
+
- Create a REMOTION*GCP_CLIENT_EMAIL key, and copy over the client_email value, \_including the quotation marks*.
|
|
166
|
+
- Create a REMOTION*GCP_PRIVATE_KEY key, and copy over the private_key value, \_including the quotation marks*.
|
|
167
|
+
|
|
168
|
+
### 5. Set Remotion Project ID in .env
|
|
169
|
+
|
|
170
|
+
- Within the previously edited .env file in the root of your Remotion project, create a REMOTION_GCP_PROJECT_ID key, and set the key as the ID from the [Dashboard](https://console.cloud.google.com/home/dashboard), under the Project Info card.
|
|
171
|
+
|
|
172
|
+
### 4. Enable required APIs in the project
|
|
173
|
+
|
|
174
|
+
- Enable the Cloud Run API. Navigate to the [Cloud Run API](https://console.cloud.google.com/apis/library/run.googleapis.com) screen in Google Cloud Console, and click ENABLE. Make sure the correct project is selected in the dropdown in the top left. This is required in order to use Cloud Run.
|
|
175
|
+
|
|
176
|
+
# Available commands from the CLI:
|
|
177
|
+
|
|
178
|
+
This command will deploy a cloud-run service, and return the URL of the service. This cloud run service is what will be invoked to render media.
|
|
179
|
+
<br><br>
|
|
180
|
+
|
|
181
|
+
### Command: `npx remotion gcp cloud-run deploy`
|
|
182
|
+
|
|
183
|
+
Options:
|
|
184
|
+
|
|
185
|
+
- --project-id (required):
|
|
186
|
+
- The project-id is the name of the project in which to deploy the service. The ID can be retrieved by navigating to the [Dashboard](https://console.cloud.google.com/home/dashboard) screen in Google Cloud Console, and selecting the project from the drop-down menu in the top left corner. The ID is under Project Info in the top left corner.
|
|
187
|
+
- --service-name (required):
|
|
188
|
+
- the name of the Cloud Run service to deploy or update. Service names must be 49 characters or less and must be unique per region and project. A service name cannot be changed later and is publicly visible. The service does not need to exist yet. If it does exist, a new revision will be deployed.
|
|
189
|
+
- --region: the region of the service
|
|
190
|
+
- --overwrite-service (optional, default to false):
|
|
191
|
+
- if an existing service is found with the same name, a prompt will come up asking if a new revision should be deployed. If this flag is set to true, the prompt will be skipped and a new revision will be deployed automatically.
|
|
192
|
+
|
|
193
|
+
Taking the above into account, a valid command would be:
|
|
194
|
+
`npx remotion gcp cloud-run deploy --service-name=cloud-run-render --project-id=new-remotion-project`
|
|
195
|
+
|
|
196
|
+
To view the deployed service, navigate to the [Cloud Run](https://console.cloud.google.com/run) screen in Google Cloud Console, and selecting the project from the drop-down menu in the top left corner.
|
|
197
|
+
|
|
198
|
+
- The URL is visible at the top of the screen. This is where to send POST requests for rendering.
|
|
199
|
+
- Revisions are listed under the revisions tab. You can also manage traffic splitting, and view resource limits for each revision.
|
|
200
|
+
- Logs are available under the logs tab. For troubleshooting, it is best to click on the new tab icon to open the Logs Explorer, and then click on Stream Logs in the top right to have a live view of logs.
|
|
201
|
+
|
|
202
|
+
<br><br>
|
|
203
|
+
|
|
204
|
+
### Command: `npx remotion gcp sites create`
|
|
205
|
+
|
|
206
|
+
Options:
|
|
207
|
+
|
|
208
|
+
- tbc
|
|
209
|
+
|
|
210
|
+
This command will bundle the site and upload it to a GCP bucket. To view storage buckets in your project, navigate to the [Storage](https://console.cloud.google.com/storage/browser) screen in Google Cloud Console, and select the project from the drop-down menu in the top left corner.
|
|
211
|
+
|
|
212
|
+
# Render media on GCP
|
|
213
|
+
|
|
214
|
+
This command will render media on the deployed cloud-run service, and return metadata of the rendered file.
|
|
215
|
+
|
|
216
|
+
### Command: `pnpm exec remotion gcp render media <serve-url> <cloud-run-url> <composition-name> --output-bucket=<GCS-bucket-name>`
|
|
217
|
+
|
|
218
|
+
## Manually, making a post request
|
|
219
|
+
|
|
220
|
+
Within the Cloud Run service, you can see the URL of the service. Distributed rendering is not yet supported, but rendering a still or media in a single-threaded instance is available.
|
|
221
|
+
|
|
222
|
+
To render media, send a POST request to the URL with the following body:
|
|
223
|
+
|
|
224
|
+
- type: the type of render. For media, this should be set to `media`.
|
|
225
|
+
- composition: the name of the composition to render. This must be available in the bundle that has been deployed to GCP.
|
|
226
|
+
- serveUrl: the URL of the site that has been deployed to GCP.
|
|
227
|
+
- inputProps: the props to pass to the composition.
|
|
228
|
+
- outputBucket: bucket for the output to be uploaded to. The bucket must exist, and the service account running the service must have access to the bucket.
|
|
229
|
+
- outputFile: The path and filename to upload the output to.
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
{
|
|
233
|
+
"type": "media",
|
|
234
|
+
"composition": "HelloWorld",
|
|
235
|
+
"serveUrl": "https://storage.googleapis.com/remotioncloudrun-n8x4pc7dz3/sites/e97ngid3n3/index.html",
|
|
236
|
+
"codec": "h264",
|
|
237
|
+
"inputProps": {
|
|
238
|
+
"titleText": "Welcome to Remotion",
|
|
239
|
+
"titleColor": "black"
|
|
240
|
+
},
|
|
241
|
+
"outputBucket": "remotionlambda-test",
|
|
242
|
+
"outputFile": "outFolder/mediaOutput.mp4"
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
# Render still on GCP
|
|
247
|
+
|
|
248
|
+
This command will render media on the deployed cloud-run service, and return metadata of the rendered file.
|
|
249
|
+
|
|
250
|
+
### Command: `pnpm exec remotion gcp render still <serve-url> <cloud-run-url> <composition-name> --output-bucket=<GCS-bucket-name>`
|
|
251
|
+
|
|
252
|
+
## Manually, making a post request
|
|
253
|
+
|
|
254
|
+
To render a still, send a POST request to the URL with the following body:
|
|
255
|
+
|
|
256
|
+
- type: the type of render. For a still, this should be set to `still`.
|
|
257
|
+
- composition: the name of the composition to render. This must be available in the bundle that has been deployed to GCP.
|
|
258
|
+
- serveUrl: the URL of the site that has been deployed to GCP.
|
|
259
|
+
- inputProps: the props to pass to the composition.
|
|
260
|
+
- outputBucket: bucket for the output to be uploaded to. The bucket must exist, and the service account running the service must have access to the bucket.
|
|
261
|
+
- outputFile: The path and filename to upload the output to.
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
{
|
|
265
|
+
"type": "still",
|
|
266
|
+
"composition": "StillRender",
|
|
267
|
+
"serveUrl": "https://storage.googleapis.com/remotioncloudrun-n8x4pc7dz3/sites/e97ngid3n3/index.html",
|
|
268
|
+
"inputProps": {
|
|
269
|
+
"text": "Created on Cloud Run™️"
|
|
270
|
+
},
|
|
271
|
+
"outputBucket": "remotionlambda-test",
|
|
272
|
+
"outputFile": "outFolder/stillOutput.png"
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Using the CLI command, WIP
|
|
277
|
+
|
|
278
|
+
- 🟩 Render Media is largely finished
|
|
279
|
+
- 🟩 Address comments within
|
|
280
|
+
- 🟩 Render Still command written
|
|
281
|
+
- 🟩 Address comments within
|
|
282
|
+
- 🟩 Cloud Run render only ever puts the output in a bucket, not available for download.
|
|
283
|
+
<br><br><br><br>
|
|
284
|
+
|
|
285
|
+
# To Do
|
|
286
|
+
|
|
287
|
+
### deploy cloud-run command
|
|
288
|
+
|
|
289
|
+
- add cpu and memory limit arguments
|
|
290
|
+
- returning error from deployNewCloudRun - typed as any, can I get a type from the protos?
|
|
291
|
+
- sprinkle quietFlagProvided() throughout
|
|
292
|
+
- when deploying a cloud run instance, should include the remotion version in the revision name
|
|
293
|
+
- add new service account as runner of the service, so the permissions can stay tight.
|
|
294
|
+
- allow outputBucket and outputFile to be optional. After that, update readme with details.
|
|
295
|
+
- add LS, RM, RMALL subcommands
|
|
296
|
+
|
|
297
|
+
### create sites command
|
|
298
|
+
|
|
299
|
+
- sprinkle quietFlagProvided() throughout
|
|
300
|
+
- time for uploading to GCP Storage Bucket is always 0ms
|
|
301
|
+
- add LS, RM, RMALL subcommands
|
|
302
|
+
|
|
303
|
+
### Render command
|
|
304
|
+
|
|
305
|
+
- Create API that just makes a post request to Cloud Run, to perform render
|
|
306
|
+
- Use lambda one for inspiration
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|