From c615bf58898013b8496a00c6ebc66145eae385ab Mon Sep 17 00:00:00 2001 From: spypsy Date: Wed, 6 Dec 2023 12:32:05 +0000 Subject: [PATCH 1/2] use API_PREFIX in sandbox node --- yarn-project/aztec-node/terraform/main.tf | 7 ++++--- yarn-project/aztec-sandbox/src/bin/index.ts | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/yarn-project/aztec-node/terraform/main.tf b/yarn-project/aztec-node/terraform/main.tf index 96d3dd0f58b..6403008de74 100644 --- a/yarn-project/aztec-node/terraform/main.tf +++ b/yarn-project/aztec-node/terraform/main.tf @@ -63,6 +63,7 @@ locals { ] combined_bootnodes = join(",", local.bootnodes) data_dir = "/usr/src/yarn-project/aztec-sandbox/data" + api_prefix = "/${var.DEPLOY_TAG}/aztec-node-${count.index + 1}" } resource "aws_cloudwatch_log_group" "aztec-node-log-group" { @@ -244,7 +245,7 @@ resource "aws_ecs_task_definition" "aztec-node" { }, { "name": "API_PREFIX", - "value": "/${var.DEPLOY_TAG}/aztec-node-${count.index + 1}" + "value": ${local.api_prefix} }, { "name": "P2P_TCP_LISTEN_PORT", @@ -358,7 +359,7 @@ resource "aws_alb_target_group" "aztec-node" { deregistration_delay = 5 health_check { - path = "/${var.DEPLOY_TAG}/aztec-node-${count.index + 1}/status" + path = "${local.api_prefix}/status" matcher = "200" interval = 10 healthy_threshold = 2 @@ -383,7 +384,7 @@ resource "aws_lb_listener_rule" "api" { condition { path_pattern { - values = ["/${var.DEPLOY_TAG}/aztec-node-${count.index}*"] + values = ["${local.api_prefix}*"] } } } diff --git a/yarn-project/aztec-sandbox/src/bin/index.ts b/yarn-project/aztec-sandbox/src/bin/index.ts index 64f9600a10f..091250599a7 100644 --- a/yarn-project/aztec-sandbox/src/bin/index.ts +++ b/yarn-project/aztec-sandbox/src/bin/index.ts @@ -37,6 +37,7 @@ const { MODE = 'sandbox', TEST_ACCOUNTS = 'true', DEPLOY_AZTEC_CONTRACTS = 'true', + API_PREFIX = '', } = process.env; const logger = createDebugLogger(`aztec:${MODE}`); @@ -150,7 +151,7 @@ async function main() { const app = nodeRpcServer.getApp(); // Add a /status endpoint - const statusRouter = createStatusRouter(); + const statusRouter = createStatusRouter(API_PREFIX); app.use(statusRouter.routes()); app.use(statusRouter.allowedMethods()); From 7a293ebce13e28c28c367213fd5a9661fc7bd6c3 Mon Sep 17 00:00:00 2001 From: spypsy Date: Wed, 6 Dec 2023 12:32:25 +0000 Subject: [PATCH 2/2] log correct port --- yarn-project/aztec-sandbox/src/bin/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/aztec-sandbox/src/bin/index.ts b/yarn-project/aztec-sandbox/src/bin/index.ts index 091250599a7..71cf982e046 100644 --- a/yarn-project/aztec-sandbox/src/bin/index.ts +++ b/yarn-project/aztec-sandbox/src/bin/index.ts @@ -159,7 +159,7 @@ async function main() { const httpServer = http.createServer(app.callback()); httpServer.listen(port); - logStrings.push(`Aztec Node v${version} (noir ${NoirCommit}) is now ready for use in port ${AZTEC_NODE_PORT}!`); + logStrings.push(`Aztec Node v${version} (noir ${NoirCommit}) is now ready for use in port ${port}!`); } else if (mode === SandboxMode.PXE) { // Code path for starting PXE only