Skip to content

Commit

Permalink
ci(pulumi): add port 8011 listener for ipfs healthcheck
Browse files Browse the repository at this point in the history
- set a new listener for port 8011 for the ipfs healthcheck port
- also bring over recent ceramic-testnet changes into ceramic-mainnet
  pulumi file
  • Loading branch information
shavinac committed May 25, 2022
1 parent 9cb0bdc commit b25dbaf
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 29 deletions.
37 changes: 23 additions & 14 deletions infra/ceramic-mainnet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,37 @@ const httpListener = alb.createListener("gitcoin-dpopp-ceramic-http", {
});
export const frontendUrlEcs = pulumi.interpolate`http://${httpListener.endpoint.hostname}/`;

// Target group with the port of the Docker image
// Target group for the Ceramic container
const target = alb.createTargetGroup("gitcoin-dpopp-ceramic", {
vpc,
port: 80,
healthCheck: { path: "/api/v0/node/healthcheck" },
});

// Listen to traffic on port 443 & route it through the target group
// Listen to traffic on port 443 & route it through the Ceramic target group
const httpsListener = target.createListener("gitcoin-dpopp-ceramic-https", {
port: 443,
certificateArn: certificateValidation.certificateArn,
});

// Target group for the IPFS container
const ceramicTarget = alb.createTargetGroup("gitcoin-dpopp-swarm", {
vpc,
port: 4011,
protocol: "HTTP",
healthCheck: { path: "/", unhealthyThreshold: 5, port: "8011", interval: 60, timeout: 30 },
});

const ceramicListener = ceramicTarget.createListener("gitcoin-dpopp-swarm", {
protocol: "HTTP",
port: 4011,
});

const ipfsHealthcheckListener = ceramicTarget.createListener("gitcoin-ipfs-healthcheck", {
protocol: "HTTP",
port: 8011,
});

// Create a DNS record for the load balancer
const www = new aws.route53.Record("www", {
zoneId: route53Zone,
Expand Down Expand Up @@ -239,10 +258,8 @@ const service = new awsx.ecs.FargateService("dpopp-ceramic", {
containerPort: 5001,
hostPort: 5001,
},
{
containerPort: 8011,
hostPort: 8011,
},
ipfsHealthcheckListener,
ceramicListener,
],
links: [],
environment: [
Expand Down Expand Up @@ -284,12 +301,4 @@ const service = new awsx.ecs.FargateService("dpopp-ceramic", {
},
});

// const ecsTarget = new aws.appautoscaling.Target("autoscaling_target", {
// maxCapacity: 10,
// minCapacity: 1,
// resourceId: pulumi.interpolate`service/${cluster.cluster.name}/${service.service.name}`,
// scalableDimension: "ecs:service:DesiredCount",
// serviceNamespace: "ecs",
// });

export const ceramicUrl = pulumi.interpolate`https://${domain}`;
26 changes: 11 additions & 15 deletions infra/ceramic-testnet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,20 @@ const httpListener = alb.createListener("gitcoin-dpopp-ceramic-http", {
});
export const frontendUrlEcs = pulumi.interpolate`http://${httpListener.endpoint.hostname}/`;

// Target group with the port of the Docker image
// Target group for the Ceramic container
const target = alb.createTargetGroup("gitcoin-dpopp-ceramic", {
vpc,
port: 80,
healthCheck: { path: "/api/v0/node/healthcheck" },
});

// Listen to traffic on port 443 & route it through the target group
// Listen to traffic on port 443 & route it through the Ceramic target group
const httpsListener = target.createListener("gitcoin-dpopp-ceramic-https", {
port: 443,
certificateArn: certificateValidation.certificateArn,
});

// Target group for the IPFS container
const ceramicTarget = alb.createTargetGroup("gitcoin-dpopp-swarm", {
vpc,
port: 4011,
Expand All @@ -188,6 +190,11 @@ const ceramicListener = ceramicTarget.createListener("gitcoin-dpopp-swarm", {
port: 4011,
});

const ipfsHealthcheckListener = ceramicTarget.createListener("gitcoin-ipfs-healthcheck", {
protocol: "HTTP",
port: 8011,
});

// Create a DNS record for the load balancer
const www = new aws.route53.Record("www", {
zoneId: route53Zone,
Expand Down Expand Up @@ -246,11 +253,8 @@ const service = new awsx.ecs.FargateService("dpopp-ceramic", {
containerPort: 5001,
hostPort: 5001,
},
{
containerPort: 8011,
hostPort: 8011,
},
ceramicListener
ipfsHealthcheckListener,
ceramicListener,
],
links: [],
environment: [
Expand Down Expand Up @@ -292,12 +296,4 @@ const service = new awsx.ecs.FargateService("dpopp-ceramic", {
},
});

// const ecsTarget = new aws.appautoscaling.Target("autoscaling_target", {
// maxCapacity: 10,
// minCapacity: 1,
// resourceId: pulumi.interpolate`service/${cluster.cluster.name}/${service.service.name}`,
// scalableDimension: "ecs:service:DesiredCount",
// serviceNamespace: "ecs",
// });

export const ceramicUrl = pulumi.interpolate`https://${domain}`;

0 comments on commit b25dbaf

Please sign in to comment.