Skip to content

πŸŽ₯ Make videos programmatically with React

move GCP installer

Jonny Burgeref77dcb08fb3
diff --git a/.gitignore b/.gitignore
index 8704f60eef..453de13eaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,5 +18,5 @@ packages/cloudrun/remotion-lambda-gcp.code-workspace
packages/example/sa-key.json
packages/example/public/pts-framermp4withoutfileextension.mp4
packages/it-tests/packages/example/out/element-2.png
-packages/cloudrun/gcpInstaller/terraform*
-packages/cloudrun/gcpInstaller/*.tfplan
+packages/cloudrun/src/gcpInstaller/terraform*
+packages/cloudrun/src/gcpInstaller/*.tfplan
diff --git a/packages/cloudrun/.eslintrc b/packages/cloudrun/.eslintrc
index 979d4d7138..1a478661e6 100644
--- a/packages/cloudrun/.eslintrc
+++ b/packages/cloudrun/.eslintrc
@@ -15,7 +15,7 @@
},
"overrides": [
{
- "files": "./gcpInstaller/**",
+ "files": "./src/gcpInstaller/**",
"rules": {
"no-console": "off"
}
diff --git a/packages/cloudrun/src/admin/bundle-installer.ts b/packages/cloudrun/src/admin/bundle-installer.ts
index ef8df5a688..a6628deb92 100644
--- a/packages/cloudrun/src/admin/bundle-installer.ts
+++ b/packages/cloudrun/src/admin/bundle-installer.ts
@@ -14,17 +14,14 @@ const bundleInstaller = async () => {
bundle: true,
outfile: bundlemjs,
format: 'esm',
- entryPoints: [path.resolve(__dirname, '../../gcpInstaller/install.mts')],
+ entryPoints: [path.resolve(__dirname, '../gcpInstaller/install.mts')],
});
const tfoutfile = path.join(outdir, 'main.tf');
- copyFileSync(
- path.resolve(__dirname, '../../gcpInstaller/main.tf'),
- tfoutfile
- );
+ copyFileSync(path.resolve(__dirname, '../gcpInstaller/main.tf'), tfoutfile);
execSync(
- `tar -cf ../../gcpInstaller/gcpInstaller.tar -C . ${path.relative(
+ `tar -cf ../gcpInstaller/gcpInstaller.tar -C . ${path.relative(
outdir,
bundlemjs
)} ${path.relative(outdir, tfoutfile)}`,
diff --git a/packages/cloudrun/src/cli/commands/render/helpers/renderArgsCheck.ts b/packages/cloudrun/src/cli/commands/render/helpers/renderArgsCheck.ts
index ca3b4ce372..2248e15552 100644
--- a/packages/cloudrun/src/cli/commands/render/helpers/renderArgsCheck.ts
+++ b/packages/cloudrun/src/cli/commands/render/helpers/renderArgsCheck.ts
@@ -41,7 +41,6 @@ export const renderArgsCheck = async (subcommand: string, args: string[]) => {
urlOrId: siteName,
bucketName: remotionBucket,
});
- Log.info(`Serve URL: ${serveUrl}\n`);
}
let composition: string = args[1];
@@ -97,10 +96,8 @@ export const renderArgsCheck = async (subcommand: string, args: string[]) => {
}
if (serviceName) {
- Log.info('Cloud Run service name passed, fetching Cloud Run url...');
region = region ?? getGcpRegion();
const {uri} = await getServiceInfo({serviceName, region});
- Log.info('cloud run url found: ', uri);
cloudRunUrl = uri;
}
diff --git a/packages/cloudrun/src/cli/commands/render/renderMedia.ts b/packages/cloudrun/src/cli/commands/render/renderMedia.ts
index b20bfaa4e6..ffc92e2697 100644
--- a/packages/cloudrun/src/cli/commands/render/renderMedia.ts
+++ b/packages/cloudrun/src/cli/commands/render/renderMedia.ts
@@ -64,8 +64,6 @@ export const renderMediaSubcommand = async (
CliInternals.Log.info(
CliInternals.chalk.gray(
`
-Sending request to Cloud Run:
-
Cloud Run Service URL = ${cloudRunUrl}
Type = media
Composition = ${composition}
diff --git a/packages/cloudrun/src/cli/commands/render/renderStill.ts b/packages/cloudrun/src/cli/commands/render/renderStill.ts
index 5ab54377b3..4e3cd11c08 100644
--- a/packages/cloudrun/src/cli/commands/render/renderStill.ts
+++ b/packages/cloudrun/src/cli/commands/render/renderStill.ts
@@ -47,6 +47,7 @@ export const renderStillSubcommand = async (
configImageFormat:
ConfigInternals.getUserPreferredStillImageFormat() ?? null,
});
+ Log.verbose(`Image format: (${imageFormat}), ${imageFormatReason}`);
// Todo: Check cloudRunUrl is valid, as the error message is obtuse
CliInternals.Log.info(
CliInternals.chalk.gray(
@@ -75,13 +76,13 @@ ${downloadName ? ` Downloaded File = ${downloadName}` : ''}
let doneIn: DoneIn = null;
- const updateProgress = () => {
+ const updateProgress = (newline: boolean) => {
progressBar.update(
[
- `Rendering on Cloud Run: `,
+ `Rendering on Cloud Run:`,
`${doneIn === null ? '...' : `Rendered in ${doneIn}ms`}`,
].join(' '),
- false
+ newline
);
};
@@ -103,27 +104,21 @@ ${downloadName ? ` Downloaded File = ${downloadName}` : ''}
outputFile: outName,
});
doneIn = Date.now() - renderStart;
- updateProgress();
+ updateProgress(true);
if (res.status === 'success') {
- Log.info(`
-
- `);
Log.info(
- CliInternals.chalk.blueBright(
- `
-🀘 Rendered still on Cloud Run! 🀘
-
- Public URL = ${decodeURIComponent(res.publicUrl)}
- Cloud Storage Uri = ${res.cloudStorageUri}
- Size (KB) = ${Math.round(Number(res.size) / 1000)}
- Bucket Name = ${res.bucketName}
- Privacy = ${res.privacy}
- Render ID = ${res.renderId}
- Image Format = ${imageFormat} (${imageFormatReason})
- `.trim()
+ CliInternals.chalk.gray(`Cloud Storage Uri = ${res.cloudStorageUri}`)
+ );
+ Log.info(CliInternals.chalk.gray(`Render ID = ${res.renderId}`));
+ Log.info(
+ CliInternals.chalk.gray(
+ `${Math.round(Number(res.size) / 1000)} KB, Privacy: ${
+ res.privacy
+ }, Bucket: ${res.bucketName}`
)
);
+ Log.info(CliInternals.chalk.blue(`β—‹ ${res.publicUrl}`));
if (downloadName) {
Log.info('');
diff --git a/packages/cloudrun/gcpInstaller/gcpInstaller.tar b/packages/cloudrun/src/gcpInstaller/gcpInstaller.tar
similarity index 100%
rename from packages/cloudrun/gcpInstaller/gcpInstaller.tar
rename to packages/cloudrun/src/gcpInstaller/gcpInstaller.tar
diff --git a/packages/cloudrun/gcpInstaller/install.mts b/packages/cloudrun/src/gcpInstaller/install.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/install.mts
rename to packages/cloudrun/src/gcpInstaller/install.mts
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/checkEnvFile.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/components/checkEnvFile.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/installerScripts/components/checkEnvFile.mts
rename to packages/cloudrun/src/gcpInstaller/installerScripts/components/checkEnvFile.mts
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/checkTerraformStateFile.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/components/checkTerraformStateFile.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/installerScripts/components/checkTerraformStateFile.mts
rename to packages/cloudrun/src/gcpInstaller/installerScripts/components/checkTerraformStateFile.mts
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/colorCodes.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/components/colorCodes.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/installerScripts/components/colorCodes.mts
rename to packages/cloudrun/src/gcpInstaller/installerScripts/components/colorCodes.mts
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/generateEnvPrompt.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/components/generateEnvPrompt.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/installerScripts/components/generateEnvPrompt.mts
rename to packages/cloudrun/src/gcpInstaller/installerScripts/components/generateEnvPrompt.mts
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/projectIdPrompt.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/components/projectIdPrompt.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/installerScripts/components/projectIdPrompt.mts
rename to packages/cloudrun/src/gcpInstaller/installerScripts/components/projectIdPrompt.mts
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/splashScreen.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/components/splashScreen.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/installerScripts/components/splashScreen.mts
rename to packages/cloudrun/src/gcpInstaller/installerScripts/components/splashScreen.mts
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/taskPrompt.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/components/taskPrompt.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/installerScripts/components/taskPrompt.mts
rename to packages/cloudrun/src/gcpInstaller/installerScripts/components/taskPrompt.mts
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/terraformApplyPrompt.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/components/terraformApplyPrompt.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/installerScripts/components/terraformApplyPrompt.mts
rename to packages/cloudrun/src/gcpInstaller/installerScripts/components/terraformApplyPrompt.mts
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/tfSuccessScreen.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/components/tfSuccessScreen.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/installerScripts/components/tfSuccessScreen.mts
rename to packages/cloudrun/src/gcpInstaller/installerScripts/components/tfSuccessScreen.mts
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/tasks/generateEnv.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/tasks/generateEnv.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/installerScripts/tasks/generateEnv.mts
rename to packages/cloudrun/src/gcpInstaller/installerScripts/tasks/generateEnv.mts
diff --git a/packages/cloudrun/gcpInstaller/installerScripts/tasks/setupGcpProject.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/tasks/setupGcpProject.mts
similarity index 100%
rename from packages/cloudrun/gcpInstaller/installerScripts/tasks/setupGcpProject.mts
rename to packages/cloudrun/src/gcpInstaller/installerScripts/tasks/setupGcpProject.mts
diff --git a/packages/cloudrun/gcpInstaller/main.tf b/packages/cloudrun/src/gcpInstaller/main.tf
similarity index 100%
rename from packages/cloudrun/gcpInstaller/main.tf
rename to packages/cloudrun/src/gcpInstaller/main.tf
diff --git a/packages/cloudrun/tsconfig.json b/packages/cloudrun/tsconfig.json
index 199e5e4c21..846d07dc95 100644
--- a/packages/cloudrun/tsconfig.json
+++ b/packages/cloudrun/tsconfig.json
@@ -5,8 +5,10 @@
"esModuleInterop": true,
"strict": true,
"outDir": "dist",
- "resolveJsonModule": true
+ "resolveJsonModule": true,
+ "composite": true,
+ "rootDir": "src"
},
- "include": ["src/**/*", "gcpInstaller/**/*", "gcpInstaller/*"],
+ "include": ["src"],
"exclude": ["node_modules"]
}
diff --git a/packages/docs/docs/cloudrun/generate-env.md b/packages/docs/docs/cloudrun/generate-env.md
index 691b69d1c8..dacf173e4d 100644
--- a/packages/docs/docs/cloudrun/generate-env.md
+++ b/packages/docs/docs/cloudrun/generate-env.md
@@ -20,7 +20,7 @@ GCP allows a maximum of 10 keys per service account. If you have already created
3. Within the Cloud Shell, type the following command and follow the prompts.
```bash
- curl -L https://github.com/UmungoBungo/remotion/raw/gcp-lambda-alternative/packages/cloudrun/gcpInstaller/gcpInstaller.tar | tar -x -C . && node install.mjs
+ curl -L https://github.com/UmungoBungo/remotion/raw/gcp-lambda-alternative/packages/cloudrun/src/gcpInstaller/gcpInstaller.tar | tar -x -C . && node install.mjs
```
_The first command downloads a tar file from the Remotion repo, and extracts it to the current directory. The second command runs the installer script._
diff --git a/packages/docs/docs/cloudrun/setup.md b/packages/docs/docs/cloudrun/setup.md
index a82786bfcf..de5bb70078 100644
--- a/packages/docs/docs/cloudrun/setup.md
+++ b/packages/docs/docs/cloudrun/setup.md
@@ -90,7 +90,7 @@ This means that you can pull in a script that runs a couple of gcloud and Terraf
// TODO: Switch to remotion-dev repo
```bash
- curl -L https://github.com/UmungoBungo/remotion/raw/gcp-lambda-alternative/packages/cloudrun/gcpInstaller/gcpInstaller.tar | tar -x -C . && node install.mjs
+ curl -L https://github.com/UmungoBungo/remotion/raw/gcp-lambda-alternative/packages/cloudrun/src/gcpInstaller/gcpInstaller.tar | tar -x -C . && node install.mjs
```
- Select <Step>1</Step> if you are using Remotion Cloud Run for the first time in this GCP project or want to upgrade.