Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1040 - 2/3 Add ALB behind API's NLB to avoid errors on restart #2299

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

leite08
Copy link
Member

@leite08 leite08 commented Jun 19, 2024

Ref. metriport/metriport-internal#1040

Dependencies

Description

Point infra to use the ALB version of the API's - context

Testing

  • Local
    • cdk diff successful
  • Staging
    • API through API GW works
    • Dash through API GW works
    • ECS restart script leads to near zero errors upon restart of API
      • executeWithNetworkRetries is not on base branch yet (develop)
  • Sandbox
    • none
  • Production
    • none

Release Plan

  • Merge this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some change I had local and think its useful for debugging purposes

@@ -428,6 +429,7 @@ export class APIStack extends Stack {
},
cookieStore,
});
const apiLoadBalancerAddress = apiLoadBalancer.loadBalancerDnsName;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Differentiate between LB address (needed for API GW integration) and "direct" access address that points to the ALB (so lambdas don't need the additional network hop of going through the NLB to get to the API).

Comment on lines 330 to 546
// This speeds up deployments so the tasks are swapped quicker.
// See for details: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html#deregistration-delay
fargateService.targetGroup.setAttribute("deregistration_delay.timeout_seconds", "17");

// This also speeds up deployments so the health checks have a faster turnaround.
// See for details: https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-health-checks.html
fargateService.targetGroup.configureHealthCheck({
healthyThresholdCount: 2,
interval: Duration.seconds(10),
});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved these to be close to the LB/TG definitions

@leite08 leite08 marked this pull request as ready for review June 19, 2024 18:19
Copy link
Member

@jonahkaye jonahkaye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions.
Plus whats the release plan? Do we need to break this up into multiple PRs to eliminate and then add infra or should it be good to send all in one PR?

@leite08
Copy link
Member Author

leite08 commented Jun 19, 2024

Plus whats the release plan? Do we need to break this up into multiple PRs to eliminate and then add infra or should it be good to send all in one PR?

Great question! I was so focused on fixing this quickly that I didn't think about this. I'm splitting this in three PRs:

  1. Creates a new ALB based Fargate Service
  2. Points all to the new service (this PR)
  3. Removes the old NLB based Fargate Service

@leite08 leite08 changed the base branch from develop to 1040-alb-behind-api-nlb_1 June 19, 2024 19:29
@leite08 leite08 force-pushed the 1040-alb-behind-api-nlb branch 2 times, most recently from 9af3740 to eb859b5 Compare June 19, 2024 19:46
@leite08 leite08 changed the title 1040 Add ALB behind API's NLB to avoid errors on restart 1040 - 2/3 Add ALB behind API's NLB to avoid errors on restart Jun 19, 2024
@leite08 leite08 mentioned this pull request Jun 19, 2024
5 tasks
@leite08 leite08 force-pushed the 1040-alb-behind-api-nlb_1 branch 3 times, most recently from 3b92645 to 3f316aa Compare June 19, 2024 23:57
Base automatically changed from 1040-alb-behind-api-nlb_1 to develop June 20, 2024 02:17
Copy link
Contributor

@RamilGaripov RamilGaripov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@leite08 leite08 added this pull request to the merge queue Jun 20, 2024
Merged via the queue into develop with commit 1963b3b Jun 20, 2024
11 checks passed
@leite08 leite08 deleted the 1040-alb-behind-api-nlb branch June 20, 2024 03:04
@leite08 leite08 mentioned this pull request Jun 20, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants