Skip to content

Commit bec0c58

Browse files
committed
mitch/tmnt-167-create-deploy-aztec-infrayml
1 parent 0738287 commit bec0c58

28 files changed

+1121
-796
lines changed
Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
name: Deploy Aztec Infra
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
cluster:
7+
description: The cluster to deploy to, e.g. aztec-gke-private or kind
8+
required: true
9+
type: string
10+
namespace:
11+
description: The namespace to deploy to
12+
required: true
13+
type: string
14+
ref:
15+
description: The branch name to deploy from.
16+
required: true
17+
type: string
18+
run_terraform_destroy:
19+
description: Whether to run terraform destroy
20+
required: true
21+
type: boolean
22+
default: false
23+
aztec_docker_image:
24+
description: The Aztec Docker image to deploy
25+
required: true
26+
type: string
27+
l1_rpc_urls:
28+
description: L1 RPC URLs as JSON array
29+
required: true
30+
type: string
31+
l1_consensus_host_urls:
32+
description: L1 consensus host URLs as JSON array
33+
required: true
34+
type: string
35+
l1_consensus_host_api_keys:
36+
description: L1 consensus host API keys as JSON array
37+
required: true
38+
type: string
39+
l1_consensus_host_api_key_headers:
40+
description: L1 consensus host API key headers as JSON array
41+
required: true
42+
type: string
43+
l1_chain_id:
44+
description: L1 chain ID
45+
required: true
46+
type: string
47+
registry_address:
48+
description: Registry contract address
49+
required: true
50+
type: string
51+
slash_factory_address:
52+
description: Slash factory contract address
53+
required: true
54+
type: string
55+
fee_asset_handler_address:
56+
description: Fee asset handler contract address
57+
required: true
58+
type: string
59+
validator_mnemonic:
60+
description: Validator mnemonic phrase
61+
required: true
62+
type: string
63+
validator_mnemonic_start_index:
64+
description: Validator mnemonic start index
65+
required: true
66+
type: number
67+
validators_per_node:
68+
description: Number of validators per node
69+
required: true
70+
type: number
71+
validator_replicas:
72+
description: Number of validator replicas
73+
required: true
74+
type: number
75+
prover_mnemonic:
76+
description: Prover mnemonic phrase
77+
required: true
78+
type: string
79+
prover_mnemonic_start_index:
80+
description: Prover mnemonic start index
81+
required: true
82+
type: number
83+
p2p_bootstrap_resource_profile:
84+
description: P2P bootstrap resource profile
85+
required: true
86+
type: string
87+
validator_resource_profile:
88+
description: Validator resource profile
89+
required: true
90+
type: string
91+
prover_resource_profile:
92+
description: Prover resource profile
93+
required: true
94+
type: string
95+
rpc_resource_profile:
96+
description: RPC resource profile
97+
required: true
98+
type: string
99+
rpc_external_ingress:
100+
description: Whether to use an external ingress for the rpc
101+
required: true
102+
type: boolean
103+
secrets:
104+
GCP_SA_KEY:
105+
description: The GCP service account key
106+
required: true
107+
KUBECONFIG_B64:
108+
description: The base64 encoded kubeconfig
109+
required: true
110+
111+
workflow_dispatch:
112+
inputs:
113+
cluster:
114+
description: The cluster to deploy to, e.g. aztec-gke-private or kind
115+
required: true
116+
type: string
117+
namespace:
118+
description: The namespace to deploy to
119+
required: true
120+
type: string
121+
ref:
122+
description: The branch name to deploy from.
123+
required: true
124+
type: string
125+
run_terraform_destroy:
126+
description: Whether to run terraform destroy
127+
required: true
128+
type: boolean
129+
default: false
130+
aztec_docker_image:
131+
description: The Aztec Docker image to deploy
132+
required: true
133+
type: string
134+
l1_rpc_urls:
135+
description: L1 RPC URLs as JSON array. Format, e.g. ["http://10.96.142.184:8545"]
136+
required: true
137+
type: string
138+
l1_consensus_host_urls:
139+
description: L1 consensus host URLs as JSON array. Format, e.g. ["http://10.96.36.205:5052"]
140+
required: true
141+
type: string
142+
l1_consensus_host_api_keys:
143+
description: L1 consensus host API keys as JSON array. Format, e.g. ["1234567890"]
144+
required: true
145+
type: string
146+
l1_consensus_host_api_key_headers:
147+
description: L1 consensus host API key headers as JSON array. Format, e.g. ["X-API-Key"]
148+
required: true
149+
type: string
150+
l1_chain_id:
151+
description: L1 chain ID
152+
required: true
153+
type: string
154+
registry_address:
155+
description: Registry contract address
156+
required: true
157+
type: string
158+
slash_factory_address:
159+
description: Slash factory contract address
160+
required: true
161+
type: string
162+
fee_asset_handler_address:
163+
description: Fee asset handler contract address
164+
required: true
165+
type: string
166+
validator_mnemonic:
167+
description: Validator mnemonic phrase
168+
required: true
169+
type: string
170+
validator_mnemonic_start_index:
171+
description: Validator mnemonic start index
172+
required: true
173+
type: number
174+
validators_per_node:
175+
description: Number of validators per node
176+
required: true
177+
type: number
178+
validator_replicas:
179+
description: Number of validator replicas
180+
required: true
181+
type: number
182+
prover_mnemonic:
183+
description: Prover mnemonic phrase
184+
required: true
185+
type: string
186+
prover_mnemonic_start_index:
187+
description: Prover mnemonic start index
188+
required: true
189+
type: number
190+
p2p_bootstrap_resource_profile:
191+
description: P2P bootstrap resource profile
192+
required: true
193+
type: string
194+
validator_resource_profile:
195+
description: Validator resource profile
196+
required: true
197+
type: string
198+
prover_resource_profile:
199+
description: Prover resource profile
200+
required: true
201+
type: string
202+
rpc_resource_profile:
203+
description: RPC resource profile
204+
required: true
205+
type: string
206+
rpc_external_ingress:
207+
description: Whether to use an external ingress for the rpc
208+
required: true
209+
type: boolean
210+
211+
jobs:
212+
deploy_aztec_infra:
213+
runs-on: ubuntu-latest
214+
env:
215+
TF_VAR_RELEASE_PREFIX: aztec-infra
216+
TF_VAR_GCP_PROJECT: "testnet-440309"
217+
TF_VAR_GCP_REGION: us-west1
218+
TF_VAR_K8S_CLUSTER_CONTEXT: ${{ inputs.cluster }}
219+
TF_VAR_NAMESPACE: ${{ inputs.namespace }}
220+
TF_VAR_AZTEC_DOCKER_IMAGE: ${{ inputs.aztec_docker_image }}
221+
TF_VAR_L1_RPC_URLS: ${{ inputs.l1_rpc_urls }}
222+
TF_VAR_L1_CONSENSUS_HOST_URLS: ${{ inputs.l1_consensus_host_urls }}
223+
TF_VAR_L1_CONSENSUS_HOST_API_KEYS: ${{ inputs.l1_consensus_host_api_keys }}
224+
TF_VAR_L1_CONSENSUS_HOST_API_KEY_HEADERS: ${{ inputs.l1_consensus_host_api_key_headers }}
225+
TF_VAR_L1_CHAIN_ID: ${{ inputs.l1_chain_id }}
226+
TF_VAR_REGISTRY_CONTRACT_ADDRESS: ${{ inputs.registry_address }}
227+
TF_VAR_SLASH_FACTORY_CONTRACT_ADDRESS: ${{ inputs.slash_factory_address }}
228+
TF_VAR_FEE_ASSET_HANDLER_CONTRACT_ADDRESS: ${{ inputs.fee_asset_handler_address }}
229+
TF_VAR_VALIDATOR_MNEMONIC: ${{ inputs.validator_mnemonic }}
230+
TF_VAR_VALIDATOR_MNEMONIC_START_INDEX: ${{ inputs.validator_mnemonic_start_index }}
231+
TF_VAR_VALIDATORS_PER_NODE: ${{ inputs.validators_per_node }}
232+
TF_VAR_VALIDATOR_REPLICAS: ${{ inputs.validator_replicas }}
233+
TF_VAR_PROVER_MNEMONIC: ${{ inputs.prover_mnemonic }}
234+
TF_VAR_PROVER_MNEMONIC_START_INDEX: ${{ inputs.prover_mnemonic_start_index }}
235+
TF_VAR_P2P_BOOTSTRAP_RESOURCE_PROFILE: ${{ inputs.p2p_bootstrap_resource_profile }}
236+
TF_VAR_VALIDATOR_RESOURCE_PROFILE: ${{ inputs.validator_resource_profile }}
237+
TF_VAR_PROVER_RESOURCE_PROFILE: ${{ inputs.prover_resource_profile }}
238+
TF_VAR_RPC_RESOURCE_PROFILE: ${{ inputs.rpc_resource_profile }}
239+
TF_VAR_RPC_EXTERNAL_INGRESS: ${{ inputs.rpc_external_ingress }}
240+
241+
steps:
242+
- name: Debug inputs
243+
run: |
244+
echo "cluster: ${{ inputs.cluster }}"
245+
echo "namespace: ${{ inputs.namespace }}"
246+
247+
- name: Setup K8s and Terraform
248+
uses: ./.github/actions/setup-k8s-terraform
249+
with:
250+
cluster: ${{ inputs.cluster }}
251+
namespace: ${{ inputs.namespace }}
252+
ref: ${{ inputs.ref || github.ref }}
253+
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
254+
kubeconfig_b64: ${{ secrets.KUBECONFIG_B64 }}
255+
terraform_dir: ./spartan/terraform/deploy-aztec-infra
256+
tf_state_prefix: deploy-aztec-infra
257+
run_terraform_destroy: ${{ inputs.run_terraform_destroy }}
258+
259+
- name: Terraform Plan
260+
working-directory: ./spartan/terraform/deploy-aztec-infra
261+
run: |
262+
# All variables are now set as TF_VAR_ environment variables
263+
terraform plan -out=tfplan
264+
265+
- name: Terraform Apply
266+
working-directory: ./spartan/terraform/deploy-aztec-infra
267+
run: |
268+
terraform apply tfplan

