Skip to content

Commit

Permalink
👷 Fix ponder serving config
Browse files Browse the repository at this point in the history
  • Loading branch information
KONFeature committed Aug 23, 2024
1 parent 44f6c4e commit 59a8e1e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
23 changes: 10 additions & 13 deletions iac/Indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand All @@ -273,7 +269,7 @@ export function IndexerStack({ app, stack }: StackContext) {
});
httpListener.addTargetGroups("IndexerServingTarget", {
targetGroups: [indexerServingTargetGroup],
priority: 20,
priority: 30,
conditions: [ListenerCondition.pathPatterns(["/*"])],
});

Expand Down Expand Up @@ -448,14 +444,15 @@ function addIndexerService({
app,
name: "indexer",
tag: process.env.PONDER_IMAGE_TAG,
suffix: instanceType.suffix,
});

// The service itself
const indexerService = new Service(stack, `${instanceType.suffix}Service`, {
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
Expand Down Expand Up @@ -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,
Expand All @@ -502,7 +499,7 @@ function addIndexerService({
});

stack.addOutputs({
indexerServiceId: indexerService.id,
[`${instanceType.suffix}ServiceId`]: indexerService.id,
});

return indexerService;
Expand Down
5 changes: 3 additions & 2 deletions iac/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 59a8e1e

Please sign in to comment.