From 59a8e1ea416b29fbc25369f3786b4c84c9105709 Mon Sep 17 00:00:00 2001 From: KONFeature Date: Fri, 23 Aug 2024 16:26:47 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Fix=20ponder=20serving=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iac/Indexer.ts | 23 ++++++++++------------- iac/utils.ts | 5 +++-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/iac/Indexer.ts b/iac/Indexer.ts index 37bec4f..7627956 100644 --- a/iac/Indexer.ts +++ b/iac/Indexer.ts @@ -142,12 +142,12 @@ export function IndexerStack({ app, stack }: StackContext) { // Allow connections to the applications ports alb.connections.allowTo( indexerFaragateService, - Port.tcp(ponderInstanceTypeConfig.indexing.port), + Port.tcp(42069), "Allow connection from ALB to public indexer indexing port" ); alb.connections.allowTo( indexerServingFargeteService, - Port.tcp(ponderInstanceTypeConfig.serving.port), + Port.tcp(42069), "Allow connection from ALB to public indexer serving port" ); alb.connections.allowTo( @@ -174,13 +174,9 @@ export function IndexerStack({ app, stack }: StackContext) { "Allow erpc public port internally" ); httpListener.connections.allowInternally( - Port.tcp(ponderInstanceTypeConfig.indexing.port), + Port.tcp(42069), "Allow indexer indexing public port internally" ); - httpListener.connections.allowInternally( - Port.tcp(ponderInstanceTypeConfig.serving.port), - "Allow indexer serving public port internally" - ); // Add the internal erpc url to the ponder instance indexerService.addEnvironment( @@ -225,7 +221,7 @@ export function IndexerStack({ app, stack }: StackContext) { "IndexerTargetGroup", { vpc: vpc, - port: ponderInstanceTypeConfig.indexing.port, + port: 42069, protocol: ApplicationProtocol.HTTP, targets: [indexerFaragateService], deregistrationDelay: Duration.seconds(10), @@ -254,7 +250,7 @@ export function IndexerStack({ app, stack }: StackContext) { "IndexerServingTargetGroup", { vpc: vpc, - port: ponderInstanceTypeConfig.serving.port, + port: 42069, protocol: ApplicationProtocol.HTTP, targets: [indexerServingFargeteService], deregistrationDelay: Duration.seconds(10), @@ -273,7 +269,7 @@ export function IndexerStack({ app, stack }: StackContext) { }); httpListener.addTargetGroups("IndexerServingTarget", { targetGroups: [indexerServingTargetGroup], - priority: 20, + priority: 30, conditions: [ListenerCondition.pathPatterns(["/*"])], }); @@ -448,6 +444,7 @@ function addIndexerService({ app, name: "indexer", tag: process.env.PONDER_IMAGE_TAG, + suffix: instanceType.suffix, }); // The service itself @@ -455,7 +452,7 @@ function addIndexerService({ path: "packages/ponder", // SST not happy, can't connect to ECR to fetch the instance during the build process // file: "Dockerfile.prebuilt", - port: instanceType.port, + port: 42069, // Setup some capacity options scaling: instanceType.scaling, // Bind the secret we will be using @@ -493,7 +490,7 @@ function addIndexerService({ }, // Directly specify the image position in the registry here container: { - containerName: "indexer", + containerName: instanceType.suffix.toLowerCase(), image: indexerImage, secrets: cdkSecretsMap, entryPoint: instanceType.entryPoint, @@ -502,7 +499,7 @@ function addIndexerService({ }); stack.addOutputs({ - indexerServiceId: indexerService.id, + [`${instanceType.suffix}ServiceId`]: indexerService.id, }); return indexerService; diff --git a/iac/utils.ts b/iac/utils.ts index bb7f5bb..6810260 100644 --- a/iac/utils.ts +++ b/iac/utils.ts @@ -14,11 +14,12 @@ export function getImageFromName({ app, name, tag, -}: { stack: Stack; app: App; name: string; tag?: string }) { + suffix +}: { stack: Stack; app: App; name: string; tag?: string, suffix?: string }) { // Get the container props of our prebuilt binaries const containerRegistry = Repository.fromRepositoryAttributes( stack, - `${name}Ecr`, + `${name}Ecr${suffix}`, { repositoryArn: `arn:aws:ecr:eu-west-1:${app.account}:repository/${name}`, repositoryName: name,