From dc6145f37d28da9f40c3355d936fe2bb6108472f Mon Sep 17 00:00:00 2001 From: Adw8 Date: Mon, 9 Sep 2024 10:50:23 +0530 Subject: [PATCH] Add remote host setup for nitro contracts README --- example-hosts.ini | 2 +- l2-setup/README.md | 18 +++++++--- nitro-bridge-setup/README.md | 21 +++++++++--- nitro-contracts-setup/README.md | 58 +++++++++++++++++++++++++++++---- nitro-nodes-setup/README.md | 46 ++++++++++++++++---------- 5 files changed, 111 insertions(+), 34 deletions(-) diff --git a/example-hosts.ini b/example-hosts.ini index 66eacd8..da832ab 100644 --- a/example-hosts.ini +++ b/example-hosts.ini @@ -1,2 +1,2 @@ [nitro_host] -host_name ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' \ No newline at end of file + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' \ No newline at end of file diff --git a/l2-setup/README.md b/l2-setup/README.md index 29080d7..f8e7998 100644 --- a/l2-setup/README.md +++ b/l2-setup/README.md @@ -6,7 +6,7 @@ To get started, follow the [installation](../README.md#installation) guide to se ## Setup Remote Hosts -To run the playbooks on a remote machine, follow these steps: +To run the playbook on a remote machine, follow these steps: - In the [`l2-setup`](./) directory, create a new file named hosts.ini: @@ -18,17 +18,27 @@ To run the playbooks on a remote machine, follow these steps: ```bash [nitro_host] - hostname ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' ``` - - Replace `host_name` with the alias of your choice. + - Replace `` with the alias of your choice. - Replace `` with the IP address or hostname of the target machine. - Replace `` with the SSH username (e.g., dev, ubuntu). - Verify that you are able to connect to the host using the following command ```bash - ansible all -m ping -i hosts.ini + ansible all -m ping -i hosts.ini -k + + # Expected output: + + # | SUCCESS => { + # "ansible_facts": { + # "discovered_interpreter_python": "/usr/bin/python3.10" + # }, + # "changed": false, + # "ping": "pong" + # } ``` ## Setup and Run Optimism diff --git a/nitro-bridge-setup/README.md b/nitro-bridge-setup/README.md index 200883a..3b5834c 100644 --- a/nitro-bridge-setup/README.md +++ b/nitro-bridge-setup/README.md @@ -6,7 +6,7 @@ To get started, follow the [installation](../README.md#installation) guide to se ## Setup Remote Hosts -To run the playbooks on a remote machine, follow these steps: +To run the playbook on a remote machine, follow these steps: - In the [`nitro-bridge-setup`](./) directory, create a new file named hosts.ini: @@ -18,18 +18,29 @@ To run the playbooks on a remote machine, follow these steps: ```bash [nitro_host] - hostname ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' ``` - - Replace `host_name` with the alias of your choice. + - Replace `` with the alias of your choice. - Replace `` with the IP address or hostname of the target machine. - Replace `` with the SSH username (e.g., dev, ubuntu). - Verify that you are able to connect to the host using the following command ```bash - ansible all -m ping -i hosts.ini + ansible all -m ping -i hosts.ini -k + + # Expected output: + + # | SUCCESS => { + # "ansible_facts": { + # "discovered_interpreter_python": "/usr/bin/python3.10" + # }, + # "changed": false, + # "ping": "pong" + # } ``` + ## Run Nitro Bridge - Copy the `bridge-vars-example.yml` vars file @@ -75,7 +86,7 @@ To run the playbooks on a remote machine, follow these steps: l1_asset_address: "" ``` -- To run the nitro bridge, execute the `run-nitro-bridge.yml` Ansible playbook by running the following command: +- To run the nitro bridge, execute the `run-nitro-bridge.yml` Ansible playbook by running one of the following commands: - For local deployment, specify the `"target_host": localhost` in the `--extra-vars` parameter: diff --git a/nitro-contracts-setup/README.md b/nitro-contracts-setup/README.md index bf3bfe3..d9fe612 100644 --- a/nitro-contracts-setup/README.md +++ b/nitro-contracts-setup/README.md @@ -4,6 +4,43 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine +## Setup Remote Hosts + +To run the playbook on a remote machine, follow these steps: + +- In the [`nitro-contracts-setup`](./) directory, create a new file named hosts.ini: + + ```bash + cp ../example-hosts.ini hosts.ini + ``` + +- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine + + ```bash + [nitro_host] + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' + ``` + + - Replace `` with the alias of your choice. + - Replace `` with the IP address or hostname of the target machine. + - Replace `` with the SSH username (e.g., dev, ubuntu). + +- Verify that you are able to connect to the host using the following command + + ```bash + ansible all -m ping -i hosts.ini -k + + # Expected output: + + # | SUCCESS => { + # "ansible_facts": { + # "discovered_interpreter_python": "/usr/bin/python3.10" + # }, + # "changed": false, + # "ping": "pong" + # } + ``` + ## Deploy Nitro Contracts The following commands have to be executed in [`nitro-contracts-setup`](./) directory @@ -32,18 +69,27 @@ The following commands have to be executed in [`nitro-contracts-setup`](./) dire intial_token_supply: "129600" ``` -- To deploy the L1 nitro contracts, execute the `deploy-contracts.yml` Ansible playbook by running the following command: +- To deploy the L1 nitro contracts, execute the `deploy-contracts.yml` Ansible playbook by running one of the following commands: - 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. + - For local deployment, specify the `"target_host": localhost` in the `--extra-vars` parameter: - ```bash - LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local deploy-contracts.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK - ``` + ```bash + LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK + ``` + + - For remote deployment, provide an inventory and specify the `"target_host": nitro_host` in the `--extra-vars` parameter: + + ```bash + LANG=en_US.utf8 ansible-playbook -i ./hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK + ``` + + + NOTE: By default, deployments are created in the `nitro-contracts-setup/out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. - 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 deploy-contracts.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER -kK + LANG=en_US.utf8 ansible-playbook -i ./hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER -kK ``` ## Check Deployment Status diff --git a/nitro-nodes-setup/README.md b/nitro-nodes-setup/README.md index 2be1fd2..3a908b8 100644 --- a/nitro-nodes-setup/README.md +++ b/nitro-nodes-setup/README.md @@ -6,30 +6,40 @@ To get started, follow the [installation](../README.md#installation) guide to se ## Setup Remote Hosts -- To run the playbooks on a remote machine, follow these steps: +To run the playbook on a remote machine, follow these steps: - - In the [`nitro-nodes-setup`](./) directory, create a new file named hosts.ini: +- In the [`nitro-nodes-setup`](./) directory, create a new file named hosts.ini: - ```bash - cp ../example-hosts.ini hosts.ini - ``` + ```bash + cp ../example-hosts.ini hosts.ini + ``` - - Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine +- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine - ```bash - [nitro_host] - hostname ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' - ``` + ```bash + [nitro_host] + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' + ``` - - Replace `host_name` with the alias of your choice. - - Replace `` with the IP address or hostname of the target machine. - - Replace `` with the SSH username (e.g., dev, ubuntu). + - Replace `` with the alias of your choice. + - Replace `` with the IP address or hostname of the target machine. + - Replace `` 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 - ``` + ```bash + ansible all -m ping -i hosts.ini -k + + # Expected output: + + # | SUCCESS => { + # "ansible_facts": { + # "discovered_interpreter_python": "/usr/bin/python3.10" + # }, + # "changed": false, + # "ping": "pong" + # } + ``` ## Run a nitro node @@ -83,7 +93,7 @@ The following commands have to be executed in [`nitro-nodes-setup`](./) director nitro_l2_ext_multiaddr: "" ``` -- To run a nitro node, execute the `run-nitro-nodes.yml` Ansible playbook by running the following command. +- To run a nitro node, execute the `run-nitro-nodes.yml` Ansible playbook by running one of the following commands: - For local deployment, specify the `"target_host": localhost` in the `--extra-vars` parameter: