Update READMEs with remote host setup

This commit is contained in:
Adw8 2024-09-09 17:10:13 +05:30
parent c98e41c2cb
commit 566072ff48
5 changed files with 273 additions and 147 deletions

View File

@ -36,44 +36,6 @@
- Reference: <https://udhayakumarc.medium.com/error-ansible-requires-the-locale-encoding-to-be-utf-8-detected-iso8859-1-6da808387f7d>
## 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
[<deployment_host>]
<host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'
```
- Replace `<deployment_host>` with the appropriate host group for the deployment
- Replace `<host_name>` with the alias of your choice
- Replace `<target_ip>` with the IP address or hostname of the target machine
- Replace `<ssh_user>` with the SSH username (e.g., dev, ubuntu)
- Verify that you are able to connect to the host using the following command
```bash
ansible all -m ping -i hosts.ini -k
# Expected output:
# <host_name> | SUCCESS => {
# "ansible_facts": {
# "discovered_interpreter_python": "/usr/bin/python3.10"
# },
# "changed": false,
# "ping": "pong"
# }
```
## Playbooks
- [l2-setup](./l2-setup/README.md)

View File

@ -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 `<deployment_host>` 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
[<deployment_host>]
<host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'
```
- Replace `<deployment_host>` with `l2_host`
- Replace `<host_name>` with the alias of your choice
- Replace `<target_ip>` with the IP address or hostname of the target machine
- Replace `<ssh_user>` with the SSH username (e.g., dev, ubuntu)
- Verify that you are able to connect to the host using the following command
```bash
ansible all -m ping -i hosts.ini -k
# Expected output:
# <host_name> | 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
```

View File

@ -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 `<deployment_host>` 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
[<deployment_host>]
<host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'
```
- Replace `<deployment_host>` with `nitro_host`
- Replace `<host_name>` with the alias of your choice
- Replace `<target_ip>` with the IP address or hostname of the target machine
- Replace `<ssh_user>` with the SSH username (e.g., dev, ubuntu)
- Verify that you are able to connect to the host using the following command
```bash
ansible all -m ping -i hosts.ini -k
# Expected output:
# <host_name> | 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

View File

@ -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 `<deployment_host>` 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
[<deployment_host>]
<host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'
```
- Replace `<deployment_host>` with `nitro_host`
- Replace `<host_name>` with the alias of your choice
- Replace `<target_ip>` with the IP address or hostname of the target machine
- Replace `<ssh_user>` with the SSH username (e.g., dev, ubuntu)
- Verify that you are able to connect to the host using the following command
```bash
ansible all -m ping -i hosts.ini -k
# Expected output:
# <host_name> | 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

View File

@ -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 `<deployment_host>` 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
[<deployment_host>]
<host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'
```
- Replace `<deployment_host>` with `nitro_host`
- Replace `<host_name>` with the alias of your choice
- Replace `<target_ip>` with the IP address or hostname of the target machine
- Replace `<ssh_user>` with the SSH username (e.g., dev, ubuntu)
- Verify that you are able to connect to the host using the following command
```bash
ansible all -m ping -i hosts.ini -k
# Expected output:
# <host_name> | 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