-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.mjs
More file actions
60 lines (56 loc) · 1.5 KB
/
deploy.mjs
File metadata and controls
60 lines (56 loc) · 1.5 KB
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
import { GrpcTransport } from "@protobuf-ts/grpc-transport";
import { ChannelCredentials } from "@grpc/grpc-js";
import {
DeployApplicationRequest,
DeployServiceClient,
VpcAlias,
Service,
Container,
Component,
ServiceProtocol,
logMessages,
GrpcStatusCode,
} from "@aidiv/pulumi-deploy";
const transport = new GrpcTransport({
host: "internal-ad08dafb4378c479e8d4e3f6ad6c645b-1220029048.us-gov-east-1.elb.amazonaws.com:80",
channelCredentials: ChannelCredentials.createInsecure(),
});
const client = new DeployServiceClient(transport);
const ecrImages = process.env["ECR_IMAGES"].split(",");
const frontendImage = ecrImages.find((image) => image.includes("frontend"));
const request = DeployApplicationRequest.create({
vpc: VpcAlias.DEV,
appName: "starter-app",
secretKey: process.env["DEPLOYMENT_KEY"],
components: [
Component.create({
name: "front-end",
service: Service.create({
externalPath: "/starter-app",
ports: [
{
name: "front-end",
exposedPort: 80,
containerPort: 3000,
public: true,
protocol: ServiceProtocol.HTTP,
},
],
}),
containers: [
Container.create({
name: "nextjs",
image: frontendImage,
ports: [3000],
}),
],
}),
],
});
const result = client.deployApplication(request);
logMessages(result);
result.responses.onMessage((e) => {
if (e.code !== GrpcStatusCode.OK) {
throw e.message;
}
});