.github/workflows/deploy-eth-devnet.yml

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ on:
2626
type: string
2727
ref:
2828
description: The branch name to deploy from
29-
required: false
29+
required: true
3030
type: string
31-
default: "next"
3231
chain_id:
3332
description: Ethereum chain ID for genesis generation
3433
required: false
@@ -46,14 +45,12 @@ on:
4645
default: "32000000"
4746
resource_profile:
4847
description: Resource profile to use (dev or prod)
49-
required: false
48+
required: true
5049
type: string
51-
default: "prod"
5250
create_static_ips:
5351
description: Whether to create static IPs as part of the eth devnet for the execution and beacon nodes
54-
required: false
52+
required: true
5553
type: string
56-
default: "false"
5754
run_terraform_destroy:
5855
description: Whether to run the terraform destroy
5956
required: false
@@ -64,6 +61,11 @@ on:
6461
required: false
6562
type: string
6663
default: "test test test test test test test test test test test junk"
64+
prefunded_mnemonic_indices:
65+
description: The indices of the prefunded mnemonic to use for the devnet
66+
required: false
67+
type: string
68+
default: "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1000,1001,1002,1003"
6769
secrets:
6870
GCP_SA_KEY:
6971
description: The JSON key for the GCP service account
@@ -89,19 +91,16 @@ on:
8991
inputs:
9092
cluster:
9193
description: The cluster to deploy to, e.g. aztec-gke-private or kind
92-
required: false
94+
required: true
9395
type: string
94-
default: "kind"
9596
namespace:
9697
description: The namespace to deploy to
97-
required: false
98+
required: true
9899
type: string
99-
default: "eth-devnet"
100100
ref:
101101
description: The branch name to deploy from.
102-
required: false
102+
required: true
103103
type: string
104-
default: "next"
105104
chain_id:
106105
description: Ethereum chain ID for genesis generation
107106
required: false
@@ -119,14 +118,12 @@ on:
119118
default: "32000000"
120119
resource_profile:
121120
description: Resource profile to use (dev or prod)
122-
required: false
121+
required: true
123122
type: string
124-
default: "prod"
125123
create_static_ips:
126124
description: Whether to create static IPs as part of the eth devnet for the execution and beacon nodes
127-
required: false
125+
required: true
128126
type: string
129-
default: "false"
130127
run_terraform_destroy:
131128
description: Whether to run the terraform destroy
132129
required: false
@@ -137,6 +134,11 @@ on:
137134
required: false
138135
type: string
139136
default: "test test test test test test test test test test test junk"
137+
prefunded_mnemonic_indices:
138+
description: The indices of the prefunded mnemonic to use for the devnet
139+
required: false
140+
type: string
141+
default: "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1000,1001,1002,1003"
140142

