-
Notifications
You must be signed in to change notification settings - Fork 9
/
deploy.ts
52 lines (49 loc) · 1.41 KB
/
deploy.ts
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
import {
deployFunction,
deploySite,
getOrCreateBucket,
} from "@remotion/lambda";
import dotenv from "dotenv";
import path from "path";
import { SITE_ID } from "./src/config";
import { getAccountCount } from "./src/get-account-count";
import { usedRegions } from "./src/regions";
import { setEnvForKey } from "./src/set-env-for-key";
dotenv.config();
const count = getAccountCount();
console.log(`Found ${count} accounts. Deploying...`);
const execute = async () => {
for (let i = 1; i <= count; i++) {
for (const region of usedRegions) {
setEnvForKey(i);
const { functionName, alreadyExisted } = await deployFunction({
architecture: "arm64",
createCloudWatchLogGroup: true,
memorySizeInMb: 2048,
timeoutInSeconds: 240,
region,
});
console.log(
`${
alreadyExisted ? "Ensured" : "Deployed"
} function "${functionName}" to ${region} in account ${i}`
);
const { bucketName } = await getOrCreateBucket({ region });
const { serveUrl } = await deploySite({
siteName: SITE_ID,
bucketName,
entryPoint: path.join(process.cwd(), "remotion/index.tsx"),
region,
});
console.log(
`Deployed site to ${region} in account ${i} under ${serveUrl}`
);
}
}
};
execute()
.then(() => process.exit(0))
.catch((err) => {
console.error(err);
process.exit(1);
});