2024-09-03 10:12:04 +00:00
# l2-setup
## Setup Ansible
To get started, follow the [installation ](../README.md#installation ) guide to setup ansible on your machine
## Setup and Run Optimism
The following commands have to be executed in [`l2-setup` ](./ ) directory
2024-09-03 12:51:34 +00:00
- Edit [`l2-vars.yml` ](./l2-vars.yml ) with the required values
2024-09-03 10:12:04 +00:00
```bash
2024-09-03 12:51:34 +00:00
# L1 chain ID
l1_chain_id: ""
2024-09-03 10:12:04 +00:00
# L1 RPC endpoint
2024-09-03 12:51:34 +00:00
l1_rpc: ""
2024-09-03 10:12:04 +00:00
# L1 RPC endpoint host or IP address
2024-09-03 12:51:34 +00:00
l1_host: ""
2024-09-03 10:12:04 +00:00
# L1 RPC endpoint port number
2024-09-03 12:51:34 +00:00
l1_port: ""
2024-09-03 10:12:04 +00:00
2024-09-03 10:36:59 +00:00
# L1 Beacon endpoint
2024-09-03 12:51:34 +00:00
l1_beacon: ""
2024-09-03 10:36:59 +00:00
2024-09-03 10:12:04 +00:00
# Address of the funded account on L1
# Used for optimism contracts deployment
2024-09-03 12:51:34 +00:00
l1_address: ""
2024-09-03 10:12:04 +00:00
# Private key of the funded account on L1
2024-09-03 12:51:34 +00:00
l1_priv_key: ""
2024-09-03 10:12:04 +00:00
```
- To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running the following command.
NOTE: By default, deployments are created in the `l2-setup/out` directory. To change this location, update the `l2_directory` variable in the [vars.yml ](./vars.yml ) file.
```bash
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{ "target_host": "localhost"}' --user $USER
```
- For skipping container build, set `"skip_container_build" : 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", "skip_container_build": true}' -kK --user $USER
```
2024-09-03 10:36:59 +00:00
- To run using existing contracts deployment
2024-09-03 12:51:34 +00:00
- Update `artifact_path` in [`setup-vars.yml` ](./setup-vars.yml ) file with path to data directory of the existing deployment
2024-09-03 10:36:59 +00:00
2024-09-03 12:51:34 +00:00
- Run the ansible playbook with `"existing_contracts_deployment": true` in the `--extra-vars` parameter:
2024-09-03 10:36:59 +00:00
```bash
2024-09-03 12:51:34 +00:00
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
2024-09-03 10:36:59 +00:00
```