Skip to content

Commit

Permalink
feat: Configure bot to run a local PXE (#7700)
Browse files Browse the repository at this point in the history
This PR configures the devnet bot to run all in one, with an integrated
PXE
  • Loading branch information
PhilWindle authored Jul 31, 2024
1 parent 26cec69 commit eabafa2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
9 changes: 5 additions & 4 deletions yarn-project/aztec/terraform/bot/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = [
{
Expand All @@ -97,14 +97,15 @@ 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" },
{ name = "API_PREFIX", value = local.api_prefix },
{ 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"
Expand Down
5 changes: 5 additions & 0 deletions yarn-project/aztec/terraform/bot/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ variable "BOT_TX_INTERVAL_SECONDS" {
variable "BOT_TX_MINED_WAIT_SECONDS" {
type = string
}

variable "PROVING_ENABLED" {
type = bool
default = false
}
8 changes: 7 additions & 1 deletion yarn-project/bot/src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!);
}

/**
Expand Down

0 comments on commit eabafa2

Please sign in to comment.