Skip to content

Commit

Permalink
refactor: break down the deployment process into various stages (#28)
Browse files Browse the repository at this point in the history
* feat: introduce stages

* chore: group config and service

* chore: nit

* chore: move code to its own package

* refactor: clean up stage 4

* chore: nit

* chore: clean up stage 2

* chore: nit

* chore: lint

* chore: nit

* chore: clean up

* chore: remove updates to bridge, agglayer and dac configs in run-contract-setup.sh

* fix: typo

* refactor: introduce `get_key_from_config`

* chore: fetch genesis and keystores + simplify get key from config

* chore: use `plan.store_service_files`

* fix: a few bugs

* fix: permissionless-node genesis  issue

* fix: genesis artifact issue

* chore: nit

* doc: document how to leverage stages in README

---------

Co-authored-by: John Hilliard <[email protected]>
  • Loading branch information
leovct and praetoriansentry authored Mar 26, 2024
1 parent 5fa402b commit 0b5494b
Show file tree
Hide file tree
Showing 8 changed files with 509 additions and 328 deletions.
41 changes: 41 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,47 @@ node to the ~cdk-v1~ enclave:
kurtosis run --enclave cdk-v1 --args-file params.yml --main-file zkevm_permissionless_node.star .
#+end_src

** For Developers

Rather than executing the deployment process as a monolithic operation, you can break it down into stages and run each stage separately. The `stages` parameter indicates the specific stages you wish the deployment to proceed through. By default, it will execute all the stages.

Currently, the deployment process includes the following stages:

1. Deploy L1
2. Configure L1 (which involves funding accounts, deploying CDK contracts, and creating configuration files)
3. Deploy Trusted / Central Environment
4. Deploy Bridge, AggLayer, and DAC
5. Deploy Permissionless Node

Here's an example of how you can specify the stages to run through.

#+begin_src bash
# Execute the first stage (deploy L1).
yq e '.stages = [1]' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
# Perform additional tasks...

# Execute the second stage (configure L1).
yq e '.stages = [2]' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
# Perform additional tasks...

# Execute the thirs stage (deploy trusted/central environment).
yq e '.stages = [3]' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
# Perform additional tasks...

# Execute the fourth stage (deploy bridge/agglayer/dac).
yq e '.stages = [4]' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
# Perform additional tasks...

# Execute the fifth stage (deploy permissionless node).
yq e '.stages = [5]' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
# Perform additional tasks...
#+end_src

** License

Copyright (c) 2024 PT Services DMCC
Expand Down
13 changes: 13 additions & 0 deletions lib/service.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Extract a specific key from a JSON file, within a service, using jq.
def extract_json_key_from_service(plan, service_name, filename, key):
plan.print("Extracting contract addresses and ports...")
exec_recipe = ExecRecipe(
command=[
"/bin/sh",
"-c",
"cat {}".format(filename, key),
],
extract={"extracted_value": "fromjson | .{}".format(key)},
)
result = plan.exec(service_name=service_name, recipe=exec_recipe)
return result["extract.extracted_value"]
Loading

0 comments on commit 0b5494b

Please sign in to comment.