141143
jobs:
142144
deploy_eth_devnet:
@@ -150,13 +152,12 @@ jobs:
150152
TF_STATE_BUCKET: aztec-terraform
151153
REGION: us-west1-a
152154
# Common Terraform variables as environment variables
153-
TF_VAR_NAMESPACE: ${{ inputs.namespace || 'eth-devnet' }}
154-
TF_VAR_CHAIN_ID: ${{ inputs.chain_id || 1337 }}
155-
TF_VAR_BLOCK_TIME: ${{ inputs.block_time || 12 }}
156-
TF_VAR_GAS_LIMIT: ${{ inputs.gas_limit || '32000000' }}
157-
TF_VAR_MNEMONIC_SECRET_NAME: eth-devnet-genesis-mnemonic
158-
TF_VAR_PREFUNDED_MNEMONIC_INDICES: "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1000,1001,1002,1003"
159-
TF_VAR_RESOURCE_PROFILE: ${{ inputs.resource_profile || 'prod' }}
155+
TF_VAR_NAMESPACE: ${{ inputs.namespace }}
156+
TF_VAR_CHAIN_ID: ${{ inputs.chain_id }}
157+
TF_VAR_BLOCK_TIME: ${{ inputs.block_time }}
158+
TF_VAR_GAS_LIMIT: ${{ inputs.gas_limit }}
159+
TF_VAR_PREFUNDED_MNEMONIC_INDICES: ${{ inputs.prefunded_mnemonic_indices }}
160+
TF_VAR_RESOURCE_PROFILE: ${{ inputs.resource_profile }}
160161

161162
steps:
162163
- name: Mask the mnemonic

0 commit comments

Comments
 (0)