-
Notifications
You must be signed in to change notification settings - Fork 5
/
deploy.mjs
77 lines (69 loc) · 2.09 KB
/
deploy.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import {
deployFunction,
deploySite,
getOrCreateBucket,
} from "@remotion/lambda";
import dotenv from "dotenv";
import path from "path";
import { DISK, RAM, REGION, SITE_NAME, TIMEOUT } from "./config.mjs";
console.log("Selected region:", REGION);
dotenv.config();
if (!process.env.AWS_ACCESS_KEY_ID && !process.env.REMOTION_AWS_ACCESS_KEY_ID) {
console.log(
'The environment variable "REMOTION_AWS_ACCESS_KEY_ID" is not set.',
);
console.log("Lambda renders were not set up.");
console.log(
"Complete the Lambda setup: at https://www.remotion.dev/docs/lambda/setup",
);
process.exit(0);
}
if (
!process.env.AWS_SECRET_ACCESS_KEY &&
!process.env.REMOTION_AWS_SECRET_ACCESS_KEY
) {
console.log(
'The environment variable "REMOTION_REMOTION_AWS_SECRET_ACCESS_KEY" is not set.',
);
console.log("Lambda renders were not set up.");
console.log(
"Complete the Lambda setup: at https://www.remotion.dev/docs/lambda/setup",
);
process.exit(0);
}
process.stdout.write("Deploying Lambda function... ");
const { functionName, alreadyExisted: functionAlreadyExisted } =
await deployFunction({
createCloudWatchLogGroup: true,
memorySizeInMb: RAM,
region: REGION,
timeoutInSeconds: TIMEOUT,
diskSizeInMb: DISK,
});
console.log(
functionName,
functionAlreadyExisted ? "(already existed)" : "(created)",
);
process.stdout.write("Ensuring bucket... ");
const { bucketName, alreadyExisted: bucketAlreadyExisted } =
await getOrCreateBucket({
region: REGION,
});
console.log(
bucketName,
bucketAlreadyExisted ? "(already existed)" : "(created)",
);
process.stdout.write("Deploying site... ");
const { siteName } = await deploySite({
bucketName,
entryPoint: path.join(process.cwd(), "remotion", "index.ts"),
siteName: SITE_NAME,
region: REGION,
});
console.log(siteName);
console.log();
console.log("You now have everything you need to render videos!");
console.log("Re-run this command when:");
console.log(" 1) you changed the video template");
console.log(" 2) you changed config.mjs");
console.log(" 3) you upgraded Remotion to a newer version");