forked from cerc-io/testnet-ops
Add README for running bridge
This commit is contained in:
parent
8505c196b3
commit
e3b8aa2811
40
README.md
40
README.md
@ -1 +1,41 @@
|
|||||||
# testnet-ops
|
# testnet-ops
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
- Install [Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-and-upgrading-ansible-with-pip)
|
||||||
|
|
||||||
|
- Add location of the directory containing the ansible binary to your `PATH`
|
||||||
|
|
||||||
|
- Set Locale Encoding to `UTF-8`
|
||||||
|
|
||||||
|
Ansible requires the locale encoding to be `UTF-8`. You can either use the `LANG` prefix when running Ansible commands or set the system-wide locale.
|
||||||
|
|
||||||
|
- Option 1: Use `LANG` Prefix in Commands
|
||||||
|
|
||||||
|
If you prefer not to change the system-wide locale, you can use the `LANG` prefix when running Ansible commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
LANG=en_US.UTF-8 ansible-playbook your_playbook.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
- Option 2: Set System-Wide Locale
|
||||||
|
|
||||||
|
- Edit the `/etc/default/locale` file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo nano /etc/default/locale
|
||||||
|
```
|
||||||
|
|
||||||
|
- Set the `LANG` variable to en_US.UTF-8:
|
||||||
|
|
||||||
|
```Copy code
|
||||||
|
LANG="en_US.UTF-8"
|
||||||
|
```
|
||||||
|
|
||||||
|
- Reboot your system or log out and log back in to apply the changes.
|
||||||
|
|
||||||
|
- Reference: <https://udhayakumarc.medium.com/error-ansible-requires-the-locale-encoding-to-be-utf-8-detected-iso8859-1-6da808387f7d>
|
||||||
|
|
||||||
|
## Playbooks
|
||||||
|
|
||||||
|
- [nitro-bridge-setup](./nitro-bridge-setup/README.md)
|
||||||
|
|||||||
94
nitro-bridge-setup/README.md
Normal file
94
nitro-bridge-setup/README.md
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
# nitro-bridge-setup
|
||||||
|
|
||||||
|
## Setup Ansible
|
||||||
|
|
||||||
|
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine
|
||||||
|
|
||||||
|
## Run nitro bridge
|
||||||
|
|
||||||
|
The following commands have to be executed in [`nitro-bridge-setup`](./) directory
|
||||||
|
|
||||||
|
- Copy the `bridge-vars-example.yml` vars file
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp bridge-vars-example.yml bridge-vars.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
- Edit [`bridge-vars.yml`](./bridge-vars.yml) and fill in the following values
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# L1 WS endpoint
|
||||||
|
l1_nitro_chain_url: ""
|
||||||
|
|
||||||
|
# L2 WS endpoint
|
||||||
|
l2_nitro_chain_url: ""
|
||||||
|
|
||||||
|
# Private key for the bridge's nitro address
|
||||||
|
nitro_sc_pk: ""
|
||||||
|
|
||||||
|
# Private key for a funded account on L1
|
||||||
|
# This account should have Laconic tokens for funding Nitro channels
|
||||||
|
nitro_chain_pk: ""
|
||||||
|
|
||||||
|
# L1 chain ID (Sepolia: 11155111)
|
||||||
|
geth_chain_id: "11155111"
|
||||||
|
|
||||||
|
# L1 RPC endpoint
|
||||||
|
geth_url: ""
|
||||||
|
|
||||||
|
# L2 RPC endpoint
|
||||||
|
optimism_url: ""
|
||||||
|
|
||||||
|
# Private key for a funded account on L1 to use for contracts deployment on L1
|
||||||
|
geth_deployer_pk: ''
|
||||||
|
|
||||||
|
# Private key for a funded account on L2 to use for contracts deployment on L2
|
||||||
|
# Use the same account for L1 and L2 deployments
|
||||||
|
optimism_deployer_pk: ''
|
||||||
|
```
|
||||||
|
|
||||||
|
- To run the nitro bridge, execute the `run-nitro-bridge.yml` Ansible playbook by running the following command.
|
||||||
|
|
||||||
|
NOTE: By default, deployments are created in the `nitro-nodes-setup/out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost"}' --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 localhost, --connection=local run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER -kK
|
||||||
|
```
|
||||||
|
|
||||||
|
## Check Deployment Status
|
||||||
|
|
||||||
|
- Run the following command in the directory where the bridge-deployment is created:
|
||||||
|
|
||||||
|
- Follow optimism contracts deployment logs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check the l2 nitro contract deployments
|
||||||
|
laconic-so deployment --dir bridge-deployment logs l2-nitro-contracts -f
|
||||||
|
|
||||||
|
# Check the logs, ensure that the node is running
|
||||||
|
laconic-so deployment --dir bridge-deployment logs nitro-bridge -f
|
||||||
|
```
|
||||||
|
|
||||||
|
## Get Contract Addresses
|
||||||
|
|
||||||
|
- Run the following commands in the directory where the deployments are created:
|
||||||
|
|
||||||
|
- Get addresses of L1 nitro contracts:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cat /app/deployment/nitro-addresses.json"
|
||||||
|
```
|
||||||
|
|
||||||
|
- Get addresses of L2 nitro contracts:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so deployment --dir bridge-deployment exec nitro-bridge "cat /app/deployment/nitro-addresses.json"
|
||||||
|
```
|
||||||
|
|
||||||
|
Follow steps from [Demo](https://git.vdb.to/cerc-io/nitro-stack/src/branch/main/nitro-bridge-demo.md#demo) to create mirror channels on L2, create virtual channel and make payments
|
||||||
@ -1,4 +1,3 @@
|
|||||||
nitro_directory: './out'
|
|
||||||
l1_nitro_chain_url: ''
|
l1_nitro_chain_url: ''
|
||||||
l2_nitro_chain_url: ''
|
l2_nitro_chain_url: ''
|
||||||
nitro_chain_pk: ''
|
nitro_chain_pk: ''
|
||||||
|
|||||||
@ -2,16 +2,32 @@
|
|||||||
hosts: "{{ target_host }}"
|
hosts: "{{ target_host }}"
|
||||||
|
|
||||||
vars_files:
|
vars_files:
|
||||||
|
- setup-vars.yml
|
||||||
- bridge-vars.yml
|
- bridge-vars.yml
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Create directory for nitro bridge deployment
|
||||||
|
file:
|
||||||
|
path: "{{ nitro_directory }}"
|
||||||
|
state: directory
|
||||||
|
become: yes
|
||||||
|
|
||||||
- name: Clone go-nitro stack repo
|
- name: Clone go-nitro stack repo
|
||||||
command: laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull
|
command: laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Change owner of nitro-directory
|
||||||
|
file:
|
||||||
|
path: "{{ nitro_directory }}"
|
||||||
|
owner: "{{ansible_user}}"
|
||||||
|
group: "{{ansible_user}}"
|
||||||
|
state: directory
|
||||||
|
recurse: yes
|
||||||
|
become: yes
|
||||||
|
|
||||||
- name: Clone repositories required for nitro-stack
|
- name: Clone repositories required for nitro-stack
|
||||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge setup-repositories --git-ssh --pull
|
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge setup-repositories --git-ssh --pull
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
@ -29,6 +45,7 @@
|
|||||||
stat:
|
stat:
|
||||||
path: "{{ nitro_directory }}/nitro-contracts-deployment"
|
path: "{{ nitro_directory }}/nitro-contracts-deployment"
|
||||||
register: nitro_contracts_deployment
|
register: nitro_contracts_deployment
|
||||||
|
become: yes
|
||||||
|
|
||||||
- name: Create a deployment for nitro contracts
|
- name: Create a deployment for nitro contracts
|
||||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts deploy create --spec-file nitro-contracts-spec.yml --deployment-dir nitro-contracts-deployment
|
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts deploy create --spec-file nitro-contracts-spec.yml --deployment-dir nitro-contracts-deployment
|
||||||
|
|||||||
3
nitro-bridge-setup/setup-vars.yml
Normal file
3
nitro-bridge-setup/setup-vars.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
target_host: "localhost"
|
||||||
|
nitro_directory: ./out
|
||||||
|
skip_container_build: false
|
||||||
@ -5,10 +5,8 @@ config:
|
|||||||
NITRO_L2_CHAIN_URL: {{ l2_nitro_chain_url }}
|
NITRO_L2_CHAIN_URL: {{ l2_nitro_chain_url }}
|
||||||
NITRO_CHAIN_PK: '{{ nitro_chain_pk }}'
|
NITRO_CHAIN_PK: '{{ nitro_chain_pk }}'
|
||||||
NITRO_SC_PK: '{{ nitro_sc_pk }}'
|
NITRO_SC_PK: '{{ nitro_sc_pk }}'
|
||||||
GETH_CHAIN_ID: '{{ geth_chain_id }}'
|
|
||||||
GETH_URL: {{ geth_url }}
|
GETH_URL: {{ geth_url }}
|
||||||
OPTIMISM_URL: {{ optimism_url }}
|
OPTIMISM_URL: {{ optimism_url }}
|
||||||
GETH_DEPLOYER_PK: '{{ geth_deployer_pk }}'
|
|
||||||
OPTIMISM_DEPLOYER_PK: '{{ optimism_deployer_pk }}'
|
OPTIMISM_DEPLOYER_PK: '{{ optimism_deployer_pk }}'
|
||||||
TOKEN_NAME: LaconicNetworkToken
|
TOKEN_NAME: LaconicNetworkToken
|
||||||
TOKEN_SYMBOL: LNT
|
TOKEN_SYMBOL: LNT
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user