From 21ec23d54fa69c3515f0d9fa23cc7ea1168d7e6e Mon Sep 17 00:00:00 2001 From: spypsy Date: Tue, 20 Feb 2024 15:14:25 +0000 Subject: [PATCH] fix: p2p-bootstrap ECS command + /status route (#4682) --- yarn-project/aztec/src/cli/cli.ts | 10 +++++++--- yarn-project/p2p-bootstrap/terraform/main.tf | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/yarn-project/aztec/src/cli/cli.ts b/yarn-project/aztec/src/cli/cli.ts index b4620842cbd..a6ad675c617 100644 --- a/yarn-project/aztec/src/cli/cli.ts +++ b/yarn-project/aztec/src/cli/cli.ts @@ -1,5 +1,5 @@ import { fileURLToPath } from '@aztec/aztec.js'; -import { ServerList, createNamespacedJsonRpcServer } from '@aztec/foundation/json-rpc/server'; +import { ServerList, createNamespacedJsonRpcServer, createStatusRouter } from '@aztec/foundation/json-rpc/server'; import { DebugLogger, LogFn } from '@aztec/foundation/log'; import { Command } from 'commander'; @@ -10,7 +10,7 @@ import { dirname, resolve } from 'path'; import { cliTexts } from './texts.js'; import { installSignalHandlers } from './util.js'; -const { AZTEC_PORT = '8080' } = process.env; +const { AZTEC_PORT = '8080', API_PREFIX = '' } = process.env; /** * Returns commander program that defines the 'aztec' command line interface. @@ -59,7 +59,11 @@ export function getProgram(userLog: LogFn, debugLogger: DebugLogger): Command { if (services.length) { const rpcServer = createNamespacedJsonRpcServer(services, debugLogger); - const app = rpcServer.getApp(); + const app = rpcServer.getApp(API_PREFIX); + // add status route + const statusRouter = createStatusRouter(API_PREFIX); + app.use(statusRouter.routes()).use(statusRouter.allowedMethods()); + const httpServer = http.createServer(app.callback()); httpServer.listen(options.port); userLog(`Aztec Server listening on port ${options.port}`); diff --git a/yarn-project/p2p-bootstrap/terraform/main.tf b/yarn-project/p2p-bootstrap/terraform/main.tf index 57070dcfa76..1d3b8cdffaa 100644 --- a/yarn-project/p2p-bootstrap/terraform/main.tf +++ b/yarn-project/p2p-bootstrap/terraform/main.tf @@ -108,7 +108,6 @@ resource "aws_ecs_task_definition" "p2p-bootstrap" { "image": "${var.DOCKERHUB_ACCOUNT}/aztec:${var.DEPLOY_TAG}", "command": ["start", "--p2p-bootstrap"], "essential": true, - "command": ["start"], "memoryReservation": 3776, "portMappings": [ {