From eabafa2b99205b88e0fa78733ba536341ad7f1ae Mon Sep 17 00:00:00 2001 From: PhilWindle <60546371+PhilWindle@users.noreply.github.com> Date: Wed, 31 Jul 2024 14:18:02 +0100 Subject: [PATCH] feat: Configure bot to run a local PXE (#7700) This PR configures the devnet bot to run all in one, with an integrated PXE --- yarn-project/aztec/terraform/bot/main.tf | 9 +++++---- yarn-project/aztec/terraform/bot/variables.tf | 5 +++++ yarn-project/bot/src/factory.ts | 8 +++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/yarn-project/aztec/terraform/bot/main.tf b/yarn-project/aztec/terraform/bot/main.tf index 780d4ab66aa..7eced3a3c38 100644 --- a/yarn-project/aztec/terraform/bot/main.tf +++ b/yarn-project/aztec/terraform/bot/main.tf @@ -76,8 +76,8 @@ locals { resource "aws_ecs_task_definition" "aztec-bot" { family = "${var.DEPLOY_TAG}-aztec-bot" network_mode = "awsvpc" - cpu = 2048 - memory = 4096 + cpu = 16384 + memory = 32768 requires_compatibilities = ["FARGATE"] execution_role_arn = data.terraform_remote_state.setup_iac.outputs.ecs_task_execution_role_arn task_role_arn = data.terraform_remote_state.aztec2_iac.outputs.cloudwatch_logging_ecs_role_arn @@ -86,7 +86,7 @@ resource "aws_ecs_task_definition" "aztec-bot" { { name = "${var.DEPLOY_TAG}-aztec-bot" image = "${var.DOCKERHUB_ACCOUNT}/aztec:${var.DEPLOY_TAG}" - command = ["start", "--bot"] + command = ["start", "--bot", "--pxe"] essential = true portMappings = [ { @@ -97,7 +97,6 @@ resource "aws_ecs_task_definition" "aztec-bot" { environment = [ { name = "BOT_PRIVATE_KEY", value = var.BOT_PRIVATE_KEY }, { name = "BOT_NO_START", value = var.BOT_NO_START }, - { name = "BOT_PXE_URL", value = "http://${var.DEPLOY_TAG}-aztec-pxe.local/${var.DEPLOY_TAG}/aztec-pxe/${var.API_KEY}" }, { name = "BOT_TX_INTERVAL_SECONDS", value = var.BOT_TX_INTERVAL_SECONDS }, { name = "LOG_LEVEL", value = var.LOG_LEVEL }, { name = "AZTEC_PORT", value = "80" }, @@ -105,6 +104,8 @@ resource "aws_ecs_task_definition" "aztec-bot" { { name = "BOT_PRIVATE_TRANSFERS_PER_TX", value = var.BOT_PRIVATE_TRANSFERS_PER_TX }, { name = "BOT_PUBLIC_TRANSFERS_PER_TX", value = var.BOT_PUBLIC_TRANSFERS_PER_TX }, { name = "BOT_TX_MINED_WAIT_SECONDS", value = var.BOT_TX_MINED_WAIT_SECONDS }, + { name = "AZTEC_NODE_URL", value = "http://${var.DEPLOY_TAG}-aztec-node-1.local/${var.DEPLOY_TAG}/aztec-node-1/${var.API_KEY}" }, + { name = "PXE_PROVER_ENABLED", value = tostring(var.PROVING_ENABLED) } ] logConfiguration = { logDriver = "awslogs" diff --git a/yarn-project/aztec/terraform/bot/variables.tf b/yarn-project/aztec/terraform/bot/variables.tf index f02f2943952..3f425c363bc 100644 --- a/yarn-project/aztec/terraform/bot/variables.tf +++ b/yarn-project/aztec/terraform/bot/variables.tf @@ -42,3 +42,8 @@ variable "BOT_TX_INTERVAL_SECONDS" { variable "BOT_TX_MINED_WAIT_SECONDS" { type = string } + +variable "PROVING_ENABLED" { + type = bool + default = false +} diff --git a/yarn-project/bot/src/factory.ts b/yarn-project/bot/src/factory.ts index c12e4d52866..eac5edb4c66 100644 --- a/yarn-project/bot/src/factory.ts +++ b/yarn-project/bot/src/factory.ts @@ -19,7 +19,13 @@ export class BotFactory { throw new Error(`Either a PXE client or a PXE URL must be provided`); } - this.pxe = dependencies.pxe ?? createPXEClient(config.pxeUrl!); + if (dependencies.pxe) { + this.log.info(`Using local PXE`); + this.pxe = dependencies.pxe; + return; + } + this.log.info(`Using remote PXE at ${config.pxeUrl!}`); + this.pxe = createPXEClient(config.pxeUrl!); } /**