Skip to content

Commit

Permalink
feat: devnet deployments (#7024)
Browse files Browse the repository at this point in the history
  • Loading branch information
spypsy authored Jun 20, 2024
1 parent ed2f98e commit fa70876
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 29 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/devnet-deploys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Deploy to devnet
on:
push:
branches: [devnet]

env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
GIT_COMMIT: ${{ github.sha }}
# TF Vars
TF_VAR_DOCKERHUB_ACCOUNT: aztecprotocol
TF_VAR_CHAIN_ID: 31337
TF_VAR_BOOTNODE_1_PRIVATE_KEY: ${{ secrets.BOOTNODE_1_PRIVATE_KEY }}
TF_VAR_BOOTNODE_2_PRIVATE_KEY: ${{ secrets.BOOTNODE_2_PRIVATE_KEY }}
TF_VAR_SEQ_1_PUBLISHER_PRIVATE_KEY: ${{ secrets.SEQ_1_PUBLISHER_PRIVATE_KEY }}
TF_VAR_SEQ_2_PUBLISHER_PRIVATE_KEY: ${{ secrets.SEQ_2_PUBLISHER_PRIVATE_KEY }}
TF_VAR_DEPLOY_TAG: devnet
TF_VAR_API_KEY: ${{ secrets.FORK_API_KEY }}

jobs:
setup:
uses: ./.github/workflows/setup-runner.yml
with:
username: master
runner_type: builder-x86
secrets: inherit

build:
runs-on: ${{ github.actor }}-x86
steps:
- uses: actions/checkout@v4
with: { ref: "${{ env.GIT_COMMIT }}" }
- uses: ./.github/ci-setup-action
with:
dockerhub_password: "${{ secrets.DOCKERHUB_PASSWORD }}"
concurrency_key: build-release-artifacts-${{ github.actor }}
- name: "Build & Push images"
timeout-minutes: 40
# Run the build steps for each image with version and arch, push to dockerhub
run: |
earthly-ci --no-output --push ./yarn-project+export-aztec-arch --DIST_TAG=devnet
terraform_deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
with: { ref: "${{ env.GIT_COMMIT }}" }
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.7.5

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2

- name: Deploy Bootstrap Nodes
working-directory: ./yarn-project/aztec/terraform/node
run: |
terraform init -input=false -backend-config="key=devnet/aztec-node"
terraform apply -input=false -auto-approve
- name: Deploy Aztec Nodes
working-directory: ./yarn-project/aztec/terraform/node
run: |
terraform init -input=false -backend-config="key=devnet/aztec-node"
terraform apply -input=false -auto-approve
18 changes: 0 additions & 18 deletions iac/mainnet-fork/Dockerfile

This file was deleted.

29 changes: 29 additions & 0 deletions iac/mainnet-fork/Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
VERSION 0.8

build:
FROM ubuntu:focal

# Install nginx
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update && apt install -y git curl nginx

# Copy nginx config
COPY . .
COPY nginx/gateway.conf /etc/nginx/gateway.conf
COPY nginx/nginx.conf /etc/nginx/nginx.conf

# Install foundry
RUN ./scripts/install_foundry.sh
ENV PATH="./foundry/bin:${PATH}"

# Expose port 80
EXPOSE 80

# Set entrypoint
ENTRYPOINT ["sh", "-c", "./scripts/run_nginx_anvil.sh"]

export-mainnet-fork:
FROM +build
ARG DIST_TAG="aztec-dev"
ARG ARCH
SAVE IMAGE --push spypsy/mainnet-fork:${DIST_TAG}${ARCH:+-$ARCH}
1 change: 1 addition & 0 deletions iac/mainnet-fork/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ http {
# Basic Settings
##

client_max_body_size 20M;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
Expand Down
34 changes: 34 additions & 0 deletions yarn-project/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,28 @@ aztec:
CMD curl -fsSd '{\"jsonrpc\":\"2.0\",\"method\":\"pxe_getNodeInfo\",\"id\":1}' http://127.0.0.1:$port
EXPOSE $port

aztec-faucet-build:
FROM +build
RUN yarn workspaces focus @aztec/aztec-faucet --production && yarn cache clean
RUN rm -rf \
../noir-projects \
../l1-contracts \
../barretenberg/ts/src \
../barretenberg/ts/dest/node-cjs \
../barretenberg/ts/dest/browser \
aztec.js/dest/main.js \
end-to-end \
**/src \
**/artifacts
SAVE ARTIFACT /usr/src /usr/src

aztec-faucet:
FROM ubuntu:noble
RUN apt update && apt install nodejs curl -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY +aztec-faucet/usr/src /usr/src
ENTRYPOINT ["node", "--no-warnings", "/usr/src/yarn-project/aztec-faucet/dest/bin/index.js"]
LET port=8080

# We care about creating a slimmed down e2e image because we have to serialize it from earthly to docker for running.
end-to-end-prod:
FROM +build
Expand Down Expand Up @@ -219,6 +241,18 @@ export-aztec:
FROM +aztec
SAVE IMAGE aztecprotocol/aztec:$EARTHLY_GIT_HASH

export-aztec-arch:
FROM +aztec
ARG DIST_TAG="latest"
ARG ARCH
SAVE IMAGE --push aztecprotocol/aztec:${DIST_TAG}${ARCH:+-$ARCH}

export-aztec-faucet:
FROM +aztec-faucet
ARG DIST_TAG="latest"
ARG ARCH
SAVE IMAGE --push aztecprotocol/aztec-faucet:${DIST_TAG}${ARCH:+-$ARCH}

export-end-to-end:
ARG EARTHLY_GIT_HASH
FROM +end-to-end
Expand Down
14 changes: 7 additions & 7 deletions yarn-project/aztec/terraform/node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -234,31 +234,31 @@ resource "aws_ecs_task_definition" "aztec-node" {
{
"name": "ROLLUP_CONTRACT_ADDRESS",
"value": "${var.ROLLUP_CONTRACT_ADDRESS}"
"value": "${data.terraform_remote_state.l1_contracts.outputs.rollup_contract_address}"
},
{
"name": "INBOX_CONTRACT_ADDRESS",
"value": "${var.INBOX_CONTRACT_ADDRESS}"
"value": "${data.terraform_remote_state.l1_contracts.outputs.inbox_contract_address}"
},
{
"name": "OUTBOX_CONTRACT_ADDRESS",
"value": "${var.OUTBOX_CONTRACT_ADDRESS}"
"value": "${data.terraform_remote_state.l1_contracts.outputs.outbox_contract_address}"
},
{
"name": "REGISTRY_CONTRACT_ADDRESS",
"value": "${var.REGISTRY_CONTRACT_ADDRESS}"
"value": "${data.terraform_remote_state.l1_contracts.outputs.registry_contract_address}"
},
{
"name": "AVAILABILITY_ORACLE_CONTRACT_ADDRESS",
"value": "${var.AVAILABILITY_ORACLE_CONTRACT_ADDRESS}"
"value": "${data.terraform_remote_state.l1_contracts.outputs.availability_oracle_contract_address}"
},
{
"name": "GAS_TOKEN_CONTRACT_ADDRESS",
"value": "${var.GAS_TOKEN_CONTRACT_ADDRESS}"
"value": "${data.terraform_remote_state.l1_contracts.outputs.gas_token_contract_address}"
},
{
"name": "GAS_PORTAL_CONTRACT_ADDRESS",
"value": "${var.GAS_PORTAL_CONTRACT_ADDRESS}"
"value": "${data.terraform_remote_state.l1_contracts.outputs.gas_portal_contract_address}"
},
{
"name": "API_KEY",
Expand Down
5 changes: 3 additions & 2 deletions yarn-project/aztec/terraform/node/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ variable "SEQ_MIN_TX_PER_BLOCK" {

variable "P2P_MIN_PEERS" {
type = string
default = 50
default = 5
}

variable "P2P_MAX_PEERS" {
Expand Down Expand Up @@ -85,5 +85,6 @@ variable "IMAGE_TAG" {
}

variable "FULL_IMAGE" {
type = string
type = string
default = "${var.DOCKERHUB_ACCOUNT}/aztec:${var.IMAGE_TAG}"
}
2 changes: 1 addition & 1 deletion yarn-project/p2p-bootstrap/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ resource "aws_ecs_task_definition" "p2p-bootstrap" {
container_definitions = <<DEFINITIONS
[
{
"name": "${var.DEPLOY_TAG}-p2p-bootstrap-${count.index + 1}",
"name": "${var.FULL_IMAGE}",
"image": "${var.DOCKERHUB_ACCOUNT}/aztec:${var.DEPLOY_TAG}",
"command": ["start", "--p2p-bootstrap"],
"essential": true,
Expand Down
8 changes: 7 additions & 1 deletion yarn-project/p2p-bootstrap/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,11 @@ variable "P2P_MAX_PEERS" {
}

variable "DOCKERHUB_ACCOUNT" {
type = string
type = string
default = "aztecprotocol"
}

variable "FULL_IMAGE" {
type = string
default = "${var.DOCKERHUB_ACCOUNT}/aztec:${var.DEPLOY_TAG}"
}

0 comments on commit fa70876

Please sign in to comment.