Add ansible playbook to setup and run L2 deployment #3
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
nitro-nodes-setup/out/
|
||||
nitro-nodes-setup/nitro-vars.yml
|
||||
l2-setup/out
|
||||
|
@ -8,36 +8,30 @@ To get started, follow the [installation](../README.md#installation) guide to se
|
||||
|
||||
The following commands have to be executed in [`l2-setup`](./) directory
|
||||
|
||||
- Edit [`l2-config.env`](./templates/configs/l2-config.env) and fill in the following values
|
||||
- Edit [`l2-vars.yml`](./l2-vars.yml) with the required values
|
||||
|
||||
```bash
|
||||
# L1 Chain ID
|
||||
CERC_L1_CHAIN_ID=
|
||||
# L1 chain ID
|
||||
l1_chain_id: ""
|
||||
|
||||
# L1 RPC endpoint
|
||||
CERC_L1_RPC=
|
||||
l1_rpc: ""
|
||||
|
||||
# L1 RPC endpoint host or IP address
|
||||
CERC_L1_HOST=
|
||||
l1_host: ""
|
||||
|
||||
# L1 RPC endpoint port number
|
||||
CERC_L1_PORT=
|
||||
l1_port: ""
|
||||
|
||||
# L1 Beacon endpoint
|
||||
CERC_L1_BEACON=
|
||||
l1_beacon: ""
|
||||
|
||||
# Address of the funded account on L1
|
||||
# Used for optimism contracts deployment
|
||||
CERC_L1_ADDRESS=
|
||||
l1_address: ""
|
||||
|
||||
# Private key of the funded account on L1
|
||||
CERC_L1_PRIV_KEY=
|
||||
|
||||
# Funding amount for Optimism Proposer account on L1 (default: 0.2 ether)
|
||||
CERC_PROPOSER_AMOUNT=
|
||||
|
||||
# Amount to send the batcher on L2 (default: 0.1 ether)
|
||||
CERC_BATCHER_AMOUNT=
|
||||
l1_priv_key: ""
|
||||
```
|
||||
|
||||
- To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running the following command.
|
||||
@ -56,10 +50,10 @@ The following commands have to be executed in [`l2-setup`](./) directory
|
||||
|
||||
- To run using existing contracts deployment
|
||||
|
||||
- Update the [`vars.yml`](./vars.yml) with paths to required artifacts
|
||||
- Update `artifact_path` in [`setup-vars.yml`](./setup-vars.yml) file with path to data directory of the existing deployment
|
||||
|
||||
- Run the ansible playbook with `"existing_l1_deployment": true` in the `--extra-vars` parameter:
|
||||
- Run the ansible playbook with `"existing_contracts_deployment": true` in the `--extra-vars` parameter:
|
||||
|
||||
```bash
|
||||
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "existing_l1_deployment": true}' -kK --user $USER
|
||||
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "existing_contracts_deployment": true}' -kK --user $USER
|
||||
```
|
||||
|
9
l2-setup/l2-vars.yml
Normal file
9
l2-setup/l2-vars.yml
Normal file
@ -0,0 +1,9 @@
|
||||
l1_chain_id: ""
|
||||
l1_rpc: ""
|
||||
l1_host: ""
|
||||
l1_port: ""
|
||||
l1_beacon: ""
|
||||
l1_address: ""
|
||||
l1_priv_key: ""
|
||||
proposer_amount: "0.2 ether"
|
||||
batcher_amount: "0.1 ether"
|
@ -2,7 +2,8 @@
|
||||
hosts: "{{ target_host }}"
|
||||
|
||||
vars_files:
|
||||
- vars.yml
|
||||
- setup-vars.yml
|
||||
- l2-vars.yml
|
||||
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||
@ -54,31 +55,32 @@
|
||||
|
||||
- name: Generate config.env for L2 deployment
|
||||
template:
|
||||
src: "./templates/configs/l2-config.env"
|
||||
src: "./templates/configs/l2-config.env.j2"
|
||||
dest: "{{ l2_directory }}/optimism-deployment/config.env"
|
||||
|
||||
- name: Copy deployed contract addresses and configuration files
|
||||
block:
|
||||
- name: Copy l1 deployment file
|
||||
copy:
|
||||
src: "{{ contract_addresses }}"
|
||||
src: "{{ artifact_path }}/l1_deployment/{{ l1_chain_id }}-deploy.json"
|
||||
dest: "{{ l2_directory }}/optimism-deployment/data/l1_deployment"
|
||||
|
||||
- name: Copy l2 configuration file
|
||||
copy:
|
||||
src: "{{ l2_config_file }}"
|
||||
src: "{{ artifact_path }}/l2_config/{{ l1_chain_id }}.json"
|
||||
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
|
||||
|
||||
- name: Copy allocs-l2 file
|
||||
copy:
|
||||
src: "{{ allocs_l2_file }}"
|
||||
src: "{{ artifact_path }}/l2_config/allocs-l2.json"
|
||||
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
|
||||
|
||||
- name: Copy l2 jwt file
|
||||
copy:
|
||||
src: "{{ l2_jwt_file }}"
|
||||
src: "{{ artifact_path }}/l2_config/l2-jwt.txt"
|
||||
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
|
||||
when: existing_l1_deployment
|
||||
|
||||
when: existing_contracts_deployment
|
||||
|
||||
- name: Start L2-deployment
|
||||
command: laconic-so deployment --dir optimism-deployment start
|
||||
|
4
l2-setup/setup-vars.yml
Normal file
4
l2-setup/setup-vars.yml
Normal file
@ -0,0 +1,4 @@
|
||||
skip_container_build: false
|
||||
l2_directory: "./out"
|
||||
existing_contracts_deployment: false
|
||||
artifact_path: ""
|
@ -1,10 +0,0 @@
|
||||
CERC_ALLOW_UNPROTECTED_TXS=true
|
||||
CERC_L1_CHAIN_ID=
|
||||
CERC_L1_RPC=
|
||||
CERC_L1_BEACON=
|
||||
CERC_L1_HOST=
|
||||
CERC_L1_PORT=
|
||||
CERC_L1_ADDRESS=
|
||||
CERC_L1_PRIV_KEY=
|
||||
CERC_L2_PROPOSER_AMOUNT=
|
||||
CERC_L2_BATCHER_AMOUNT=
|
9
l2-setup/templates/configs/l2-config.env.j2
Normal file
9
l2-setup/templates/configs/l2-config.env.j2
Normal file
@ -0,0 +1,9 @@
|
||||
CERC_L1_CHAIN_ID={{ l1_chain_id }}
|
||||
CERC_L1_RPC={{ l1_rpc }}
|
||||
CERC_L1_HOST={{ l1_host }}
|
||||
CERC_L1_PORT={{ l1_port }}
|
||||
CERC_L1_BEACON={{ l1_beacon }}
|
||||
CERC_L1_ADDRESS={{ l1_address }}
|
||||
CERC_L1_PRIV_KEY={{ l1_priv_key }}
|
||||
CERC_PROPOSER_AMOUNT={{ proposer_amount }}
|
||||
CERC_BATCHER_AMOUNT={{ batcher_amount }}
|
@ -1,7 +0,0 @@
|
||||
skip_container_build: false
|
||||
l2_directory: 'out'
|
||||
existing_l1_deployment: false
|
||||
contract_addresses: ""
|
||||
l2_config_file: ""
|
||||
allocs_l2_file: ""
|
||||
l2_jwt_file: ""
|
Loading…
Reference in New Issue
Block a user