Skip to content

Commit

Permalink
👷 Test erpc without ALB
Browse files Browse the repository at this point in the history
  • Loading branch information
KONFeature committed Jul 26, 2024
1 parent 6f9e7a8 commit 639c23f
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 132 deletions.
35 changes: 8 additions & 27 deletions iac/Erpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ContainerImage } from "aws-cdk-lib/aws-ecs";
import { Duration } from "aws-cdk-lib/core";
import { Service, type StackContext, use } from "sst/constructs";
import { ConfigStack } from "./Config";
import { IndexerStack } from "./Indexer";
import { buildSecretsMap } from "./utils";

/**
Expand Down Expand Up @@ -35,15 +36,13 @@ export function ErpcStack({ app, stack }: StackContext) {
imageTag
);

// Get our indexer service
const indexerService = use(IndexerStack);

// The service itself
const erpcService = new Service(stack, "ErpcService", {
path: "packages/erpc",
port: 4000,
// Domain mapping
customDomain: {
domainName: "erpc.frak.id",
hostedZone: "frak.id",
},
// Setup some capacity options
scaling: {
minContainers: 1,
Expand All @@ -66,18 +65,10 @@ export function ErpcStack({ app, stack }: StackContext) {
ERPC_LOG_LEVEL: "warn",
},
cdk: {
applicationLoadBalancerTargetGroup: {
deregistrationDelay: Duration.seconds(60),
healthCheck: {
// todo: Should have a health path or something like that
path: "/",
port: "traffic-port",
interval: Duration.seconds(20),
healthyThresholdCount: 2,
unhealthyThresholdCount: 5,
healthyHttpCodes: "200-299",
},
},
vpc: indexerService.cdk?.vpc,
// Don't auto setup the ALB since we will be using the one from the indexer service
// todo: setup the ALB after the indexer service is deployed
applicationLoadBalancer: false,
// Customise fargate service to enable circuit breaker (if the new deployment is failing)
fargateService: {
circuitBreaker: {
Expand All @@ -95,16 +86,6 @@ export function ErpcStack({ app, stack }: StackContext) {
containerName: "erpc",
image: erpcImage,
secrets: cdkSecretsMap,
/*healthCheck: {
command: [
"CMD-SHELL",
"curl -f http://localhost:4001 || exit 1",
],
interval: Duration.seconds(30),
timeout: Duration.seconds(15),
retries: 3,
startPeriod: Duration.seconds(30),
},*/
},
},
});
Expand Down
2 changes: 2 additions & 0 deletions iac/Indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,6 @@ export function IndexerStack({ app, stack }: StackContext) {
stack.addOutputs({
indexerServiceId: indexerService.id,
});

return indexerService;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@types/aws-lambda": "8.10.142",
"@types/aws-lambda": "8.10.138",
"@types/node": "^20.14.12",
"aws-cdk-lib": "2.142.1",
"sst": "2.43.4",
Expand Down
Loading

0 comments on commit 639c23f

Please sign in to comment.