From 867499769b1e469ddbc324ea3347f90da858df9c Mon Sep 17 00:00:00 2001 From: Adw8 Date: Thu, 5 Sep 2024 12:48:14 +0530 Subject: [PATCH 01/14] Add README steps to setup and run L2 on remote machine --- .gitignore | 1 + example-hosts.ini | 2 ++ l2-setup/README.md | 45 ++++++++++++++++++++++++++++++++++++----- l2-setup/setup-vars.yml | 2 +- 4 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 example-hosts.ini diff --git a/.gitignore b/.gitignore index 09001e4..9fe7a7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ l2-setup/out +l2-setup/hosts.ini nitro-bridge-setup/out nitro-bridge-setup/bridge-vars.yml nitro-nodes-setup/nitro-vars.yml diff --git a/example-hosts.ini b/example-hosts.ini new file mode 100644 index 0000000..66eacd8 --- /dev/null +++ b/example-hosts.ini @@ -0,0 +1,2 @@ +[nitro_host] +host_name 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 ae31893..1acbf3e 100644 --- a/l2-setup/README.md +++ b/l2-setup/README.md @@ -4,6 +4,33 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine +## Setup Remote Hosts + +To run the playbooks on a remote machine, follow these steps: + +- In the [`l2-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] + hostname 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). + +- Verify that you are able to connect to the host using the following command + + ```bash + ansible all -m ping -i hosts.ini + ``` + ## Setup and Run Optimism The following commands have to be executed in [`l2-setup`](./) directory @@ -34,18 +61,26 @@ The following commands have to be executed in [`l2-setup`](./) directory l1_priv_key: "" ``` -- To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running the following command. +- To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running one of the following commands: - NOTE: By default, deployments are created in the `l2-setup/out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. + For local deployment: ```bash - LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER + LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER ``` + For remote deployment: + + ```bash + LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{ "target_host": "nitro_host"}' -kK + ``` + + NOTE: By default, deployments are created in a `out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. + - 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 + LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{"target_host" : "nitro_host", "skip_container_build": true}' -kK ``` - To run using existing contracts deployment @@ -55,7 +90,7 @@ The following commands have to be executed in [`l2-setup`](./) directory - 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_contracts_deployment": true}' -kK --user $USER + LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{"target_host" : "nitro_host", "existing_contracts_deployment": true}' -kK ``` ## Check Deployment Status diff --git a/l2-setup/setup-vars.yml b/l2-setup/setup-vars.yml index ea03344..3615a0c 100644 --- a/l2-setup/setup-vars.yml +++ b/l2-setup/setup-vars.yml @@ -1,4 +1,4 @@ skip_container_build: false -l2_directory: "./out" +l2_directory: "out" existing_contracts_deployment: false artifact_path: "" -- 2.45.2 From e5e1a2ff19720c3778f630360c9094d63274fa41 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Thu, 5 Sep 2024 16:01:47 +0530 Subject: [PATCH 02/14] Add l2-vars-example file --- .gitignore | 2 ++ l2-setup/README.md | 6 ++++++ l2-setup/{l2-vars.yml => l2-vars-example.yml} | 0 3 files changed, 8 insertions(+) rename l2-setup/{l2-vars.yml => l2-vars-example.yml} (100%) diff --git a/.gitignore b/.gitignore index 9fe7a7d..f2f70c6 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ nitro-nodes-setup/nitro-vars.yml nitro-nodes-setup/out nitro-contracts-setup/out nitro-contracts-setup/contract-vars.yml +nitro-nodes-setup/out/ +l2-setup/l2-vars.yml diff --git a/l2-setup/README.md b/l2-setup/README.md index 1acbf3e..3052ceb 100644 --- a/l2-setup/README.md +++ b/l2-setup/README.md @@ -35,6 +35,12 @@ To run the playbooks on a remote machine, follow these steps: The following commands have to be executed in [`l2-setup`](./) directory +- Copy the `l2-vars-example.yml` vars file + + ```bash + cp l2-vars-example.yml l2-vars.yml + ``` + - Edit [`l2-vars.yml`](./l2-vars.yml) with the required values ```bash diff --git a/l2-setup/l2-vars.yml b/l2-setup/l2-vars-example.yml similarity index 100% rename from l2-setup/l2-vars.yml rename to l2-setup/l2-vars-example.yml -- 2.45.2 From e669535ca5c2d0284f1e5eceed4e30d0b1d639a7 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Thu, 5 Sep 2024 16:16:37 +0530 Subject: [PATCH 03/14] Keep separate gitignore files --- l2-setup/.gitignore | 3 +++ nitro-bridge-setup/.gitignore | 3 +++ nitro-bridge-setup/setup-vars.yml | 2 +- nitro-nodes-setup/.gitignore | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 l2-setup/.gitignore create mode 100644 nitro-bridge-setup/.gitignore create mode 100644 nitro-nodes-setup/.gitignore diff --git a/l2-setup/.gitignore b/l2-setup/.gitignore new file mode 100644 index 0000000..bec264f --- /dev/null +++ b/l2-setup/.gitignore @@ -0,0 +1,3 @@ +out +hosts.ini +l2-vars.yml diff --git a/nitro-bridge-setup/.gitignore b/nitro-bridge-setup/.gitignore new file mode 100644 index 0000000..ced2d35 --- /dev/null +++ b/nitro-bridge-setup/.gitignore @@ -0,0 +1,3 @@ +out +bridge-vars.yml +hosts.ini diff --git a/nitro-bridge-setup/setup-vars.yml b/nitro-bridge-setup/setup-vars.yml index 7762444..d1d497f 100644 --- a/nitro-bridge-setup/setup-vars.yml +++ b/nitro-bridge-setup/setup-vars.yml @@ -1,3 +1,3 @@ target_host: "localhost" -nitro_directory: ./out +nitro_directory: out skip_container_build: false diff --git a/nitro-nodes-setup/.gitignore b/nitro-nodes-setup/.gitignore new file mode 100644 index 0000000..f91659b --- /dev/null +++ b/nitro-nodes-setup/.gitignore @@ -0,0 +1,2 @@ +nitro-vars.yml +out -- 2.45.2 From 17a0ef6c9bec0fb81a2aff5a71b0323f156bbd12 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Thu, 5 Sep 2024 16:31:30 +0530 Subject: [PATCH 04/14] Add README steps to run bridge playbook on remote machine --- l2-setup/README.md | 14 +++++++------- nitro-bridge-setup/README.md | 18 +++++++++++++----- nitro-bridge-setup/setup-vars.yml | 2 +- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/l2-setup/README.md b/l2-setup/README.md index 3052ceb..be8b0c0 100644 --- a/l2-setup/README.md +++ b/l2-setup/README.md @@ -67,15 +67,15 @@ The following commands have to be executed in [`l2-setup`](./) directory l1_priv_key: "" ``` -- To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running one of the following commands: +To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running one of the following commands: - For local deployment: +- For local deployment, specify the `"target_host": localhost` in the `--extra-vars` parameter: ```bash LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER ``` - For remote deployment: +- 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 run-optimism.yml --extra-vars='{ "target_host": "nitro_host"}' -kK @@ -83,11 +83,11 @@ The following commands have to be executed in [`l2-setup`](./) directory NOTE: By default, deployments are created in a `out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. - - For skipping container build, set `"skip_container_build" : true` in the `--extra-vars` parameter: +- For skipping container build, set `"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" : "nitro_host", "skip_container_build": true}' -kK - ``` + ```bash + LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{"target_host" : "nitro_host", "skip_container_build": true}' -kK + ``` - To run using existing contracts deployment diff --git a/nitro-bridge-setup/README.md b/nitro-bridge-setup/README.md index e9cab57..b3deae9 100644 --- a/nitro-bridge-setup/README.md +++ b/nitro-bridge-setup/README.md @@ -51,16 +51,24 @@ To get started, follow the [installation](../README.md#installation) guide to se - 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. + - For local deployment, specify the `"target_host": localhost` 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"}' --user $USER -kK - ``` + ```bash + LANG=en_US.utf8 ansible-playbook run-nitro-bridge.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 run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK + ``` + + NOTE: By default, deployments are created in the `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 run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER -kK + LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER -kK ``` ## Check Deployment Status diff --git a/nitro-bridge-setup/setup-vars.yml b/nitro-bridge-setup/setup-vars.yml index d1d497f..ec984ed 100644 --- a/nitro-bridge-setup/setup-vars.yml +++ b/nitro-bridge-setup/setup-vars.yml @@ -1,3 +1,3 @@ target_host: "localhost" -nitro_directory: out +nitro_directory: nitro-depp skip_container_build: false -- 2.45.2 From 8f09e44749fa9b4e3117bd79c836f1aa17354661 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Thu, 5 Sep 2024 16:43:37 +0530 Subject: [PATCH 05/14] Add README steps to run nitro nodes on remote machine --- l2-setup/README.md | 28 +++++++++---------- nitro-bridge-setup/README.md | 4 +-- nitro-bridge-setup/setup-vars.yml | 2 +- nitro-nodes-setup/.gitignore | 1 + nitro-nodes-setup/README.md | 45 +++++++++++++++++++++++++++---- nitro-nodes-setup/setup-vars.yml | 2 +- 6 files changed, 59 insertions(+), 23 deletions(-) diff --git a/l2-setup/README.md b/l2-setup/README.md index be8b0c0..29080d7 100644 --- a/l2-setup/README.md +++ b/l2-setup/README.md @@ -67,27 +67,27 @@ The following commands have to be executed in [`l2-setup`](./) directory l1_priv_key: "" ``` -To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running one of the following commands: +- To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running one of the following commands: -- For local deployment, specify the `"target_host": localhost` in the `--extra-vars` parameter: + - For local deployment, specify the `"target_host": localhost` in the `--extra-vars` parameter: - ```bash - LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER - ``` + ```bash + LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER + ``` -- For remote deployment, provide an inventory and specify the `"target_host": nitro_host` in the `--extra-vars` parameter: + - 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 run-optimism.yml --extra-vars='{ "target_host": "nitro_host"}' -kK - ``` + ```bash + LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{ "target_host": "nitro_host"}' -kK + ``` - NOTE: By default, deployments are created in a `out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. + NOTE: By default, deployments are created in a `out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. -- For skipping container build, set `"skip_container_build" : true` in the `--extra-vars` parameter: + - For skipping container build, set `"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" : "nitro_host", "skip_container_build": true}' -kK - ``` + ```bash + LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{"target_host" : "nitro_host", "skip_container_build": true}' -kK + ``` - To run using existing contracts deployment diff --git a/nitro-bridge-setup/README.md b/nitro-bridge-setup/README.md index b3deae9..127eb22 100644 --- a/nitro-bridge-setup/README.md +++ b/nitro-bridge-setup/README.md @@ -60,7 +60,7 @@ To get started, follow the [installation](../README.md#installation) guide to se - 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 run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK + LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK ``` NOTE: By default, deployments are created in the `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. @@ -68,7 +68,7 @@ To get started, follow the [installation](../README.md#installation) guide to se - 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": "localhost", "skip_container_build": true }' --user $USER -kK + 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 Deployment Status diff --git a/nitro-bridge-setup/setup-vars.yml b/nitro-bridge-setup/setup-vars.yml index ec984ed..d1d497f 100644 --- a/nitro-bridge-setup/setup-vars.yml +++ b/nitro-bridge-setup/setup-vars.yml @@ -1,3 +1,3 @@ target_host: "localhost" -nitro_directory: nitro-depp +nitro_directory: out skip_container_build: false diff --git a/nitro-nodes-setup/.gitignore b/nitro-nodes-setup/.gitignore index f91659b..8ad0f7d 100644 --- a/nitro-nodes-setup/.gitignore +++ b/nitro-nodes-setup/.gitignore @@ -1,2 +1,3 @@ nitro-vars.yml out +hosts.ini diff --git a/nitro-nodes-setup/README.md b/nitro-nodes-setup/README.md index 256487e..2be1fd2 100644 --- a/nitro-nodes-setup/README.md +++ b/nitro-nodes-setup/README.md @@ -4,6 +4,33 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine +## Setup Remote Hosts + +- To run the playbooks on a remote machine, follow these steps: + + - In the [`nitro-nodes-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] + hostname 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). + + - Verify that you are able to connect to the host using the following command + + ```bash + ansible all -m ping -i hosts.ini + ``` + ## Run a nitro node The following commands have to be executed in [`nitro-nodes-setup`](./) directory @@ -58,16 +85,24 @@ The following commands have to be executed in [`nitro-nodes-setup`](./) director - To run a nitro node, execute the `run-nitro-nodes.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. + - For local deployment, specify the `"target_host": localhost` in the `--extra-vars` parameter: - ```bash - LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER - ``` + ```bash + LANG=en_US.utf8 ansible-playbook run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER + ``` + + - 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 run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host"}' -kK --user $USER + ``` + + NOTE: By default, deployments are created in a `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 run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' -kK --user $USER + LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' -kK --user $USER ``` ## Check Deployment Status diff --git a/nitro-nodes-setup/setup-vars.yml b/nitro-nodes-setup/setup-vars.yml index 7762444..d1d497f 100644 --- a/nitro-nodes-setup/setup-vars.yml +++ b/nitro-nodes-setup/setup-vars.yml @@ -1,3 +1,3 @@ target_host: "localhost" -nitro_directory: ./out +nitro_directory: out skip_container_build: false -- 2.45.2 From d7e657119a1be348bef5ba9727e943cdb6ed505d Mon Sep 17 00:00:00 2001 From: Adw8 Date: Fri, 6 Sep 2024 12:07:12 +0530 Subject: [PATCH 06/14] Add README steps to deploy nitro contracts on remote machine --- .gitignore | 10 ---------- l2-setup/.gitignore | 2 +- nitro-bridge-setup/README.md | 26 ++++++++++++++++++++++++++ nitro-contracts-setup/.gitignore | 3 +++ nitro-nodes-setup/.gitignore | 2 +- 5 files changed, 31 insertions(+), 12 deletions(-) delete mode 100644 .gitignore create mode 100644 nitro-contracts-setup/.gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index f2f70c6..0000000 --- a/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -l2-setup/out -l2-setup/hosts.ini -nitro-bridge-setup/out -nitro-bridge-setup/bridge-vars.yml -nitro-nodes-setup/nitro-vars.yml -nitro-nodes-setup/out -nitro-contracts-setup/out -nitro-contracts-setup/contract-vars.yml -nitro-nodes-setup/out/ -l2-setup/l2-vars.yml diff --git a/l2-setup/.gitignore b/l2-setup/.gitignore index bec264f..fb4396e 100644 --- a/l2-setup/.gitignore +++ b/l2-setup/.gitignore @@ -1,3 +1,3 @@ out -hosts.ini l2-vars.yml +hosts.ini diff --git a/nitro-bridge-setup/README.md b/nitro-bridge-setup/README.md index 127eb22..200883a 100644 --- a/nitro-bridge-setup/README.md +++ b/nitro-bridge-setup/README.md @@ -4,6 +4,32 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine +## Setup Remote Hosts + +To run the playbooks on a remote machine, follow these steps: + +- In the [`nitro-bridge-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] + hostname 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). + +- Verify that you are able to connect to the host using the following command + + ```bash + ansible all -m ping -i hosts.ini + ``` ## Run Nitro Bridge - Copy the `bridge-vars-example.yml` vars file diff --git a/nitro-contracts-setup/.gitignore b/nitro-contracts-setup/.gitignore new file mode 100644 index 0000000..ffb4fb9 --- /dev/null +++ b/nitro-contracts-setup/.gitignore @@ -0,0 +1,3 @@ +out +contract-vars.yml +hosts.ini diff --git a/nitro-nodes-setup/.gitignore b/nitro-nodes-setup/.gitignore index 8ad0f7d..a537e4d 100644 --- a/nitro-nodes-setup/.gitignore +++ b/nitro-nodes-setup/.gitignore @@ -1,3 +1,3 @@ -nitro-vars.yml out +nitro-vars.yml hosts.ini -- 2.45.2 From dc6145f37d28da9f40c3355d936fe2bb6108472f Mon Sep 17 00:00:00 2001 From: Adw8 Date: Mon, 9 Sep 2024 10:50:23 +0530 Subject: [PATCH 07/14] 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: -- 2.45.2 From 852db93b9e4657d7e880b407d09ae52a234a69c2 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Mon, 9 Sep 2024 14:27:30 +0530 Subject: [PATCH 08/14] Move remote host setup to root README --- .gitignore | 1 + README.md | 43 +++++++++++++++++++++++++++++-- example-hosts.ini | 4 +-- l2-setup/README.md | 45 ++++++--------------------------- nitro-bridge-setup/README.md | 37 +++------------------------ nitro-contracts-setup/README.md | 37 +++------------------------ nitro-nodes-setup/README.md | 37 +++------------------------ 7 files changed, 64 insertions(+), 140 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..788482a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +hosts.ini diff --git a/README.md b/README.md index c29e4fe..01c977b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ - 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. + 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 @@ -32,12 +32,51 @@ LANG="en_US.UTF-8" ``` - - Reboot your system or log out and log back in to apply the changes. + - Reboot your system or log out and log back in to apply the changes - Reference: +## Setup Remote Hosts + +To run the playbook on a remote machine, setup the required ansible inventory: + +- Create a new `hosts.ini` file: + + ```bash + cp example-hosts.ini hosts.ini + ``` + +- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine: + + ```bash + [] + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' + ``` + + - Replace `` with the appropriate host group for the deployment + - 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" + # } + ``` + ## Playbooks - [l2-setup](./l2-setup/README.md) - [nitro-node-setup](./nitro-nodes-setup/README.md) - [nitro-bridge-setup](./nitro-bridge-setup/README.md) +- [nitro-contracts-setup](./nitro-contracts-setup/) diff --git a/example-hosts.ini b/example-hosts.ini index da832ab..05fd65c 100644 --- a/example-hosts.ini +++ b/example-hosts.ini @@ -1,2 +1,2 @@ -[nitro_host] - ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' \ No newline at end of file +[deployment_host] + 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 f8e7998..b9fe17c 100644 --- a/l2-setup/README.md +++ b/l2-setup/README.md @@ -4,42 +4,13 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine -## Setup Remote Hosts +## Setup for Remote Host -To run the playbook on a remote machine, follow these steps: +To run the playbook on a remote host: -- In the [`l2-setup`](./) directory, create a new file named hosts.ini: +- Follow steps from [setup remote hosts](../README.md#setup-remote-hosts) - ```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" - # } - ``` +- Update / append the [`hosts.ini`](../hosts.ini) file for your remote host with `` set as `l2_host` ## Setup and Run Optimism @@ -85,10 +56,10 @@ The following commands have to be executed in [`l2-setup`](./) directory LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER ``` - - For remote deployment, provide an inventory and specify the `"target_host": nitro_host` in the `--extra-vars` parameter: + - For remote deployment, provide an inventory and specify the `"target_host": l2_host` in the `--extra-vars` parameter: ```bash - LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{ "target_host": "nitro_host"}' -kK + LANG=en_US.utf8 ansible-playbook -i ../hosts.ini run-optimism.yml --extra-vars='{ "target_host": "l2_host"}' -kK ``` NOTE: By default, deployments are created in a `out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. @@ -96,7 +67,7 @@ The following commands have to be executed in [`l2-setup`](./) directory - For skipping container build, set `"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" : "nitro_host", "skip_container_build": true}' -kK + LANG=en_US.utf8 ansible-playbook -i ../hosts.ini run-optimism.yml --extra-vars='{"target_host" : "l2_host", "skip_container_build": true}' -kK ``` - To run using existing contracts deployment @@ -106,7 +77,7 @@ The following commands have to be executed in [`l2-setup`](./) directory - Run the ansible playbook with `"existing_contracts_deployment": true` in the `--extra-vars` parameter: ```bash - LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{"target_host" : "nitro_host", "existing_contracts_deployment": true}' -kK + LANG=en_US.utf8 ansible-playbook -i ../hosts.ini run-optimism.yml --extra-vars='{"target_host" : "l2_host", "existing_contracts_deployment": true}' -kK ``` ## Check Deployment Status diff --git a/nitro-bridge-setup/README.md b/nitro-bridge-setup/README.md index 3b5834c..a1d1193 100644 --- a/nitro-bridge-setup/README.md +++ b/nitro-bridge-setup/README.md @@ -4,42 +4,13 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine -## Setup Remote Hosts +## Setup for Remote Host -To run the playbook on a remote machine, follow these steps: +To run the playbook on a remote host: -- In the [`nitro-bridge-setup`](./) directory, create a new file named hosts.ini: +- Follow steps from [setup remote hosts](../README.md#setup-remote-hosts) - ```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" - # } - ``` +- Update / append the [`hosts.ini`](../hosts.ini) file for your remote host with `` set as `nitro_host` ## Run Nitro Bridge diff --git a/nitro-contracts-setup/README.md b/nitro-contracts-setup/README.md index d9fe612..b3e9dbe 100644 --- a/nitro-contracts-setup/README.md +++ b/nitro-contracts-setup/README.md @@ -4,42 +4,13 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine -## Setup Remote Hosts +## Setup for Remote Host -To run the playbook on a remote machine, follow these steps: +To run the playbook on a remote host: -- In the [`nitro-contracts-setup`](./) directory, create a new file named hosts.ini: +- Follow steps from [setup remote hosts](../README.md#setup-remote-hosts) - ```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" - # } - ``` +- Update / append the [`hosts.ini`](../hosts.ini) file for your remote host with `` set as `nitro_host` ## Deploy Nitro Contracts diff --git a/nitro-nodes-setup/README.md b/nitro-nodes-setup/README.md index 3a908b8..090c1d8 100644 --- a/nitro-nodes-setup/README.md +++ b/nitro-nodes-setup/README.md @@ -4,42 +4,13 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine -## Setup Remote Hosts +## Setup for Remote Host -To run the playbook on a remote machine, follow these steps: +To run the playbook on a remote host: -- In the [`nitro-nodes-setup`](./) directory, create a new file named hosts.ini: +- Follow steps from [setup remote hosts](../README.md#setup-remote-hosts) - ```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" - # } - ``` +- Update / append the [`hosts.ini`](../hosts.ini) file for your remote host with `` set as `nitro_host` ## Run a nitro node -- 2.45.2 From 12fc9f03cf759ebb073ab1451843062b9296cba0 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Mon, 9 Sep 2024 15:32:45 +0530 Subject: [PATCH 09/14] Update var in template --- nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 b/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 index 546d742..8c5d582 100644 --- a/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 +++ b/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 @@ -10,7 +10,7 @@ config: OPTIMISM_DEPLOYER_PK: {{ optimism_deployer_pk }} TOKEN_NAME: {{ token_name }} TOKEN_SYMBOL: {{ token_symbol }} - INITIAL_TOKEN_SUPPLY: {{ token_symbol }} + INITIAL_TOKEN_SUPPLY: {{ intial_token_supply }} NA_ADDRESS: {{ na_address }} VPA_ADDRESS: {{ vpa_address }} CA_ADDRESS: {{ ca_address }} -- 2.45.2 From c98e41c2cbee1bebafc1d2b81cb35aee98fcad33 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Mon, 9 Sep 2024 15:58:54 +0530 Subject: [PATCH 10/14] Rename vars files --- example-hosts.ini => hosts.example.ini | 0 l2-setup/{l2-vars-example.yml => l2-vars.example.yml} | 0 .../{bridge-vars-example.yml => bridge-vars.example.yml} | 0 .../{contract-vars-example.yml => contract-vars.example.yml} | 0 .../{nitro-vars-example.yml => nitro-vars.example.yml} | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename example-hosts.ini => hosts.example.ini (100%) rename l2-setup/{l2-vars-example.yml => l2-vars.example.yml} (100%) rename nitro-bridge-setup/{bridge-vars-example.yml => bridge-vars.example.yml} (100%) rename nitro-contracts-setup/{contract-vars-example.yml => contract-vars.example.yml} (100%) rename nitro-nodes-setup/{nitro-vars-example.yml => nitro-vars.example.yml} (100%) diff --git a/example-hosts.ini b/hosts.example.ini similarity index 100% rename from example-hosts.ini rename to hosts.example.ini diff --git a/l2-setup/l2-vars-example.yml b/l2-setup/l2-vars.example.yml similarity index 100% rename from l2-setup/l2-vars-example.yml rename to l2-setup/l2-vars.example.yml diff --git a/nitro-bridge-setup/bridge-vars-example.yml b/nitro-bridge-setup/bridge-vars.example.yml similarity index 100% rename from nitro-bridge-setup/bridge-vars-example.yml rename to nitro-bridge-setup/bridge-vars.example.yml diff --git a/nitro-contracts-setup/contract-vars-example.yml b/nitro-contracts-setup/contract-vars.example.yml similarity index 100% rename from nitro-contracts-setup/contract-vars-example.yml rename to nitro-contracts-setup/contract-vars.example.yml diff --git a/nitro-nodes-setup/nitro-vars-example.yml b/nitro-nodes-setup/nitro-vars.example.yml similarity index 100% rename from nitro-nodes-setup/nitro-vars-example.yml rename to nitro-nodes-setup/nitro-vars.example.yml -- 2.45.2 From 566072ff48fd2d5cc738ff395898ff182604743b Mon Sep 17 00:00:00 2001 From: Adw8 Date: Mon, 9 Sep 2024 17:10:13 +0530 Subject: [PATCH 11/14] Update READMEs with remote host setup --- README.md | 38 --------- l2-setup/README.md | 132 +++++++++++++++++++++----------- nitro-bridge-setup/README.md | 90 +++++++++++++++------- nitro-contracts-setup/README.md | 83 ++++++++++++++------ nitro-nodes-setup/README.md | 77 +++++++++++++++---- 5 files changed, 273 insertions(+), 147 deletions(-) diff --git a/README.md b/README.md index 01c977b..59ba4eb 100644 --- a/README.md +++ b/README.md @@ -36,44 +36,6 @@ - Reference: -## Setup Remote Hosts - -To run the playbook on a remote machine, setup the required ansible inventory: - -- Create a new `hosts.ini` file: - - ```bash - cp example-hosts.ini hosts.ini - ``` - -- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine: - - ```bash - [] - ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' - ``` - - - Replace `` with the appropriate host group for the deployment - - 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" - # } - ``` - ## Playbooks - [l2-setup](./l2-setup/README.md) diff --git a/l2-setup/README.md b/l2-setup/README.md index b9fe17c..4525d89 100644 --- a/l2-setup/README.md +++ b/l2-setup/README.md @@ -4,27 +4,19 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine -## Setup for Remote Host +## Setup and Run L2 on Local Host -To run the playbook on a remote host: +The following commands have to be executed in the [`l2-setup`](./) directory: -- Follow steps from [setup remote hosts](../README.md#setup-remote-hosts) - -- Update / append the [`hosts.ini`](../hosts.ini) file for your remote host with `` set as `l2_host` - -## Setup and Run Optimism - -The following commands have to be executed in [`l2-setup`](./) directory - -- Copy the `l2-vars-example.yml` vars file +- Copy the `l2-vars.example.yml` vars file: ```bash - cp l2-vars-example.yml l2-vars.yml + cp l2-vars.example.yml l2-vars.yml ``` -- Edit [`l2-vars.yml`](./l2-vars.yml) with the required values +- Edit [`l2-vars.yml`](./l2-vars.yml) with the required values: - ```bash + ```yaml # L1 chain ID l1_chain_id: "" @@ -48,52 +40,106 @@ The following commands have to be executed in [`l2-setup`](./) directory l1_priv_key: "" ``` -- To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running one of the following commands: +- To setup and run L2 locally, execute the `run-optimism.yml` Ansible playbook: - - For local deployment, specify the `"target_host": localhost` in the `--extra-vars` parameter: + ```bash + LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER + ``` - ```bash - LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER - ``` + NOTE: By default, deployments are created in an `out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. - - For remote deployment, provide an inventory and specify the `"target_host": l2_host` in the `--extra-vars` parameter: +- For skipping container build, set `"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"}' -kK - ``` + ```bash + LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK + ``` - NOTE: By default, deployments are created in a `out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. - - - For skipping container build, set `"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}' -kK - ``` - -- To run using existing contracts deployment +- To run using existing contracts deployment: - 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_contracts_deployment": 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", "existing_contracts_deployment": true}' -kK + LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{"target_host" : "localhost", "existing_contracts_deployment": true}' -kK + ``` + +## Setup and Run on Remote Host + +To run the playbook on a remote host: + +- Create a new `hosts.ini` file: + + ```bash + cp ../hosts.example.ini hosts.ini + ``` + +- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine: + + ```ini + [] + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' + ``` + + - Replace `` with `l2_host` + - 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" + # } + ``` + +- Copy and edit the `l2-vars.yml` file as described in the Local Setup section. + +- Execute the `run-optimism.yml` Ansible playbook for remote deployment: + + ```bash + LANG=en_US.utf8 ansible-playbook -i hosts.ini run-optimism.yml --extra-vars='{ "target_host": "l2_host"}' -kK + ``` + +- For skipping container build, set `"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}' -kK + ``` + +- To run using existing contracts deployment: + + - 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_contracts_deployment": 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", "existing_contracts_deployment": true}' -kK ``` ## Check Deployment Status -- Run the following command in the directory where the optimism-deployment is created +Run the following commands in the directory where the optimism-deployment is created: - - Follow optimism contracts deployment logs: +- Follow optimism contracts deployment logs: - ```bash - laconic-so deployment --dir optimism-deployment logs -f fixturenet-optimism-contracts - ``` + ```bash + laconic-so deployment --dir optimism-deployment logs -f fixturenet-optimism-contracts + ``` - - Check L2 logs: +- Check L2 logs: - ```bash - laconic-so deployment --dir optimism-deployment logs -f op-geth + ```bash + laconic-so deployment --dir optimism-deployment logs -f op-geth - # Ensure new blocks are getting created - ``` + # Ensure new blocks are getting created + ``` diff --git a/nitro-bridge-setup/README.md b/nitro-bridge-setup/README.md index a1d1193..b4a540e 100644 --- a/nitro-bridge-setup/README.md +++ b/nitro-bridge-setup/README.md @@ -4,25 +4,19 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine -## Setup for Remote Host +## Setup and Run Nitro Bridge on Local Host -To run the playbook on a remote host: +The following commands have to be executed in the [`nitro-bridge-setup`](./) directory: -- Follow steps from [setup remote hosts](../README.md#setup-remote-hosts) - -- Update / append the [`hosts.ini`](../hosts.ini) file for your remote host with `` set as `nitro_host` - -## Run Nitro Bridge - -- Copy the `bridge-vars-example.yml` vars file +- Copy the `bridge-vars.example.yml` vars file: ```bash - cp bridge-vars-example.yml bridge-vars.yml + cp bridge-vars.example.yml bridge-vars.yml ``` -- Edit [`bridge-vars.yml`](./bridge-vars.yml) and fill in the following values +- Edit [`bridge-vars.yml`](./bridge-vars.yml) with the required values: - ```bash + ```yaml # L1 WS endpoint nitro_l1_chain_url: "" @@ -57,27 +51,71 @@ To run the playbook on a remote host: l1_asset_address: "" ``` -- To run the nitro bridge, execute the `run-nitro-bridge.yml` Ansible playbook by running one of the following commands: +- To setup and run nitro bridge locally, execute the `run-nitro-bridge.yml` Ansible playbook: - - For local deployment, specify the `"target_host": localhost` in the `--extra-vars` parameter: + ```bash + LANG=en_US.utf8 ansible-playbook run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER + ``` - ```bash - LANG=en_US.utf8 ansible-playbook run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK - ``` + NOTE: By default, deployments are created in an `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. - - For remote deployment, provide an inventory and specify the `"target_host": nitro_host` in the `--extra-vars` parameter: +- For skipping container build, set `"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"}' --user $USER -kK - ``` + ```bash + LANG=en_US.utf8 ansible-playbook run-nitro-bridge.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER + ``` - NOTE: By default, deployments are created in the `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. +## Setup and Run Nitro Bridge on Remote Host - - For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter: +To run the playbook on a remote host: - ```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 - ``` +- Create a new `hosts.ini` file: + + ```bash + cp ../hosts.example.ini hosts.ini + ``` + +- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine: + + ```ini + [] + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' + ``` + + - Replace `` with `nitro_host` + - 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" + # } + ``` + +- Copy and edit the `bridge-vars.yml` file as described in the Local Setup section. + +- Execute the `run-nitro-bridge.yml` Ansible playbook for remote deployment: + + ```bash + LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host"}' -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 Deployment Status diff --git a/nitro-contracts-setup/README.md b/nitro-contracts-setup/README.md index b3e9dbe..56ae2c8 100644 --- a/nitro-contracts-setup/README.md +++ b/nitro-contracts-setup/README.md @@ -4,17 +4,9 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine -## Setup for Remote Host +## Deploy Nitro Contracts on Local Host -To run the playbook on a remote host: - -- Follow steps from [setup remote hosts](../README.md#setup-remote-hosts) - -- Update / append the [`hosts.ini`](../hosts.ini) file for your remote host with `` set as `nitro_host` - -## Deploy Nitro Contracts - -The following commands have to be executed in [`nitro-contracts-setup`](./) directory +The following commands have to be executed in the [`nitro-contracts-setup`](./) directory: - Copy the `contract-vars-example.yml` vars file @@ -40,28 +32,71 @@ 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 one of the following commands: +- To deploy nitro contracts locally, execute the `deploy-contracts.yml` Ansible playbook: - - For local deployment, specify the `"target_host": localhost` in the `--extra-vars` parameter: + ```bash + LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER + ``` - ```bash - LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK - ``` + NOTE: By default, deployments are created in an `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. - - For remote deployment, provide an inventory and specify the `"target_host": nitro_host` in the `--extra-vars` parameter: +- For skipping container build, set `"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"}' --user $USER -kK - ``` + ```bash + LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER + ``` +## Deploy Nitro Contracts on Remote Host - 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. +To run the playbook on a remote host: - - For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter: +- Create a new `hosts.ini` file: - ```bash - LANG=en_US.utf8 ansible-playbook -i ./hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER -kK - ``` + ```bash + cp ../hosts.example.ini hosts.ini + ``` + +- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine: + + ```ini + [] + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' + ``` + + - Replace `` with `nitro_host` + - 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" + # } + ``` + +- Copy and edit the [`contract-vars.yml`](./contract-vars.yml) file as described in the Local Setup section + +- Execute the `deploy-contracts.yml` Ansible playbook for remote deployment: + + ```bash + LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host"}' -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 Deployment Status diff --git a/nitro-nodes-setup/README.md b/nitro-nodes-setup/README.md index 090c1d8..2bf819a 100644 --- a/nitro-nodes-setup/README.md +++ b/nitro-nodes-setup/README.md @@ -12,14 +12,14 @@ To run the playbook on a remote host: - Update / append the [`hosts.ini`](../hosts.ini) file for your remote host with `` set as `nitro_host` -## Run a nitro node +## Run Nitro Node on Local Host The following commands have to be executed in [`nitro-nodes-setup`](./) directory - Copy the `nitro-vars-example.yml` vars file ```bash - cp nitro-vars-example.yml nitro-vars.yml + cp nitro-vars.example.yml nitro-vars.yml ``` - Edit [`nitro-vars.yml`](./nitro-vars.yml) and fill in the following values @@ -64,27 +64,72 @@ 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 one of the following commands: +- To run a nitro node, execute the `run-nitro-nodes.yml` Ansible playbook by running the following command: - - For local deployment, specify the `"target_host": localhost` in the `--extra-vars` parameter: + ```bash + LANG=en_US.utf8 ansible-playbook run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER + ``` - ```bash - LANG=en_US.utf8 ansible-playbook run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER - ``` + NOTE: By default, deployments are created in a `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. - - For remote deployment, provide an inventory and specify the `"target_host": nitro_host` in the `--extra-vars` parameter: +- 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-nodes.yml --extra-vars='{ "target_host": "nitro_host"}' -kK --user $USER - ``` + ```bash + LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' -kK --user $USER + ``` - NOTE: By default, deployments are created in a `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. +## Run Nitro Node on Remote Host - - For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter: +To run the playbook on a remote host: + +- Create a new `hosts.ini` file: + + ```bash + cp ../hosts.example.ini hosts.ini + ``` + +- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine: + + ```ini + [] + ansible_host= ansible_user= ansible_ssh_common_args='-o ForwardAgent=yes' + ``` + + - Replace `` with `nitro_host` + - 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" + # } + ``` + +- Copy and edit the [`nitro-vars.yml`](./nitro-vars.yml) file as described in the Local Setup section + +- Execute the `run-nitro-nodes.yml` Ansible playbook for remote deployment: + + ```bash + LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host"}' -kK --user $USER + ``` + +- 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-nodes.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK + ``` - ```bash - LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' -kK --user $USER - ``` ## Check Deployment Status -- 2.45.2 From 67dc7e4235dcdf71199b5938b1da42c07f13361c Mon Sep 17 00:00:00 2001 From: Adw8 Date: Mon, 9 Sep 2024 17:22:37 +0530 Subject: [PATCH 12/14] Pass contract addresses as strings in vars files --- .../templates/specs/bridge-nitro-spec.yml.j2 | 8 ++++---- nitro-contracts-setup/setup-vars.yml | 2 +- .../templates/configs/l1-nitro-config.env.j2 | 6 +++--- .../templates/configs/l2-nitro-config.env.j2 | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 b/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 index 8c5d582..a75fa0e 100644 --- a/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 +++ b/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 @@ -11,10 +11,10 @@ config: TOKEN_NAME: {{ token_name }} TOKEN_SYMBOL: {{ token_symbol }} INITIAL_TOKEN_SUPPLY: {{ intial_token_supply }} - NA_ADDRESS: {{ na_address }} - VPA_ADDRESS: {{ vpa_address }} - CA_ADDRESS: {{ ca_address }} - L1_ASSET_ADDRESS: {{ l1_asset_address }} + NA_ADDRESS: "{{ na_address }}" + VPA_ADDRESS: "{{ vpa_address }}" + CA_ADDRESS: "{{ ca_address }}" + L1_ASSET_ADDRESS: "{{ l1_asset_address }}" network: ports: nitro-bridge: diff --git a/nitro-contracts-setup/setup-vars.yml b/nitro-contracts-setup/setup-vars.yml index 7762444..d1d497f 100644 --- a/nitro-contracts-setup/setup-vars.yml +++ b/nitro-contracts-setup/setup-vars.yml @@ -1,3 +1,3 @@ target_host: "localhost" -nitro_directory: ./out +nitro_directory: out skip_container_build: false diff --git a/nitro-nodes-setup/templates/configs/l1-nitro-config.env.j2 b/nitro-nodes-setup/templates/configs/l1-nitro-config.env.j2 index dc92e23..aca42b5 100644 --- a/nitro-nodes-setup/templates/configs/l1-nitro-config.env.j2 +++ b/nitro-nodes-setup/templates/configs/l1-nitro-config.env.j2 @@ -1,8 +1,8 @@ NITRO_CHAIN_URL={{ nitro_l1_chain_url }} NITRO_SC_PK={{ nitro_sc_pk }} NITRO_CHAIN_PK={{ nitro_chain_pk }} -NA_ADDRESS={{ na_address }} -VPA_ADDRESS={{ vpa_address }} -CA_ADDRESS={{ ca_address }} +NA_ADDRESS="{{ na_address }}" +VPA_ADDRESS="{{ vpa_address }}" +CA_ADDRESS="{{ ca_address }}" NITRO_BOOTPEERS={{ nitro_l1_bridge_multiaddr }} NITRO_EXT_MULTIADDR={{ nitro_l1_ext_multiaddr }} diff --git a/nitro-nodes-setup/templates/configs/l2-nitro-config.env.j2 b/nitro-nodes-setup/templates/configs/l2-nitro-config.env.j2 index be853b6..709a2ea 100644 --- a/nitro-nodes-setup/templates/configs/l2-nitro-config.env.j2 +++ b/nitro-nodes-setup/templates/configs/l2-nitro-config.env.j2 @@ -1,10 +1,10 @@ NITRO_CHAIN_URL={{ nitro_l2_chain_url }} NITRO_SC_PK={{ nitro_sc_pk }} NITRO_CHAIN_PK={{ nitro_chain_pk }} -NA_ADDRESS={{ na_address }} -VPA_ADDRESS={{ vpa_address }} -CA_ADDRESS={{ ca_address }} -BRIDGE_ADDRESS={{ bridge_contract_address }} +NA_ADDRESS="{{ na_address }}" +VPA_ADDRESS="{{ vpa_address }}" +CA_ADDRESS="{{ ca_address }}" +BRIDGE_ADDRESS="{{ bridge_contract_address }}" NITRO_BOOTPEERS={{ nitro_l2_bridge_multiaddr }} NITRO_EXT_MULTIADDR={{ nitro_l2_ext_multiaddr }} NITRO_L2=true -- 2.45.2 From e46846c476f374826f2fd430d78dfe6ed72eb76b Mon Sep 17 00:00:00 2001 From: Adw8 Date: Mon, 9 Sep 2024 17:44:59 +0530 Subject: [PATCH 13/14] Pass user when running ansible playbook --- README.md | 2 +- l2-setup/README.md | 16 ++++++++-------- nitro-bridge-setup/README.md | 12 ++++++------ nitro-bridge-setup/bridge-vars.example.yml | 2 +- .../templates/specs/bridge-nitro-spec.yml.j2 | 2 +- nitro-contracts-setup/README.md | 12 ++++++------ nitro-contracts-setup/contract-vars.example.yml | 2 +- .../templates/specs/nitro-contracts-spec.yml.j2 | 2 +- nitro-nodes-setup/README.md | 10 +++++----- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 59ba4eb..4031661 100644 --- a/README.md +++ b/README.md @@ -41,4 +41,4 @@ - [l2-setup](./l2-setup/README.md) - [nitro-node-setup](./nitro-nodes-setup/README.md) - [nitro-bridge-setup](./nitro-bridge-setup/README.md) -- [nitro-contracts-setup](./nitro-contracts-setup/) +- [nitro-contracts-setup](./nitro-contracts-setup/README.md) diff --git a/l2-setup/README.md b/l2-setup/README.md index 4525d89..60c7282 100644 --- a/l2-setup/README.md +++ b/l2-setup/README.md @@ -43,15 +43,15 @@ The following commands have to be executed in the [`l2-setup`](./) directory: - To setup and run L2 locally, execute the `run-optimism.yml` Ansible playbook: ```bash - LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER + LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK ``` - NOTE: By default, deployments are created in an `out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. + NOTE: By default, deployments are created in an `out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file - For skipping container build, set `"skip_container_build" : true` in the `--extra-vars` parameter: ```bash - LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK + LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' --user $USER -kK ``` - To run using existing contracts deployment: @@ -61,7 +61,7 @@ The following commands have to be executed in the [`l2-setup`](./) directory: - Run the ansible playbook with `"existing_contracts_deployment": true` in the `--extra-vars` parameter: ```bash - LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{"target_host" : "localhost", "existing_contracts_deployment": true}' -kK + LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{"target_host" : "localhost", "existing_contracts_deployment": true}' --user $USER -kK ``` ## Setup and Run on Remote Host @@ -102,18 +102,18 @@ To run the playbook on a remote host: # } ``` -- Copy and edit the `l2-vars.yml` file as described in the Local Setup section. +- Copy and edit the `l2-vars.yml` file as described in the [local setup](./README.md#setup-and-run-l2-on-local-host) section - Execute the `run-optimism.yml` Ansible playbook for remote deployment: ```bash - LANG=en_US.utf8 ansible-playbook -i hosts.ini run-optimism.yml --extra-vars='{ "target_host": "l2_host"}' -kK + 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, set `"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}' -kK + 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 ``` - To run using existing contracts deployment: @@ -123,7 +123,7 @@ To run the playbook on a remote host: - Run the ansible playbook with `"existing_contracts_deployment": 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", "existing_contracts_deployment": true}' -kK + LANG=en_US.utf8 ansible-playbook -i hosts.ini run-optimism.yml --extra-vars='{"target_host" : "l2_host", "existing_contracts_deployment": true}' --user $USER -kK ``` ## Check Deployment Status diff --git a/nitro-bridge-setup/README.md b/nitro-bridge-setup/README.md index b4a540e..deec0f0 100644 --- a/nitro-bridge-setup/README.md +++ b/nitro-bridge-setup/README.md @@ -40,7 +40,7 @@ The following commands have to be executed in the [`nitro-bridge-setup`](./) dir # Custom L2 token to be deployed token_name: "LaconicNetworkToken" token_symbol: "LNT" - intial_token_supply: "129600" + initial_token_supply: "129600" # Addresses of the deployed nitro contracts na_address: "" @@ -54,15 +54,15 @@ The following commands have to be executed in the [`nitro-bridge-setup`](./) dir - To setup and run nitro bridge locally, execute the `run-nitro-bridge.yml` Ansible playbook: ```bash - LANG=en_US.utf8 ansible-playbook run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER + LANG=en_US.utf8 ansible-playbook run-nitro-bridge.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK ``` - NOTE: By default, deployments are created in an `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. + NOTE: By default, deployments are created in an `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file - For skipping container build, set `"skip_container_build" : true` in the `--extra-vars` parameter: ```bash - LANG=en_US.utf8 ansible-playbook run-nitro-bridge.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER + LANG=en_US.utf8 ansible-playbook run-nitro-bridge.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' --user $USER -kK ``` ## Setup and Run Nitro Bridge on Remote Host @@ -103,12 +103,12 @@ To run the playbook on a remote host: # } ``` -- Copy and edit the `bridge-vars.yml` file as described in the Local Setup section. +- Copy and edit the `bridge-vars.yml` file as described in the [local setup](./README.md#setup-and-run-nitro-bridge-on-local-host) section - Execute the `run-nitro-bridge.yml` Ansible playbook for remote deployment: ```bash - LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host"}' -kK + 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: diff --git a/nitro-bridge-setup/bridge-vars.example.yml b/nitro-bridge-setup/bridge-vars.example.yml index e23f237..be1b0ad 100644 --- a/nitro-bridge-setup/bridge-vars.example.yml +++ b/nitro-bridge-setup/bridge-vars.example.yml @@ -7,7 +7,7 @@ optimism_url: "" optimism_deployer_pk: "" token_name: "LaconicNetworkToken" token_symbol: "LNT" -intial_token_supply: "129600" +initial_token_supply: "129600" na_address: "" vpa_address: "" ca_address: "" diff --git a/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 b/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 index a75fa0e..9d2fd05 100644 --- a/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 +++ b/nitro-bridge-setup/templates/specs/bridge-nitro-spec.yml.j2 @@ -10,7 +10,7 @@ config: OPTIMISM_DEPLOYER_PK: {{ optimism_deployer_pk }} TOKEN_NAME: {{ token_name }} TOKEN_SYMBOL: {{ token_symbol }} - INITIAL_TOKEN_SUPPLY: {{ intial_token_supply }} + INITIAL_TOKEN_SUPPLY: {{ initial_token_supply }} NA_ADDRESS: "{{ na_address }}" VPA_ADDRESS: "{{ vpa_address }}" CA_ADDRESS: "{{ ca_address }}" diff --git a/nitro-contracts-setup/README.md b/nitro-contracts-setup/README.md index 56ae2c8..9d1b40f 100644 --- a/nitro-contracts-setup/README.md +++ b/nitro-contracts-setup/README.md @@ -29,21 +29,21 @@ The following commands have to be executed in the [`nitro-contracts-setup`](./) # Custom L1 token to be deployed token_name: "LaconicNetworkToken" token_symbol: "LNT" - intial_token_supply: "129600" + initial_token_supply: "129600" ``` - To deploy nitro contracts locally, execute the `deploy-contracts.yml` Ansible playbook: ```bash - LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER + LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK ``` - NOTE: By default, deployments are created in an `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. + NOTE: By default, deployments are created in an `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file - For skipping container build, set `"skip_container_build" : true` in the `--extra-vars` parameter: ```bash - LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER + LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' --user $USER -kK ``` ## Deploy Nitro Contracts on Remote Host @@ -84,12 +84,12 @@ To run the playbook on a remote host: # } ``` -- Copy and edit the [`contract-vars.yml`](./contract-vars.yml) file as described in the Local Setup section +- Copy and edit the [`contract-vars.yml`](./contract-vars.yml) file as described in the [local setup](./README.md#deploy-nitro-contracts-on-local-host) section - Execute the `deploy-contracts.yml` Ansible playbook for remote deployment: ```bash - LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host"}' -kK + 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: diff --git a/nitro-contracts-setup/contract-vars.example.yml b/nitro-contracts-setup/contract-vars.example.yml index 3fe4834..2999432 100644 --- a/nitro-contracts-setup/contract-vars.example.yml +++ b/nitro-contracts-setup/contract-vars.example.yml @@ -3,4 +3,4 @@ geth_chain_id: "" geth_deployer_pk: "" token_name: "" token_symbol: "" -intial_token_supply: "" +initial_token_supply: "" diff --git a/nitro-contracts-setup/templates/specs/nitro-contracts-spec.yml.j2 b/nitro-contracts-setup/templates/specs/nitro-contracts-spec.yml.j2 index 9c2f4ad..c5fb23b 100644 --- a/nitro-contracts-setup/templates/specs/nitro-contracts-spec.yml.j2 +++ b/nitro-contracts-setup/templates/specs/nitro-contracts-spec.yml.j2 @@ -6,7 +6,7 @@ config: GETH_DEPLOYER_PK: {{ geth_deployer_pk }} TOKEN_NAME: {{ token_name }} TOKEN_SYMBOL: {{ token_symbol }} - INITIAL_TOKEN_SUPPLY: {{ intial_token_supply }} + INITIAL_TOKEN_SUPPLY: {{ initial_token_supply }} network: ports: {} volumes: diff --git a/nitro-nodes-setup/README.md b/nitro-nodes-setup/README.md index 2bf819a..1df90ef 100644 --- a/nitro-nodes-setup/README.md +++ b/nitro-nodes-setup/README.md @@ -67,15 +67,15 @@ The following commands have to be executed in [`nitro-nodes-setup`](./) director - To run a nitro node, execute the `run-nitro-nodes.yml` Ansible playbook by running the following command: ```bash - LANG=en_US.utf8 ansible-playbook run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER + LANG=en_US.utf8 ansible-playbook run-nitro-nodes.yml --extra-vars='{ "target_host": "localhost"}' --user $USER -kK ``` - NOTE: By default, deployments are created in a `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file. + NOTE: By default, deployments are created in a `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 hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' -kK --user $USER + LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK ``` ## Run Nitro Node on Remote Host @@ -116,12 +116,12 @@ To run the playbook on a remote host: # } ``` -- Copy and edit the [`nitro-vars.yml`](./nitro-vars.yml) file as described in the Local Setup section +- Copy and edit the [`nitro-vars.yml`](./nitro-vars.yml) file as described in the [local setup](./README.md#run-nitro-node-on-local-host) section - Execute the `run-nitro-nodes.yml` Ansible playbook for remote deployment: ```bash - LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host"}' -kK --user $USER + LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.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: -- 2.45.2 From 1fe219cb1f531d0b7241d023e635b4cda075c574 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Mon, 9 Sep 2024 18:17:50 +0530 Subject: [PATCH 14/14] Separate setup and run sections in READMEs --- l2-setup/README.md | 10 ++++++---- nitro-bridge-setup/README.md | 10 ++++++---- nitro-contracts-setup/README.md | 10 ++++++---- nitro-nodes-setup/README.md | 8 ++++++-- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/l2-setup/README.md b/l2-setup/README.md index 60c7282..64863ae 100644 --- a/l2-setup/README.md +++ b/l2-setup/README.md @@ -4,7 +4,7 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine -## Setup and Run L2 on Local Host +## Setup The following commands have to be executed in the [`l2-setup`](./) directory: @@ -40,6 +40,10 @@ The following commands have to be executed in the [`l2-setup`](./) directory: l1_priv_key: "" ``` +## Run L2 + +### On Local Host + - To setup and run L2 locally, execute the `run-optimism.yml` Ansible playbook: ```bash @@ -64,7 +68,7 @@ The following commands have to be executed in the [`l2-setup`](./) directory: LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{"target_host" : "localhost", "existing_contracts_deployment": true}' --user $USER -kK ``` -## Setup and Run on Remote Host +### On Remote Host To run the playbook on a remote host: @@ -102,8 +106,6 @@ To run the playbook on a remote host: # } ``` -- Copy and edit the `l2-vars.yml` file as described in the [local setup](./README.md#setup-and-run-l2-on-local-host) section - - Execute the `run-optimism.yml` Ansible playbook for remote deployment: ```bash diff --git a/nitro-bridge-setup/README.md b/nitro-bridge-setup/README.md index deec0f0..4f70662 100644 --- a/nitro-bridge-setup/README.md +++ b/nitro-bridge-setup/README.md @@ -4,7 +4,7 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine -## Setup and Run Nitro Bridge on Local Host +## Setup The following commands have to be executed in the [`nitro-bridge-setup`](./) directory: @@ -51,6 +51,10 @@ The following commands have to be executed in the [`nitro-bridge-setup`](./) dir l1_asset_address: "" ``` +## Run Nitro Bridge + +### On Local Host + - To setup and run nitro bridge locally, execute the `run-nitro-bridge.yml` Ansible playbook: ```bash @@ -65,7 +69,7 @@ The following commands have to be executed in the [`nitro-bridge-setup`](./) dir LANG=en_US.utf8 ansible-playbook run-nitro-bridge.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' --user $USER -kK ``` -## Setup and Run Nitro Bridge on Remote Host +### On Remote Host To run the playbook on a remote host: @@ -103,8 +107,6 @@ To run the playbook on a remote host: # } ``` -- Copy and edit the `bridge-vars.yml` file as described in the [local setup](./README.md#setup-and-run-nitro-bridge-on-local-host) section - - Execute the `run-nitro-bridge.yml` Ansible playbook for remote deployment: ```bash diff --git a/nitro-contracts-setup/README.md b/nitro-contracts-setup/README.md index 9d1b40f..6a93e05 100644 --- a/nitro-contracts-setup/README.md +++ b/nitro-contracts-setup/README.md @@ -4,7 +4,7 @@ To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine -## Deploy Nitro Contracts on Local Host +## Setup The following commands have to be executed in the [`nitro-contracts-setup`](./) directory: @@ -32,6 +32,10 @@ The following commands have to be executed in the [`nitro-contracts-setup`](./) initial_token_supply: "129600" ``` +## Deploy Contracts + +### On Local Host + - To deploy nitro contracts locally, execute the `deploy-contracts.yml` Ansible playbook: ```bash @@ -46,7 +50,7 @@ The following commands have to be executed in the [`nitro-contracts-setup`](./) LANG=en_US.utf8 ansible-playbook deploy-contracts.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' --user $USER -kK ``` -## Deploy Nitro Contracts on Remote Host +### On Remote Host To run the playbook on a remote host: @@ -84,8 +88,6 @@ To run the playbook on a remote host: # } ``` -- Copy and edit the [`contract-vars.yml`](./contract-vars.yml) file as described in the [local setup](./README.md#deploy-nitro-contracts-on-local-host) section - - Execute the `deploy-contracts.yml` Ansible playbook for remote deployment: ```bash diff --git a/nitro-nodes-setup/README.md b/nitro-nodes-setup/README.md index 1df90ef..33eb5af 100644 --- a/nitro-nodes-setup/README.md +++ b/nitro-nodes-setup/README.md @@ -12,7 +12,7 @@ To run the playbook on a remote host: - Update / append the [`hosts.ini`](../hosts.ini) file for your remote host with `` set as `nitro_host` -## Run Nitro Node on Local Host +## Setup The following commands have to be executed in [`nitro-nodes-setup`](./) directory @@ -64,6 +64,10 @@ The following commands have to be executed in [`nitro-nodes-setup`](./) director nitro_l2_ext_multiaddr: "" ``` +## Run Nitro Node + +### On Local Host + - To run a nitro node, execute the `run-nitro-nodes.yml` Ansible playbook by running the following command: ```bash @@ -78,7 +82,7 @@ The following commands have to be executed in [`nitro-nodes-setup`](./) director LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK ``` -## Run Nitro Node on Remote Host +### On Remote Host To run the playbook on a remote host: -- 2.45.2