Add instructions to setup and run testnet L2 and Nitro deployments #26

Merged
nabarun merged 22 commits from sk-l2-setup into main 2024-09-12 13:31:18 +00:00
2 changed files with 55 additions and 50 deletions
Showing only changes of commit c493363214 - Show all commits

View File

@ -39,7 +39,7 @@
* Target dir: `/srv/op-sepolia/optimism-deployment`
* Cleanup an existing deployment on virtual machine if required:
* Cleanup an existing deployment on VM if required:
```bash
cd /srv/op-sepolia
@ -99,7 +99,7 @@
### Run
* Execute the `run-optimism.yml` Ansible playbook on the remote host to set up and run L2:
* Set up and run L2 on remote host by executing `run-optimism.yml` Ansible playbook on your local machine:
* Create a new `hosts.ini` file:
@ -110,16 +110,15 @@
* Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine:
```ini
[<deployment_host>]
[l2_host]
<host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'
```
- Replace `<deployment_host>` with `l2_host`
- Replace `<host_name>` with the alias of your choice
- Replace `<target_ip>` with the IP address or hostname of the target machine
- Replace `<ssh_user>` with the SSH username (e.g., dev, ubuntu)
* Verify that you are able to connect to the host using the following command
* Verify that you are able to connect to the host using the following command:
```bash
ansible all -m ping -i hosts.ini -k
@ -140,15 +139,9 @@
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-optimism.yml --extra-vars='{ "target_host": "l2_host"}' --user $USER -kK
```
* For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter:
```bash
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-optimism.yml --extra-vars='{ "target_host": "l2_host", "skip_container_build": true }' --user $USER -kK
```
* Bridge funds on L2:
* Set the following variables:
* On the deployment VM, set the following variables:
```bash
# Switch to `/srv/op-sepolia` directory on the virtual machine
@ -188,7 +181,7 @@
* Allow a couple minutes for the bridge to complete
* Check balance on L2
* Check balance on L2:
```bash
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast balance $ACCOUNT --rpc-url $L2_RPC"
@ -203,13 +196,13 @@
## L1 Nitro Contracts Deployment
* Stack: <https://git.vdb.to/cerc-io/nitro-stack>
* Stack: <https://git.vdb.to/cerc-io/nitro-stack/src/branch/main/stack-orchestrator/stacks/nitro-contracts>
* Source repos: <https://github.com/cerc-io/go-nitro>
* Source repo: <https://github.com/cerc-io/go-nitro>
* Target dir: `/srv/bridge/nitro-contracts-deployment`
* Cleanup an existing deployment on virtual machine if required:
* Cleanup an existing deployment on VM if required:
```bash
cd /srv/bridge
@ -222,19 +215,19 @@
### Setup
* Following commands have to be executed in `testnet-ops/nitro-contracts-setup` directory on your local machine
* Switch to `testnet-ops/nitro-contracts-setup` directory on your local machine:
```bash
cd testnet-ops/nitro-contracts-setup
```
* Copy the `contract-vars-example.yml` vars file
* Copy the `contract-vars-example.yml` vars file:
```bash
cp contract-vars.example.yml contract-vars.yml
```
* Edit [`contract-vars.yml`](./contract-vars.yml) and fill in the following values
* Edit [`contract-vars.yml`](./contract-vars.yml) and fill in the following values:
```bash
# L1 RPC endpoint
@ -262,7 +255,7 @@
### Run
* Execute the `deploy-contracts.yml` Ansible playbook on the remote host to deploy Nitro contracts:
* Deploy nitro contracts on remote host by executing `deploy-contracts.yml` Ansible playbook on your local machine:
* Create a new `hosts.ini` file:
@ -273,16 +266,15 @@
* Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine:
```ini
[<deployment_host>]
[nitro_host]
<host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'
```
- Replace `<deployment_host>` with `nitro_host`
- Replace `<host_name>` with the alias of your choice
- Replace `<target_ip>` with the IP address or hostname of the target machine
- Replace `<ssh_user>` with the SSH username (e.g., dev, ubuntu)
* Verify that you are able to connect to the host using the following command
* Verify that you are able to connect to the host using the following command:
```bash
ansible all -m ping -i hosts.ini -k
@ -303,13 +295,7 @@
LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK
```
* For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter:
```bash
LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK
```
* Check logs for deployments on the virtual machine:
* Check logs for deployment on the virtual machine:
```bash
cd /srv/bridge
@ -325,13 +311,13 @@
## Nitro Bridge
* Stack: <https://git.vdb.to/cerc-io/nitro-stack>
* Stack: <https://git.vdb.to/cerc-io/nitro-stack/src/branch/main/stack-orchestrator/stacks/bridge>
* Source repos: <https://github.com/cerc-io/go-nitro>
* Source repo: <https://github.com/cerc-io/go-nitro>
* Target dir: `/srv/bridge/bridge-deployment`
* Cleanup an existing deployment on virtual machine if required:
* Cleanup an existing deployment on VM if required:
```bash
cd /srv/bridge
@ -345,7 +331,39 @@
### Setup
* Following commands have to be executed in `testnet-ops/nitro-bridge-setup` directory on your local machine
* Execute the command on the deployment VM to get the deployed L1 Nitro contract addresses along with the L1 asset address:
```bash
cd /srv/bridge
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cat /app/deployment/nitro-addresses.json"
# Expected output:
# {
# "11155111": [
# {
# "name": "geth",
# "chainId": "11155111",
# "contracts": {
# "ConsensusApp": {
# "address": "0xC98aD0B41B9224dad0605be32A9241dB9c67E2e8"
# },
# "NitroAdjudicator": {
# "address": "0x7C22fdA703Cdf09eB8D3B5Adc81F723526713D0e"
# },
# "VirtualPaymentApp": {
# "address": "0x778e4e6297E8BF04C67a20Ec989618d72eB4a19E"
# },
# "Token": {
# "address": "0x02ebfB2706527C7310F2a7d9098b2BC61014C5F2"
# }
# }
# }
# ]
# }
```
* Switch to `testnet-ops/nitro-bridge-setup` directory on your local machine:
```bash
cd testnet-ops/nitro-bridge-setup
@ -407,7 +425,7 @@
### Run
* Execute the `run-nitro-bridge.yml` Ansible playbook on the remote host to deploy the L2 contracts and start the bridge:
* Deploy L2 contracts and start the bridge on remote host by executing `run-nitro-bridge.yml` Ansible playbook on your local machine:
* Create a new `hosts.ini` file:
@ -418,16 +436,15 @@
* Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine:
```ini
[<deployment_host>]
[nitro_host]
<host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'
```
- Replace `<deployment_host>` with `nitro_host`
- Replace `<host_name>` with the alias of your choice
- Replace `<target_ip>` with the IP address or hostname of the target machine
- Replace `<ssh_user>` with the SSH username (e.g., dev, ubuntu)
* Verify that you are able to connect to the host using the following command
* Verify that you are able to connect to the host using the following command:
```bash
ansible all -m ping -i hosts.ini -k
@ -448,12 +465,6 @@
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK
```
* For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter:
```bash
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK
```
* Check logs for deployments on the virtual machine:
```bash

View File

@ -92,12 +92,6 @@
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost"}' --user $USER
```
* For skipping container build, run with `"skip_container_build" : true`:
```bash
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER
```
* Check status:
```bash