forked from cerc-io/testnet-ops
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94156b85cc | ||
|
|
76adabda96 | ||
|
|
0ca8f94e69 | ||
|
|
8b43dc60a5 | ||
|
|
0dd0aa31c8 | ||
|
|
2f0f5433c6 | ||
|
|
22d6db82dc |
+1
-1
@@ -1 +1 @@
|
||||
hosts.ini
|
||||
nitro-bridge-demo-setup/out
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
- Add location of the directory containing the ansible binary to your `PATH`
|
||||
|
||||
- Set Locale Encoding to `UTF-8`
|
||||
- Optional: 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
|
||||
|
||||
@@ -28,18 +28,14 @@
|
||||
|
||||
- Set the `LANG` variable to en_US.UTF-8:
|
||||
|
||||
```
|
||||
```Copy code
|
||||
LANG="en_US.UTF-8"
|
||||
```
|
||||
|
||||
- Reboot your system or log out and log back in to apply the changes
|
||||
- Reboot your system or log out and log back in to apply the changes.
|
||||
|
||||
- Reference: <https://udhayakumarc.medium.com/error-ansible-requires-the-locale-encoding-to-be-utf-8-detected-iso8859-1-6da808387f7d>
|
||||
|
||||
## Playbooks
|
||||
|
||||
- [stack-orchestrator-setup](./stack-orchestrator-setup/README.md)
|
||||
- [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/README.md)
|
||||
- [nitro-bridge-demo-setup](./nitro-bridge-demo-setup/README.md)
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[deployment_host]
|
||||
<host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'
|
||||
@@ -1,3 +0,0 @@
|
||||
out
|
||||
l2-vars.yml
|
||||
hosts.ini
|
||||
@@ -1,147 +0,0 @@
|
||||
# l2-setup
|
||||
|
||||
## Setup Ansible
|
||||
|
||||
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine
|
||||
|
||||
## Setup
|
||||
|
||||
The following commands have to be executed in the [`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:
|
||||
|
||||
```yaml
|
||||
# L1 chain ID
|
||||
l1_chain_id: ""
|
||||
|
||||
# L1 RPC endpoint
|
||||
l1_rpc: ""
|
||||
|
||||
# L1 RPC endpoint host or IP address
|
||||
l1_host: ""
|
||||
|
||||
# L1 RPC endpoint port number
|
||||
l1_port: ""
|
||||
|
||||
# L1 Beacon endpoint
|
||||
l1_beacon: ""
|
||||
|
||||
# Address of the funded account on L1
|
||||
# Used for optimism contracts deployment
|
||||
l1_address: ""
|
||||
|
||||
# Private key of the funded account on L1
|
||||
l1_priv_key: ""
|
||||
```
|
||||
|
||||
## Run L2
|
||||
|
||||
### On Local Host
|
||||
|
||||
- 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"}' --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
|
||||
|
||||
- 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}' --user $USER -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 run-optimism.yml --extra-vars='{"target_host" : "localhost", "existing_contracts_deployment": true}' --user $USER -kK
|
||||
```
|
||||
|
||||
### 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"
|
||||
# }
|
||||
```
|
||||
|
||||
- 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"}' --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}' --user $USER -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}' --user $USER -kK
|
||||
```
|
||||
|
||||
## Check Deployment Status
|
||||
|
||||
Run the following commands in the directory where the optimism-deployment is created:
|
||||
|
||||
- Follow optimism contracts deployment logs:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir optimism-deployment logs -f fixturenet-optimism-contracts
|
||||
```
|
||||
|
||||
- Check L2 logs:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir optimism-deployment logs -f op-geth
|
||||
|
||||
# Ensure new blocks are getting created
|
||||
```
|
||||
@@ -1,9 +0,0 @@
|
||||
l1_chain_id: ""
|
||||
l1_rpc: ""
|
||||
l1_host: ""
|
||||
l1_port: ""
|
||||
l1_beacon: ""
|
||||
l1_address: ""
|
||||
l1_priv_key: ""
|
||||
proposer_amount: "0.2ether"
|
||||
batcher_amount: "0.1ether"
|
||||
@@ -1,89 +0,0 @@
|
||||
- name: Setup L2 on host
|
||||
hosts: "{{ target_host }}"
|
||||
|
||||
vars_files:
|
||||
- setup-vars.yml
|
||||
- l2-vars.yml
|
||||
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||
|
||||
tasks:
|
||||
- name: Create directory for L2
|
||||
file:
|
||||
path: "{{ l2_directory }}"
|
||||
state: directory
|
||||
|
||||
- name: Change owner of l2-directory
|
||||
file:
|
||||
path: "{{ l2_directory }}"
|
||||
owner: "{{ansible_user}}"
|
||||
group: "{{ansible_user}}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
become: yes
|
||||
|
||||
- name: Clone fixturenet-optimism-stack
|
||||
command: laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-optimism-stack --pull
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Clone required repositories for fixturenet-optimism
|
||||
command: laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism setup-repositories --pull
|
||||
|
||||
- name: Build container images for L2
|
||||
command: laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism build-containers --force-rebuild
|
||||
when: not skip_container_build
|
||||
|
||||
- name: Generate spec file for L2 deployment
|
||||
template:
|
||||
src: "./templates/specs/l2-spec.yml.j2"
|
||||
dest: "{{ l2_directory }}/optimism-spec.yml"
|
||||
|
||||
- name: Check if the deployment directory exists for L2
|
||||
stat:
|
||||
path: "{{ l2_directory }}/optimism-deployment"
|
||||
register: l2_deployment_dir
|
||||
|
||||
- name: Create a deployment from the spec file for L2
|
||||
command: laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy create --spec-file optimism-spec.yml --deployment-dir optimism-deployment
|
||||
args:
|
||||
chdir: "{{ l2_directory }}"
|
||||
when: not l2_deployment_dir.stat.exists
|
||||
|
||||
- name: Generate config.env for L2 deployment
|
||||
template:
|
||||
src: "./templates/configs/l2-config.env.j2"
|
||||
dest: "{{ l2_directory }}/optimism-deployment/config.env"
|
||||
|
||||
- name: Copy deployed contract addresses and configuration files
|
||||
block:
|
||||
- name: Copy l1 deployment file
|
||||
copy:
|
||||
src: "{{ artifact_path }}/l1_deployment/{{ l1_chain_id }}-deploy.json"
|
||||
dest: "{{ l2_directory }}/optimism-deployment/data/l1_deployment"
|
||||
remote_src: "{{ target_host != 'localhost' }}"
|
||||
|
||||
- name: Copy l2 configuration file
|
||||
copy:
|
||||
src: "{{ artifact_path }}/l2_config/{{ l1_chain_id }}.json"
|
||||
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
|
||||
remote_src: "{{ target_host != 'localhost' }}"
|
||||
|
||||
- name: Copy allocs-l2 file
|
||||
copy:
|
||||
src: "{{ artifact_path }}/l2_config/allocs-l2.json"
|
||||
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
|
||||
remote_src: "{{ target_host != 'localhost' }}"
|
||||
|
||||
- name: Copy l2 accounts file
|
||||
copy:
|
||||
src: "{{ artifact_path }}/l2_accounts/accounts.json"
|
||||
dest: "{{ l2_directory }}/optimism-deployment/data/l2_accounts"
|
||||
remote_src: "{{ target_host != 'localhost' }}"
|
||||
|
||||
when: existing_contracts_deployment
|
||||
|
||||
- name: Start L2-deployment
|
||||
command: laconic-so deployment --dir optimism-deployment start
|
||||
args:
|
||||
chdir: "{{ l2_directory }}"
|
||||
@@ -1,4 +0,0 @@
|
||||
skip_container_build: false
|
||||
l2_directory: "out"
|
||||
existing_contracts_deployment: false
|
||||
artifact_path: ""
|
||||
@@ -1,9 +0,0 @@
|
||||
CERC_L1_CHAIN_ID={{ l1_chain_id }}
|
||||
CERC_L1_RPC={{ l1_rpc }}
|
||||
CERC_L1_HOST={{ l1_host }}
|
||||
CERC_L1_PORT={{ l1_port }}
|
||||
CERC_L1_BEACON={{ l1_beacon }}
|
||||
CERC_L1_ADDRESS={{ l1_address }}
|
||||
CERC_L1_PRIV_KEY={{ l1_priv_key }}
|
||||
CERC_PROPOSER_AMOUNT={{ proposer_amount }}
|
||||
CERC_BATCHER_AMOUNT={{ batcher_amount }}
|
||||
@@ -0,0 +1,53 @@
|
||||
# nitro-bridge-demo-setup
|
||||
|
||||
## Setup Ansible
|
||||
|
||||
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine
|
||||
|
||||
## Nitro Bridge Demo
|
||||
|
||||
The following commands have to be executed in [`nitro-bridge-demo-setup`](./) directory
|
||||
|
||||
- To set up the Nitro Bridge Demo, execute the `run-bridge-demo.yml` Ansible playbook by running the following command:
|
||||
|
||||
NOTE: By default, deployments are created in the `nitro-bridge-demo-setup/out` directory. To change this location, update the `nitro_directory` variable in the [vars.yml](./vars.yml) file.
|
||||
|
||||
```bash
|
||||
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-bridge-demo.yml --extra-vars='{ "target_host": "localhost"}' --user $USER
|
||||
```
|
||||
|
||||
- If you want to skip building the containers, set `"skip_container_build" : true` in the `--extra-vars` parameter:
|
||||
|
||||
```bash
|
||||
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-bridge-demo.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER
|
||||
```
|
||||
|
||||
- Follow steps from [Demo](https://git.vdb.to/cerc-io/nitro-stack/src/branch/main/nitro-bridge-demo.md#demo) to create mirror channels on L2, create virtual channel and make payments
|
||||
|
||||
### Reset Demo
|
||||
|
||||
- Run the following command to reset demo:
|
||||
|
||||
```bash
|
||||
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local reset-demo.yml --extra-vars='{"target_host" : "localhost"}' -K --user $USER
|
||||
```
|
||||
|
||||
- Deployments are stopped
|
||||
- Nitro nodes deployment data are removed
|
||||
- Deployments are started again
|
||||
|
||||
- Steps from [Demo](https://git.vdb.to/cerc-io/nitro-stack/src/branch/main/nitro-bridge-demo.md#demo) can be run again
|
||||
|
||||
### Cleanup
|
||||
|
||||
- To stop all deployments, run the `stop-deployments.yml` playbook in the `nitro-stack-demo` directory:
|
||||
|
||||
```bash
|
||||
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local stop-deployments.yml --extra-vars='{"target_host" : "localhost"}' -K --user $USER
|
||||
```
|
||||
|
||||
- If you also want to remove the deployments, set `"remove_deployment_dir" : true` in the `--extra-vars` parameter when running the playbook:
|
||||
|
||||
```bash
|
||||
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local stop-deployments.yml --extra-vars='{"target_host" : "localhost", "remove_deployment_dir" : true}' -K --user $USER
|
||||
```
|
||||
@@ -0,0 +1,90 @@
|
||||
- name: Reset nitro bridge demo
|
||||
|
||||
hosts: "{{ target_host }}"
|
||||
|
||||
vars_files:
|
||||
- vars.yml
|
||||
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}/home/{{ansible_user}}/bin"
|
||||
|
||||
tasks:
|
||||
- name: Stop the deployment for Alice's nitro node on L1
|
||||
command: laconic-so deployment --dir l1alice-nitro-deployment stop --delete-volumes
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Stop the deployment for Charlie's nitro node on L1
|
||||
command: laconic-so deployment --dir l1charlie-nitro-deployment stop --delete-volumes
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Stop the deployment for Alice's nitro node on L2
|
||||
command: laconic-so deployment --dir l2alice-nitro-deployment stop --delete-volumes
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Stop the deployment for Charlie's nitro node on L2
|
||||
command: laconic-so deployment --dir l2charlie-nitro-deployment stop --delete-volumes
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Stop the bridge deployment
|
||||
command: laconic-so deployment --dir bridge-deployment stop --delete-volumes
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Clear the durable store for Alice's nitro node on L1
|
||||
file:
|
||||
path: "{{ nitro_directory }}/l1alice-nitro-deployment/data/nitro_node_data/nitro-store"
|
||||
state: absent
|
||||
become: yes
|
||||
|
||||
- name: Clear the durable store for Charlie's nitro node on L1
|
||||
file:
|
||||
path: "{{ nitro_directory }}/l1charlie-nitro-deployment/data/nitro_node_data/nitro-store"
|
||||
state: absent
|
||||
become: yes
|
||||
|
||||
- name: Clear the durable store for Alice's nitro node on L2
|
||||
file:
|
||||
path: "{{ nitro_directory }}/l2alice-nitro-deployment/data/nitro_node_data/nitro-store"
|
||||
state: absent
|
||||
become: yes
|
||||
|
||||
- name: Clear the durable store for Charlie's nitro node on L2
|
||||
file:
|
||||
path: "{{ nitro_directory }}/l2charlie-nitro-deployment/data/nitro_node_data/nitro-store"
|
||||
state: absent
|
||||
become: yes
|
||||
|
||||
- name: Clear the durable store for the bridge node
|
||||
file:
|
||||
path: "{{ nitro_directory }}/bridge-deployment/data/nitro_bridge_data/bridge-store"
|
||||
state: absent
|
||||
become: yes
|
||||
|
||||
- name: Start the bridge deployment
|
||||
command: laconic-so deployment --dir bridge-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Start the deployment for Alice's nitro node on L1
|
||||
command: laconic-so deployment --dir l1alice-nitro-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Start the deployment for Charlie's nitro node on L1
|
||||
command: laconic-so deployment --dir l1charlie-nitro-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Start the deployment for Alice's nitro node on L2
|
||||
command: laconic-so deployment --dir l2alice-nitro-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Start the deployment for Charlie's nitro node on L2
|
||||
command: laconic-so deployment --dir l2charlie-nitro-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
@@ -0,0 +1,3 @@
|
||||
- import_playbook: setup-optimism.yml
|
||||
- import_playbook: setup-go-nitro.yml
|
||||
- import_playbook: run-stacks.yml
|
||||
@@ -0,0 +1,232 @@
|
||||
- name: Start L1 and L2 stacks
|
||||
hosts: "{{ target_host }}"
|
||||
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||
|
||||
vars_files:
|
||||
- vars.yml
|
||||
|
||||
vars:
|
||||
l1_rpc: "http://fixturenet-eth-geth-1:8545"
|
||||
l2_rpc: "http://op-geth:8545"
|
||||
deployment_context: "1212"
|
||||
account: "0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F"
|
||||
eth_value: "1ether"
|
||||
fixturenet_optimism_dir: "{{ nitro_directory }}/fixturenet-optimism-deployment"
|
||||
fixturenet_eth_dir: "{{ nitro_directory }}/fixturenet-eth-deployment"
|
||||
geth_chain_id: "1212"
|
||||
optimism_chain_id: "42069"
|
||||
|
||||
tasks:
|
||||
- name: Start fixturenet-eth-deployment
|
||||
command: laconic-so deployment --dir fixturenet-eth-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Start fixturenet-optimism-deployment
|
||||
command: laconic-so deployment --dir fixturenet-optimism-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Get the funded accounts from L1
|
||||
command: curl 127.0.0.1:9898/accounts.csv
|
||||
register: accounts_csv
|
||||
- debug:
|
||||
msg: "{{ accounts_csv.stdout }}"
|
||||
|
||||
- name: Read the L1StandardBridgeProxy address from the L1 deployment records
|
||||
command: >
|
||||
laconic-so deployment --dir {{ fixturenet_optimism_dir }} exec op-node
|
||||
"cat /l1-deployment/{{ deployment_context }}-deploy.json | jq -r .L1StandardBridgeProxy"
|
||||
register: bridge_address
|
||||
- debug:
|
||||
msg: "L1StandardBridgeProxy Address: {{ bridge_address.stdout }}"
|
||||
|
||||
- name: Get the funded account's private key from the L2 deployment
|
||||
command: >
|
||||
laconic-so deployment --dir {{ fixturenet_optimism_dir }} exec op-node
|
||||
"jq -r '.AdminKey' /l2-accounts/accounts.json"
|
||||
register: account_pk
|
||||
- debug:
|
||||
msg: "Private Key: {{ account_pk.stdout }}"
|
||||
|
||||
- name: Send ETH from L1 to the bridge contract on L2
|
||||
command: >
|
||||
laconic-so deployment --dir {{ fixturenet_eth_dir }} exec foundry
|
||||
"cast send --from {{ account }} --value {{ eth_value }} {{ bridge_address.stdout }}
|
||||
--rpc-url {{ l1_rpc }} --private-key {{ account_pk.stdout }}"
|
||||
register: send_eth
|
||||
- debug:
|
||||
msg: "Send ETH Command Output: {{ send_eth.stdout }}"
|
||||
|
||||
- name: Wait for the bridge to complete
|
||||
pause:
|
||||
seconds: 20
|
||||
|
||||
- name: Check balance on L2
|
||||
command: >
|
||||
laconic-so deployment --dir {{ fixturenet_eth_dir }} exec foundry
|
||||
"cast balance {{ account }} --rpc-url {{ l2_rpc }}"
|
||||
register: l2_balance
|
||||
- debug:
|
||||
msg: "L2 Balance: {{ l2_balance.stdout }}"
|
||||
|
||||
- name: Copy over spec file for nitro contracts deployment
|
||||
template:
|
||||
src: "./templates/specs/nitro-contracts-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/nitro-contracts-spec.yml"
|
||||
vars:
|
||||
GETH_DEPLOYER_PK: '{{ account_pk.stdout }}'
|
||||
|
||||
- name: Check if deployment exists for nitro contracts
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/nitro-contracts-deployment"
|
||||
register: nitro_contracts_deployment
|
||||
|
||||
- name: Create a deployment for nitro contracts
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts deploy create --spec-file nitro-contracts-spec.yml --deployment-dir nitro-contracts-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not nitro_contracts_deployment.stat.exists
|
||||
|
||||
- name: Start deployment for nitro-contracts
|
||||
command: laconic-so deployment --dir nitro-contracts-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Wait for the contracts to be deployed
|
||||
wait_for:
|
||||
path: "{{ nitro_directory }}/nitro-contracts-deployment/data/nitro_deployment/nitro-addresses.json"
|
||||
timeout: 60
|
||||
|
||||
- name: Export NA_ADDRESS
|
||||
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
register: NA_ADDRESS
|
||||
- debug:
|
||||
msg: "NA_ADDRESS: {{ NA_ADDRESS.stdout }}"
|
||||
|
||||
- name: Export CA_ADDRESS
|
||||
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
register: CA_ADDRESS
|
||||
- debug:
|
||||
msg: "CA_ADDRESS: {{ CA_ADDRESS.stdout }}"
|
||||
|
||||
- name: Export VPA_ADDRESS
|
||||
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
register: VPA_ADDRESS
|
||||
- debug:
|
||||
msg: "VPA_ADDRESS: {{ VPA_ADDRESS.stdout }}"
|
||||
|
||||
- name: Export L1_ASSET_ADDRESS
|
||||
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
register: L1_ASSET_ADDRESS
|
||||
- debug:
|
||||
msg: "L1_ASSET_ADDRESS: {{ L1_ASSET_ADDRESS.stdout }}"
|
||||
|
||||
- name: Copy over spec file for bridge deployment
|
||||
template:
|
||||
src: "./templates/specs/bridge-nitro-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/bridge-nitro-spec.yml"
|
||||
vars:
|
||||
GETH_DEPLOYER_PK: '{{ account_pk.stdout }}'
|
||||
OPTIMISM_DEPLOYER_PK: '{{ account_pk.stdout }}'
|
||||
|
||||
- name: Check if deployment exists for bridge node
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/bridge-deployment"
|
||||
register: bridge_deployment
|
||||
|
||||
- name: Create a deployment for the bridge node
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy create --spec-file bridge-nitro-spec.yml --deployment-dir bridge-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not bridge_deployment.stat.exists
|
||||
|
||||
- name: Start the nitro bridge
|
||||
command: laconic-so deployment --dir bridge-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Set Alice's chain address
|
||||
set_fact:
|
||||
A_CHAIN_ADDRESS: "0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
|
||||
|
||||
- name: Set Charlie's chain address
|
||||
set_fact:
|
||||
C_CHAIN_ADDRESS: "0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
|
||||
|
||||
- name: Send tokens to Alice
|
||||
shell: >
|
||||
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts
|
||||
"cd packages/nitro-protocol && yarn hardhat transfer --contract {{ L1_ASSET_ADDRESS.stdout }} --to {{ A_CHAIN_ADDRESS }} --amount 1000 --network geth"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Send tokens to Charlie
|
||||
shell: >
|
||||
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts
|
||||
"cd packages/nitro-protocol && yarn hardhat transfer --contract {{ L1_ASSET_ADDRESS.stdout }} --to {{ C_CHAIN_ADDRESS }} --amount 1000 --network geth"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Export BRIDGE_ADDRESS
|
||||
shell: laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"{{ optimism_chain_id }}\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
register: BRIDGE_ADDRESS
|
||||
- debug:
|
||||
msg: "BRIDGE_ADDRESS: {{ BRIDGE_ADDRESS.stdout }}"
|
||||
|
||||
- name: Set Private keys
|
||||
set_fact:
|
||||
A_PRIVATE_KEY: "0x9aebbd42f3044295411e3631fcb6aa834ed5373a6d3bf368bfa09e5b74f4f6d1"
|
||||
C_PRIVATE_KEY: "0x19242258fc60ec7488db0163b20ed1c32f2d27dc49e4d427a461e20a6656de20"
|
||||
|
||||
- name: Copy spec file for L1 Alice
|
||||
template:
|
||||
src: "./templates/configs/l1alice-config.env.j2"
|
||||
dest: "{{ nitro_directory }}/l1alice-nitro-deployment/config.env"
|
||||
|
||||
- name: Copy spec file for L1 Charlie
|
||||
template:
|
||||
src: "./templates/configs/l1charlie-config.env.j2"
|
||||
dest: "{{ nitro_directory }}/l1charlie-nitro-deployment/config.env"
|
||||
|
||||
- name: Copy spec file for L2 Alice
|
||||
template:
|
||||
src: "./templates/configs/l2alice-config.env.j2"
|
||||
dest: "{{ nitro_directory }}/l2alice-nitro-deployment/config.env"
|
||||
|
||||
- name: Copy spec file for L2 Charlie
|
||||
template:
|
||||
src: "./templates/configs/l2charlie-config.env.j2"
|
||||
dest: "{{ nitro_directory }}/l2charlie-nitro-deployment/config.env"
|
||||
|
||||
- name: Start deployment for L1 Alice
|
||||
shell: laconic-so deployment --dir l1alice-nitro-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Start deployment for L1 Charlie
|
||||
shell: laconic-so deployment --dir l1charlie-nitro-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Start deployment for L2 Alice
|
||||
shell: laconic-so deployment --dir l2alice-nitro-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Start deployment for L2 Charlie
|
||||
shell: laconic-so deployment --dir l2charlie-nitro-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
@@ -0,0 +1,85 @@
|
||||
- name: Setup go-nitro on host
|
||||
hosts: "{{ target_host }}"
|
||||
|
||||
vars_files:
|
||||
- vars.yml
|
||||
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||
|
||||
tasks:
|
||||
- name: Clone go-nitro stack repo
|
||||
command: laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Clone repositories required for nitro-stack
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node setup-repositories --git-ssh --pull
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Build containers
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild
|
||||
when: not skip_container_build
|
||||
|
||||
- name: Copy over spec file for L1 alice
|
||||
template:
|
||||
src: "./templates/specs/l1-alice-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/l1alice-nitro-spec.yml"
|
||||
|
||||
- name: Copy over spec file for L1 charlie
|
||||
template:
|
||||
src: "./templates/specs/l1-charlie-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/l1charlie-nitro-spec.yml"
|
||||
|
||||
- name: Copy over spec file for L2 alice
|
||||
template:
|
||||
src: "./templates/specs/l2-alice-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/l2alice-nitro-spec.yml"
|
||||
|
||||
- name: Copy over spec file for L2 charlie
|
||||
template:
|
||||
src: "./templates/specs/l2-charlie-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/l2charlie-nitro-spec.yml"
|
||||
|
||||
- name: Check if deployment exists for Alice's L1 nitro node
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/l1alice-nitro-deployment"
|
||||
register: l1alice_deployment
|
||||
|
||||
- name: Create a deployment for Alice's L1 nitro node
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file l1alice-nitro-spec.yml --deployment-dir l1alice-nitro-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not l1alice_deployment.stat.exists
|
||||
|
||||
- name: Check if deployment exists for Charlie's L1 nitro node
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/l1charlie-nitro-deployment"
|
||||
register: l1charlie_deployment
|
||||
|
||||
- name: Create a deployment for Charlie's L1 nitro node
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file l1charlie-nitro-spec.yml --deployment-dir l1charlie-nitro-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not l1charlie_deployment.stat.exists
|
||||
|
||||
- name: Check if deployment exists for Alice's L2 nitro node
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/l2alice-nitro-deployment"
|
||||
register: l2alice_deployment
|
||||
|
||||
- name: Create a deployment for Alice's L2 nitro node
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file l2alice-nitro-spec.yml --deployment-dir l2alice-nitro-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not l2alice_deployment.stat.exists
|
||||
|
||||
- name: Check if deployment exists for Charlie's L2 nitro node
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/l2charlie-nitro-deployment"
|
||||
register: l2charlie_deployment
|
||||
|
||||
- name: Create a deployment for Charlie's L2 nitro node
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file l2charlie-nitro-spec.yml --deployment-dir l2charlie-nitro-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not l2charlie_deployment.stat.exists
|
||||
@@ -0,0 +1,105 @@
|
||||
- name: Setup L1 and L2 optimism on remote host
|
||||
hosts: "{{ target_host }}"
|
||||
|
||||
vars_files:
|
||||
- vars.yml
|
||||
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||
|
||||
tasks:
|
||||
- name: Create directory for nitro-stack
|
||||
file:
|
||||
path: "{{ nitro_directory }}"
|
||||
state: directory
|
||||
|
||||
- name: Change owner of nitro-directory
|
||||
file:
|
||||
path: "{{ nitro_directory }}"
|
||||
owner: "{{ansible_user}}"
|
||||
group: "{{ansible_user}}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
|
||||
- name: Clone fixturenet-eth-stack
|
||||
command: laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-eth-stacks --pull
|
||||
|
||||
- name: Clone fixturenet-optimism-stack
|
||||
command: laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-optimism-stack --pull
|
||||
ignore_errors: true
|
||||
|
||||
- name: Clone required repositories for fixturenet-eth
|
||||
command: laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth setup-repositories --pull
|
||||
|
||||
- name: Clone required repositories for fixturenet-optimism
|
||||
command: laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism setup-repositories --pull
|
||||
ignore_errors: true
|
||||
|
||||
- name: Remove any older foundary image with 'latest' tag
|
||||
docker_image:
|
||||
name: "ghcr.io/foundry-rs/foundry"
|
||||
state: absent
|
||||
tag: latest
|
||||
|
||||
- name: Build container images for L1
|
||||
command: laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth build-containers --force-rebuild
|
||||
when: not skip_container_build
|
||||
|
||||
- name: Build container images for L2
|
||||
command: laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism build-containers --force-rebuild
|
||||
when: not skip_container_build
|
||||
|
||||
- name: Remove any dangling docker images
|
||||
command: docker image prune -f
|
||||
|
||||
- name: Copy over spec file for L1 deployment
|
||||
template:
|
||||
src: "./templates/specs/l1-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/fixturenet-eth-spec.yml"
|
||||
|
||||
- name: Copy over spec file for L2 deployment
|
||||
template:
|
||||
src: "./templates/specs/l2-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/fixturenet-optimism-spec.yml"
|
||||
|
||||
- name: Check if the deployment directory exists for L1
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/fixturenet-eth-deployment"
|
||||
register: l1_deployment_dir
|
||||
|
||||
- name: Create a deployment from the spec file for L1
|
||||
command: laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth deploy create --spec-file fixturenet-eth-spec.yml --deployment-dir fixturenet-eth-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not l1_deployment_dir.stat.exists
|
||||
|
||||
- name: Check if the deployment directory exists for L2
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/fixturenet-optimism-deployment"
|
||||
register: l2_deployment_dir
|
||||
|
||||
- name: Create a deployment from the spec file for L2
|
||||
command: laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy create --spec-file fixturenet-optimism-spec.yml --deployment-dir fixturenet-optimism-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not l2_deployment_dir.stat.exists
|
||||
|
||||
- name: Place both deployments in the same namespace
|
||||
copy:
|
||||
src: "{{ nitro_directory }}/fixturenet-eth-deployment/deployment.yml"
|
||||
dest: "{{ nitro_directory }}/fixturenet-optimism-deployment/deployment.yml"
|
||||
remote_src: "{{ target_host != 'localhost' }}"
|
||||
|
||||
- name: Check if the config.env file is empty
|
||||
shell: "[ -s '{{ nitro_directory }}/fixturenet-eth-deployment/config.env' ] && echo 'File is not empty' || echo 'File is empty'"
|
||||
register: file_check_result
|
||||
|
||||
- name: Display the result of the file check
|
||||
debug:
|
||||
msg: "{{ file_check_result.stdout }}"
|
||||
|
||||
- name: Copy config.env for fixturenet eth deployment if it is empty
|
||||
template:
|
||||
src: "./templates/configs/eth-config.env"
|
||||
dest: "{{ nitro_directory }}/fixturenet-eth-deployment/config.env"
|
||||
when: file_check_result.stdout == 'File is empty'
|
||||
@@ -0,0 +1,57 @@
|
||||
- name: Stop and cleanup deployments for nitro bridge demo
|
||||
|
||||
hosts: "{{ target_host }}"
|
||||
|
||||
vars_files:
|
||||
- vars.yml
|
||||
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}/home/{{ansible_user}}/bin"
|
||||
|
||||
tasks:
|
||||
- name: Stop the deployment for Alice's nitro node on L1
|
||||
command: laconic-so deployment --dir l1alice-nitro-deployment stop {{ '--delete-volumes' if remove_deployment_dir else '' }}
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Stop the deployment for Charlie's nitro node on L1
|
||||
command: laconic-so deployment --dir l1charlie-nitro-deployment stop {{ '--delete-volumes' if remove_deployment_dir else '' }}
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Stop the deployment for Alice's nitro node on L2
|
||||
command: laconic-so deployment --dir l2alice-nitro-deployment stop {{ '--delete-volumes' if remove_deployment_dir else '' }}
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Stop the deployment for Charlie's nitro node on L2
|
||||
command: laconic-so deployment --dir l2charlie-nitro-deployment stop {{ '--delete-volumes' if remove_deployment_dir else '' }}
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Stop the bridge deployment
|
||||
command: laconic-so deployment --dir bridge-deployment stop {{ '--delete-volumes' if remove_deployment_dir else '' }}
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Stop the nitro-contracts deployment
|
||||
command: laconic-so deployment --dir nitro-contracts-deployment stop {{ '--delete-volumes' if remove_deployment_dir else '' }}
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Stop the deployment for fixturenet optimism
|
||||
command: laconic-so deployment --dir fixturenet-optimism-deployment stop {{ '--delete-volumes' if remove_deployment_dir else '' }}
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Stop the deployment for fixturenet eth
|
||||
command: laconic-so deployment --dir fixturenet-eth-deployment stop {{ '--delete-volumes' if remove_deployment_dir else '' }}
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Remove the deployment directory
|
||||
file:
|
||||
path: "{{ nitro_directory }}"
|
||||
state: absent
|
||||
when: remove_deployment_dir
|
||||
become: yes
|
||||
@@ -0,0 +1,3 @@
|
||||
# To allow optimism contracts deployment
|
||||
|
||||
CERC_ALLOW_UNPROTECTED_TXS=true
|
||||
@@ -0,0 +1,9 @@
|
||||
NITRO_CHAIN_URL=ws://host.docker.internal:8546
|
||||
NITRO_SC_PK={{ A_PRIVATE_KEY }}
|
||||
NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
|
||||
NA_ADDRESS={{ NA_ADDRESS.stdout }}
|
||||
VPA_ADDRESS={{ VPA_ADDRESS.stdout }}
|
||||
CA_ADDRESS={{ CA_ADDRESS.stdout }}
|
||||
BRIDGE_ADDRESS={{ BRIDGE_ADDRESS.stdout }}
|
||||
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
|
||||
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3007
|
||||
@@ -0,0 +1,9 @@
|
||||
NITRO_CHAIN_URL=ws://host.docker.internal:8546
|
||||
NITRO_SC_PK={{ C_PRIVATE_KEY }}
|
||||
NITRO_CHAIN_PK=111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f
|
||||
NA_ADDRESS={{ NA_ADDRESS.stdout }}
|
||||
VPA_ADDRESS={{ VPA_ADDRESS.stdout }}
|
||||
CA_ADDRESS={{ CA_ADDRESS.stdout }}
|
||||
BRIDGE_ADDRESS={{ BRIDGE_ADDRESS.stdout }}
|
||||
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
|
||||
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3008
|
||||
@@ -0,0 +1,10 @@
|
||||
NITRO_CHAIN_URL=ws://host.docker.internal:9546
|
||||
NITRO_SC_PK={{ A_PRIVATE_KEY }}
|
||||
NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
|
||||
NA_ADDRESS={{ NA_ADDRESS.stdout }}
|
||||
VPA_ADDRESS={{ VPA_ADDRESS.stdout }}
|
||||
CA_ADDRESS={{ CA_ADDRESS.stdout }}
|
||||
BRIDGE_ADDRESS={{ BRIDGE_ADDRESS.stdout }}
|
||||
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
|
||||
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3009
|
||||
NITRO_L2=true
|
||||
@@ -0,0 +1,10 @@
|
||||
NITRO_CHAIN_URL=ws://host.docker.internal:9546
|
||||
NITRO_SC_PK={{ C_PRIVATE_KEY }}
|
||||
NITRO_CHAIN_PK=111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f
|
||||
NA_ADDRESS={{ NA_ADDRESS.stdout }}
|
||||
VPA_ADDRESS={{ VPA_ADDRESS.stdout }}
|
||||
CA_ADDRESS={{ CA_ADDRESS.stdout }}
|
||||
BRIDGE_ADDRESS={{ BRIDGE_ADDRESS.stdout }}
|
||||
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
|
||||
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3010
|
||||
NITRO_L2=true
|
||||
@@ -0,0 +1,28 @@
|
||||
stack: /home/{{ ansible_user }}/cerc/nitro-stack/stack-orchestrator/stacks/bridge
|
||||
deploy-to: compose
|
||||
config:
|
||||
NITRO_L1_CHAIN_URL: ws://host.docker.internal:8546
|
||||
NITRO_L2_CHAIN_URL: ws://host.docker.internal:9546
|
||||
NITRO_CHAIN_PK: 888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218
|
||||
NITRO_SC_PK: 0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4
|
||||
OPTIMISM_URL: http://host.docker.internal:9545
|
||||
OPTIMISM_DEPLOYER_PK: '{{ OPTIMISM_DEPLOYER_PK }}'
|
||||
OPTIMISM_CHAIN_ID: '{{ optimism_chain_id }}'
|
||||
TOKEN_NAME: LaconicNetworkToken
|
||||
TOKEN_SYMBOL: LNT
|
||||
INITIAL_TOKEN_SUPPLY: '129600'
|
||||
NA_ADDRESS: '{{ NA_ADDRESS.stdout }}'
|
||||
VPA_ADDRESS: '{{ VPA_ADDRESS.stdout }}'
|
||||
CA_ADDRESS: '{{ CA_ADDRESS.stdout }}'
|
||||
L1_ASSET_ADDRESS: '{{ L1_ASSET_ADDRESS.stdout }}'
|
||||
network:
|
||||
ports:
|
||||
nitro-bridge:
|
||||
- 0.0.0.0:3005:3005
|
||||
- 0.0.0.0:3006:3006
|
||||
- 0.0.0.0:4006:4006
|
||||
volumes:
|
||||
nitro_bridge_data: ./data/nitro_bridge_data
|
||||
nitro_bridge_tls: ./data/nitro_bridge_tls
|
||||
nitro_node_caroot: ./data/nitro_node_caroot
|
||||
nitro_deployment: ./data/nitro_deployment
|
||||
@@ -0,0 +1,11 @@
|
||||
stack: /home/{{ansible_user}}/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node
|
||||
deploy-to: compose
|
||||
network:
|
||||
ports:
|
||||
nitro-node:
|
||||
- 3008:3005
|
||||
- 4008:4005
|
||||
volumes:
|
||||
nitro_node_data: ./data/nitro_node_data
|
||||
nitro_node_tls: ./data/nitro_node_tls
|
||||
nitro_node_caroot: ./data/nitro_node_caroot
|
||||
@@ -0,0 +1,20 @@
|
||||
stack: /home/{{ansible_user}}/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth
|
||||
deploy-to: compose
|
||||
network:
|
||||
ports:
|
||||
fixturenet-eth-bootnode-geth:
|
||||
- '9898:9898'
|
||||
- '30303'
|
||||
fixturenet-eth-geth-1:
|
||||
- '8545:8545'
|
||||
- '8546:8546'
|
||||
- '40000'
|
||||
- '6060'
|
||||
fixturenet-eth-lighthouse-1:
|
||||
- '8001'
|
||||
volumes:
|
||||
fixturenet_eth_bootnode_geth_data: ./data/fixturenet_eth_bootnode_geth_data
|
||||
fixturenet_eth_geth_1_data: ./data/fixturenet_eth_geth_1_data
|
||||
fixturenet_eth_geth_2_data: ./data/fixturenet_eth_geth_2_data
|
||||
fixturenet_eth_lighthouse_1_data: ./data/fixturenet_eth_lighthouse_1_data
|
||||
fixturenet_eth_lighthouse_2_data: ./data/fixturenet_eth_lighthouse_2_data
|
||||
@@ -0,0 +1,11 @@
|
||||
stack: /home/{{ansible_user}}/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node
|
||||
deploy-to: compose
|
||||
network:
|
||||
ports:
|
||||
nitro-node:
|
||||
- 3010:3005
|
||||
- 4010:4005
|
||||
volumes:
|
||||
nitro_node_data: ./data/nitro_node_data
|
||||
nitro_node_tls: ./data/nitro_node_tls
|
||||
nitro_node_caroot: ./data/nitro_node_caroot
|
||||
@@ -0,0 +1,12 @@
|
||||
stack: /home/{{ ansible_user }}/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts
|
||||
deploy-to: compose
|
||||
config:
|
||||
GETH_URL: http://host.docker.internal:8545
|
||||
GETH_DEPLOYER_PK: '{{ GETH_DEPLOYER_PK }}'
|
||||
TOKEN_NAME: LaconicNetworkToken
|
||||
TOKEN_SYMBOL: LNT
|
||||
INITIAL_TOKEN_SUPPLY: '129600'
|
||||
network:
|
||||
ports: {}
|
||||
volumes:
|
||||
nitro_deployment: ./data/nitro_deployment
|
||||
@@ -1,3 +1,4 @@
|
||||
target_host: "localhost"
|
||||
nitro_directory: out
|
||||
nitro_directory: ./out
|
||||
skip_container_build: false
|
||||
remove_deployment_dir: false
|
||||
@@ -1,3 +0,0 @@
|
||||
out
|
||||
bridge-vars.yml
|
||||
hosts.ini
|
||||
@@ -1,140 +0,0 @@
|
||||
# nitro-bridge-setup
|
||||
|
||||
## Setup Ansible
|
||||
|
||||
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine
|
||||
|
||||
## Setup
|
||||
|
||||
The following commands have to be executed in the [`nitro-bridge-setup`](./) directory:
|
||||
|
||||
- Copy the `bridge-vars.example.yml` vars file:
|
||||
|
||||
```bash
|
||||
cp bridge-vars.example.yml bridge-vars.yml
|
||||
```
|
||||
|
||||
- Edit [`bridge-vars.yml`](./bridge-vars.yml) with the required values:
|
||||
|
||||
```yaml
|
||||
# L1 WS endpoint
|
||||
nitro_l1_chain_url: ""
|
||||
|
||||
# L2 WS endpoint
|
||||
nitro_l2_chain_url: ""
|
||||
|
||||
# Private key for the bridge's nitro address
|
||||
nitro_sc_pk: ""
|
||||
|
||||
# Private key for a funded account on L1
|
||||
# This account should have tokens for funding Nitro channels
|
||||
nitro_chain_pk: ""
|
||||
|
||||
# L2 chain ID
|
||||
optimism_chain_id: ""
|
||||
|
||||
# L2 RPC endpoint
|
||||
optimism_url: ""
|
||||
|
||||
# Custom L2 token to be deployed
|
||||
token_name: "LaconicNetworkToken"
|
||||
token_symbol: "LNT"
|
||||
initial_token_supply: "129600"
|
||||
|
||||
# Addresses of the deployed nitro contracts
|
||||
na_address: ""
|
||||
vpa_address: ""
|
||||
ca_address: ""
|
||||
|
||||
# Address of deployed custom L1 token
|
||||
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
|
||||
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 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}' --user $USER -kK
|
||||
```
|
||||
|
||||
### 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 `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"
|
||||
# }
|
||||
```
|
||||
|
||||
- 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"}' --user $USER -kK
|
||||
```
|
||||
|
||||
- For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter:
|
||||
|
||||
```bash
|
||||
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK
|
||||
```
|
||||
|
||||
## Check Deployment Status
|
||||
|
||||
- Run the following command in the directory where the bridge-deployment is created:
|
||||
|
||||
- Check logs for deployments:
|
||||
|
||||
```bash
|
||||
# Check the bridge deployment logs, ensure that the node is running
|
||||
laconic-so deployment --dir bridge-deployment logs nitro-bridge -f
|
||||
```
|
||||
|
||||
## Get Contract Addresses
|
||||
|
||||
- Run the following commands in the directory where the deployments are created:
|
||||
|
||||
- Get addresses of L2 nitro contracts:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir bridge-deployment exec nitro-bridge "cat /app/deployment/nitro-addresses.json"
|
||||
```
|
||||
@@ -1,13 +0,0 @@
|
||||
nitro_l1_chain_url: ""
|
||||
nitro_l2_chain_url: ""
|
||||
nitro_chain_pk: ""
|
||||
nitro_sc_pk: ""
|
||||
optimism_chain_id: ""
|
||||
optimism_url: ""
|
||||
token_name: "LaconicNetworkToken"
|
||||
token_symbol: "LNT"
|
||||
initial_token_supply: "129600"
|
||||
na_address: ""
|
||||
vpa_address: ""
|
||||
ca_address: ""
|
||||
l1_asset_address: ""
|
||||
@@ -1,73 +0,0 @@
|
||||
- name: Setup go-nitro on host
|
||||
hosts: "{{ target_host }}"
|
||||
|
||||
vars_files:
|
||||
- setup-vars.yml
|
||||
- bridge-vars.yml
|
||||
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||
|
||||
tasks:
|
||||
- name: Create directory for nitro bridge deployment
|
||||
file:
|
||||
path: "{{ nitro_directory }}"
|
||||
state: directory
|
||||
become: yes
|
||||
|
||||
- name: Clone go-nitro stack repo
|
||||
command: laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Change owner of nitro-directory
|
||||
file:
|
||||
path: "{{ nitro_directory }}"
|
||||
owner: "{{ansible_user}}"
|
||||
group: "{{ansible_user}}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
become: yes
|
||||
|
||||
- name: Clone repositories required for nitro-stack
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge setup-repositories --git-ssh --pull
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Build containers
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge build-containers --force-rebuild
|
||||
when: not skip_container_build
|
||||
|
||||
- name: Check if deployment exists for bridge node
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/bridge-deployment"
|
||||
register: bridge_deployment
|
||||
|
||||
- name: Generate spec file for bridge deployment
|
||||
template:
|
||||
src: "./templates/specs/bridge-nitro-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/bridge-nitro-spec.yml"
|
||||
when: not bridge_deployment.stat.exists
|
||||
|
||||
- name: Create a deployment for the bridge node
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy create --spec-file bridge-nitro-spec.yml --deployment-dir bridge-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not bridge_deployment.stat.exists
|
||||
|
||||
- name: Start the nitro bridge
|
||||
command: laconic-so deployment --dir bridge-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Wait for nitro-addresses.json to be created
|
||||
wait_for:
|
||||
path: "{{ nitro_directory }}/bridge-deployment/data/nitro_deployment/nitro-addresses.json"
|
||||
state: present
|
||||
timeout: 180
|
||||
|
||||
- name: Print BRIDGE_ADDRESS
|
||||
shell: laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"{{ optimism_chain_id }}\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
register: bridge_address
|
||||
- debug:
|
||||
msg: "BRIDGE_ADDRESS: {{ bridge_address.stdout }}"
|
||||
@@ -1,28 +0,0 @@
|
||||
stack: /home/{{ ansible_user }}/cerc/nitro-stack/stack-orchestrator/stacks/bridge
|
||||
deploy-to: compose
|
||||
config:
|
||||
NITRO_L1_CHAIN_URL: {{ nitro_l1_chain_url }}
|
||||
NITRO_L2_CHAIN_URL: {{ nitro_l2_chain_url }}
|
||||
NITRO_CHAIN_PK: {{ nitro_chain_pk }}
|
||||
NITRO_SC_PK: {{ nitro_sc_pk }}
|
||||
OPTIMISM_CHAIN_ID: {{ optimism_chain_id }}
|
||||
OPTIMISM_URL: {{ optimism_url }}
|
||||
OPTIMISM_DEPLOYER_PK: {{ nitro_chain_pk }}
|
||||
TOKEN_NAME: {{ token_name }}
|
||||
TOKEN_SYMBOL: {{ token_symbol }}
|
||||
INITIAL_TOKEN_SUPPLY: {{ initial_token_supply }}
|
||||
NA_ADDRESS: "{{ na_address }}"
|
||||
VPA_ADDRESS: "{{ vpa_address }}"
|
||||
CA_ADDRESS: "{{ ca_address }}"
|
||||
L1_ASSET_ADDRESS: "{{ l1_asset_address }}"
|
||||
network:
|
||||
ports:
|
||||
nitro-bridge:
|
||||
- 0.0.0.0:3005:3005
|
||||
- 0.0.0.0:3006:3006
|
||||
- 0.0.0.0:4005:4005
|
||||
volumes:
|
||||
nitro_bridge_data: ./data/nitro_bridge_data
|
||||
nitro_bridge_tls: ./data/nitro_bridge_tls
|
||||
nitro_node_caroot: ./data/nitro_node_caroot
|
||||
nitro_deployment: ./data/nitro_deployment
|
||||
@@ -1,3 +0,0 @@
|
||||
out
|
||||
contract-vars.yml
|
||||
hosts.ini
|
||||
@@ -1,122 +0,0 @@
|
||||
# nitro-contracts-setup
|
||||
|
||||
## Setup Ansible
|
||||
|
||||
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine
|
||||
|
||||
## Setup
|
||||
|
||||
The following commands have to be executed in the [`nitro-contracts-setup`](./) directory:
|
||||
|
||||
- Copy the `contract-vars.example.yml` vars file
|
||||
|
||||
```bash
|
||||
cp contract-vars.example.yml contract-vars.yml
|
||||
```
|
||||
|
||||
- Edit [`contract-vars.yml`](./contract-vars.yml) and fill in the following values
|
||||
|
||||
```bash
|
||||
# L1 RPC endpoint
|
||||
geth_url: ""
|
||||
|
||||
# L1 chain ID
|
||||
geth_chain_id: ""
|
||||
|
||||
# Private key for a funded account on L1 to use for contracts deployment on L1
|
||||
geth_deployer_pk: ""
|
||||
|
||||
# Custom L1 token to be deployed
|
||||
token_name: "LaconicNetworkToken"
|
||||
token_symbol: "LNT"
|
||||
initial_token_supply: "129600"
|
||||
```
|
||||
|
||||
## Deploy Contracts
|
||||
|
||||
### On Local Host
|
||||
|
||||
- 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"}' --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 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}' --user $USER -kK
|
||||
```
|
||||
|
||||
### 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 `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"
|
||||
# }
|
||||
```
|
||||
|
||||
- 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"}' --user $USER -kK
|
||||
```
|
||||
|
||||
- For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter:
|
||||
|
||||
```bash
|
||||
LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK
|
||||
```
|
||||
|
||||
## Check Deployment Status
|
||||
|
||||
- Run the following command in the directory where the nitro-contracts-deployment is created:
|
||||
|
||||
- Check logs for deployments:
|
||||
|
||||
```bash
|
||||
# Check the L2 nitro contract deployment logs
|
||||
laconic-so deployment --dir nitro-contracts-deployment logs l2-nitro-contracts -f
|
||||
```
|
||||
|
||||
## Get Contract Addresses
|
||||
|
||||
- Run the following commands in the directory where the deployments are created:
|
||||
|
||||
- Get addresses of L1 nitro contracts:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cat /app/deployment/nitro-addresses.json"
|
||||
```
|
||||
@@ -1,6 +0,0 @@
|
||||
geth_url: ""
|
||||
geth_chain_id: ""
|
||||
geth_deployer_pk: ""
|
||||
token_name: ""
|
||||
token_symbol: ""
|
||||
initial_token_supply: ""
|
||||
@@ -1,96 +0,0 @@
|
||||
- name: Deploy nitro contracts
|
||||
hosts: "{{ target_host }}"
|
||||
|
||||
vars_files:
|
||||
- setup-vars.yml
|
||||
- contract-vars.yml
|
||||
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||
|
||||
tasks:
|
||||
- name: Create directory for nitro bridge deployment
|
||||
file:
|
||||
path: "{{ nitro_directory }}"
|
||||
state: directory
|
||||
become: yes
|
||||
|
||||
- name: Clone go-nitro stack repo
|
||||
command: laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Change owner of nitro-directory
|
||||
file:
|
||||
path: "{{ nitro_directory }}"
|
||||
owner: "{{ansible_user}}"
|
||||
group: "{{ansible_user}}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
become: yes
|
||||
|
||||
- name: Clone repositories required for nitro-stack
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge setup-repositories --git-ssh --pull
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Build containers
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge build-containers --force-rebuild
|
||||
when: not skip_container_build
|
||||
|
||||
- name: Generate spec file for nitro contracts deployment
|
||||
template:
|
||||
src: "./templates/specs/nitro-contracts-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/nitro-contracts-spec.yml"
|
||||
|
||||
- name: Check if deployment exists for nitro contracts
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/nitro-contracts-deployment"
|
||||
register: nitro_contracts_deployment
|
||||
become: yes
|
||||
|
||||
- name: Create a deployment for nitro contracts
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts deploy create --spec-file nitro-contracts-spec.yml --deployment-dir nitro-contracts-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not nitro_contracts_deployment.stat.exists
|
||||
|
||||
- name: Start deployment for nitro-contracts
|
||||
command: laconic-so deployment --dir nitro-contracts-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Wait for the contracts to be deployed
|
||||
wait_for:
|
||||
path: "{{ nitro_directory }}/nitro-contracts-deployment/data/nitro_deployment/nitro-addresses.json"
|
||||
timeout: 300
|
||||
|
||||
- name: Export NA_ADDRESS
|
||||
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
register: na_address
|
||||
- debug:
|
||||
msg: "NA_ADDRESS: {{ na_address.stdout }}"
|
||||
|
||||
- name: Export CA_ADDRESS
|
||||
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
register: ca_address
|
||||
- debug:
|
||||
msg: "CA_ADDRESS: {{ ca_address.stdout }}"
|
||||
|
||||
- name: Export VPA_ADDRESS
|
||||
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
register: vpa_address
|
||||
- debug:
|
||||
msg: "VPA_ADDRESS: {{ vpa_address.stdout }}"
|
||||
|
||||
- name: Export L1_ASSET_ADDRESS
|
||||
shell: laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json"
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
register: l1_asset_address
|
||||
- debug:
|
||||
msg: "L1_ASSET_ADDRESS: {{ l1_asset_address.stdout }}"
|
||||
@@ -1,3 +0,0 @@
|
||||
target_host: "localhost"
|
||||
nitro_directory: out
|
||||
skip_container_build: false
|
||||
@@ -1,13 +0,0 @@
|
||||
stack: /home/{{ ansible_user }}/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts
|
||||
deploy-to: compose
|
||||
config:
|
||||
GETH_URL: {{ geth_url }}
|
||||
GETH_CHAIN_ID: {{ geth_chain_id }}
|
||||
GETH_DEPLOYER_PK: {{ geth_deployer_pk }}
|
||||
TOKEN_NAME: {{ token_name }}
|
||||
TOKEN_SYMBOL: {{ token_symbol }}
|
||||
INITIAL_TOKEN_SUPPLY: {{ initial_token_supply }}
|
||||
network:
|
||||
ports: {}
|
||||
volumes:
|
||||
nitro_deployment: ./data/nitro_deployment
|
||||
@@ -1,3 +0,0 @@
|
||||
out
|
||||
nitro-vars.yml
|
||||
hosts.ini
|
||||
@@ -1,152 +0,0 @@
|
||||
# nitro-nodes-setup
|
||||
|
||||
## Setup Ansible
|
||||
|
||||
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine
|
||||
|
||||
## Setup for Remote 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`
|
||||
|
||||
## Setup
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
- Edit [`nitro-vars.yml`](./nitro-vars.yml) and fill in the following values
|
||||
|
||||
```bash
|
||||
# L1 WS endpoint
|
||||
nitro_l1_chain_url: ""
|
||||
|
||||
# L2 WS endpoint
|
||||
nitro_l2_chain_url: ""
|
||||
|
||||
# Private key for your nitro address
|
||||
nitro_sc_pk: ""
|
||||
|
||||
# Private key of the account on chain that is used for funding channels in Nitro node
|
||||
nitro_chain_pk: ""
|
||||
|
||||
# Contract address of NitroAdjudicator
|
||||
na_address: ""
|
||||
|
||||
# Contract address of VirtualPaymentApp
|
||||
vpa_address: ""
|
||||
|
||||
# Contract address of ConsensusApp
|
||||
ca_address: ""
|
||||
|
||||
# Address of the bridge node
|
||||
bridge_contract_address: ""
|
||||
|
||||
# Multiaddr of the L1 bridge node
|
||||
nitro_l1_bridge_multiaddr: ""
|
||||
|
||||
# Multiaddr of the L2 bridge node
|
||||
nitro_l2_bridge_multiaddr: ""
|
||||
|
||||
# Multiaddr with publically accessible IP address / DNS for your L1 nitro node
|
||||
# Example: "/ip4/192.168.x.y/tcp/3009"
|
||||
# Example: "/dns4/example.com/tcp/3009"
|
||||
nitro_l1_ext_multiaddr: ""
|
||||
|
||||
# Multiaddr with publically accessible IP address / DNS for your L2 nitro node
|
||||
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
|
||||
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
|
||||
|
||||
- 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
|
||||
```
|
||||
|
||||
### 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 `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](./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"}' --user $USER -kK
|
||||
```
|
||||
|
||||
- For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter:
|
||||
|
||||
```bash
|
||||
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK
|
||||
```
|
||||
|
||||
|
||||
## Check Deployment Status
|
||||
|
||||
- Run the following command in the directory where the deployments are created
|
||||
|
||||
- Check L1 nitro node logs:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir l1-nitro-deployment logs nitro-node -f
|
||||
```
|
||||
|
||||
- Check L2 nitro node logs:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir l2-nitro-deployment logs nitro-node -f
|
||||
```
|
||||
@@ -1,12 +0,0 @@
|
||||
nitro_l1_chain_url: ""
|
||||
nitro_l2_chain_url: ""
|
||||
nitro_sc_pk: ""
|
||||
nitro_chain_pk: ""
|
||||
na_address: ""
|
||||
vpa_address: ""
|
||||
ca_address: ""
|
||||
bridge_contract_address: ""
|
||||
nitro_l1_bridge_multiaddr: ""
|
||||
nitro_l2_bridge_multiaddr: ""
|
||||
nitro_l1_ext_multiaddr: ""
|
||||
nitro_l2_ext_multiaddr: ""
|
||||
@@ -1,105 +0,0 @@
|
||||
- name: Setup and run nitro nodes
|
||||
hosts: "{{ target_host }}"
|
||||
|
||||
vars_files:
|
||||
- setup-vars.yml
|
||||
- nitro-vars.yml
|
||||
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||
|
||||
tasks:
|
||||
- name: Create directory for nitro-stack
|
||||
file:
|
||||
path: "{{ nitro_directory }}"
|
||||
state: directory
|
||||
|
||||
- name: Change owner of nitro-directory
|
||||
file:
|
||||
path: "{{ nitro_directory }}"
|
||||
owner: "{{ansible_user}}"
|
||||
group: "{{ansible_user}}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
|
||||
- name: Clone go-nitro stack repo
|
||||
command: laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Clone repositories required for nitro-stack
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node setup-repositories --git-ssh --pull
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Build containers
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild
|
||||
when: not skip_container_build
|
||||
|
||||
- name: Generate spec file for L1 nitro node
|
||||
template:
|
||||
src: "./templates/specs/l1-nitro-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/l1-nitro-spec.yml"
|
||||
|
||||
- name: Generate spec file for L2 nitro node
|
||||
template:
|
||||
src: "./templates/specs/l2-nitro-spec.yml.j2"
|
||||
dest: "{{ nitro_directory }}/l2-nitro-spec.yml"
|
||||
|
||||
- name: Check if deployment exists for L1 nitro node
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/l1-nitro-deployment"
|
||||
register: l1_deployment
|
||||
|
||||
- name: Create a deployment for L1 nitro node
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file l1-nitro-spec.yml --deployment-dir l1-nitro-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not l1_deployment.stat.exists
|
||||
|
||||
- name: Check if deployment exists for L2 nitro node
|
||||
stat:
|
||||
path: "{{ nitro_directory }}/l2-nitro-deployment"
|
||||
register: l2_deployment
|
||||
|
||||
- name: Create a deployment for L2 nitro node
|
||||
command: laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file l2-nitro-spec.yml --deployment-dir l2-nitro-deployment
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
when: not l2_deployment.stat.exists
|
||||
|
||||
- name: Check if the config.env file is empty for L1 deployment
|
||||
shell: "[ -s {{ nitro_directory }}/l1-nitro-deployment/config.env ] && echo 'File is not empty' || echo 'File is empty'"
|
||||
register: file_check_result
|
||||
|
||||
- name: Display the result of the file check
|
||||
debug:
|
||||
msg: "{{ file_check_result.stdout }}"
|
||||
|
||||
- name: Copy config.env for L1 nitro deployment if it is empty
|
||||
template:
|
||||
src: "./templates/configs/l1-nitro-config.env.j2"
|
||||
dest: "{{ nitro_directory }}/l1-nitro-deployment/config.env"
|
||||
when: file_check_result.stdout == 'File is empty'
|
||||
|
||||
- name: Check if the config.env file is empty for L2 deployment
|
||||
shell: "[ -s {{ nitro_directory }}/l2-nitro-deployment/config.env ] && echo 'File is not empty' || echo 'File is empty'"
|
||||
register: file_check_result
|
||||
|
||||
- name: Display the result of the file check
|
||||
debug:
|
||||
msg: "{{ file_check_result.stdout }}"
|
||||
|
||||
- name: Copy config.env for L2 nitro deployment if it is empty
|
||||
template:
|
||||
src: "./templates/configs/l2-nitro-config.env.j2"
|
||||
dest: "{{ nitro_directory }}/l2-nitro-deployment/config.env"
|
||||
when: file_check_result.stdout == 'File is empty'
|
||||
|
||||
- name: Start deployment for L1 nitro node
|
||||
command: laconic-so deployment --dir l1-nitro-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
|
||||
- name: Start deployment for L2 nitro node
|
||||
command: laconic-so deployment --dir l2-nitro-deployment start
|
||||
args:
|
||||
chdir: "{{ nitro_directory }}"
|
||||
@@ -1,3 +0,0 @@
|
||||
target_host: "localhost"
|
||||
nitro_directory: out
|
||||
skip_container_build: false
|
||||
@@ -1,8 +0,0 @@
|
||||
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 }}"
|
||||
NITRO_BOOTPEERS={{ nitro_l1_bridge_multiaddr }}
|
||||
NITRO_EXT_MULTIADDR={{ nitro_l1_ext_multiaddr }}
|
||||
@@ -1,10 +0,0 @@
|
||||
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 }}"
|
||||
NITRO_BOOTPEERS={{ nitro_l2_bridge_multiaddr }}
|
||||
NITRO_EXT_MULTIADDR={{ nitro_l2_ext_multiaddr }}
|
||||
NITRO_L2=true
|
||||
@@ -1 +0,0 @@
|
||||
hosts.ini
|
||||
@@ -1,100 +0,0 @@
|
||||
# stack-orchestrator-setup
|
||||
|
||||
## Setup Ansible
|
||||
|
||||
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine.
|
||||
|
||||
## Setup Stack Orchestrator
|
||||
|
||||
This playbook will install Docker and Stack Orchestrator (laconic-so) on the machine if they aren't already present.
|
||||
|
||||
Run the following commands in the [`stack-orchestrator-setup`](./) directory.
|
||||
|
||||
### On Local Host
|
||||
|
||||
To setup stack orchestrator and docker locally, execute the `setup-laconic-so.yml` Ansible playbook:
|
||||
|
||||
```bash
|
||||
LANG=en_US.utf8 ansible-playbook setup-laconic-so.yml --user $USER -kK
|
||||
```
|
||||
|
||||
### 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 `<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"
|
||||
# }
|
||||
```
|
||||
|
||||
- Execute the `setup-laconic-so.yml` Ansible playbook for setting up stack orchestrator and docker on a remote machine:
|
||||
|
||||
```bash
|
||||
LANG=en_US.utf8 ansible-playbook setup-laconic-so.yml -i hosts.ini --extra-vars='{ "target_host": "deployment_host"}' --user $USER -kK
|
||||
```
|
||||
|
||||
## Verify Installation
|
||||
|
||||
- After the installation is complete, verify if `$HOME/bin` is already included in your PATH by running:
|
||||
|
||||
```bash
|
||||
echo $PATH | grep -q "$HOME/bin" && echo "$HOME/bin is already in PATH" || echo "$HOME/bin is not in PATH"
|
||||
```
|
||||
If the command outputs `"$HOME/bin is not in PATH"`, you'll need to add it to your `PATH`.
|
||||
|
||||
- To add `$HOME/bin` to your PATH, run the following command:
|
||||
|
||||
```bash
|
||||
export PATH="$HOME/bin:$PATH"
|
||||
```
|
||||
|
||||
- To make this change permanent, add the following line to your shell configuration file (`~/.bashrc` or `~/.zshrc`, depending on your shell):
|
||||
|
||||
```bash
|
||||
# For bash users
|
||||
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
|
||||
|
||||
# For zsh users
|
||||
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
|
||||
```
|
||||
|
||||
- Once the PATH is set, verify the installation by running the following commands:
|
||||
|
||||
```bash
|
||||
# Check version of docker
|
||||
docker --version
|
||||
|
||||
# Check version of docker compose
|
||||
docker compose version
|
||||
|
||||
# Check version of Stack Orchestrator
|
||||
laconic-so version
|
||||
```
|
||||
@@ -1,91 +0,0 @@
|
||||
- name: Set up Docker
|
||||
hosts: "{{ target_host }}"
|
||||
become: yes
|
||||
|
||||
vars:
|
||||
target_host: "localhost"
|
||||
docker_gpg_key_url: "https://download.docker.com/linux/ubuntu/gpg"
|
||||
docker_gpg_key_path: "/etc/apt/keyrings/docker.asc"
|
||||
|
||||
tasks:
|
||||
- name: Check if Docker is installed
|
||||
command: which docker
|
||||
register: is_docker_present
|
||||
ignore_errors: yes
|
||||
|
||||
- block:
|
||||
- name: Exit if docker is present
|
||||
debug:
|
||||
msg: "Docker already on host, ending play"
|
||||
- meta: end_play
|
||||
when: is_docker_present.rc == 0
|
||||
|
||||
- name: Update apt cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: Install prerequisites
|
||||
apt:
|
||||
name:
|
||||
- ca-certificates
|
||||
- curl
|
||||
state: present
|
||||
|
||||
- name: Ensure keyrings directory exists
|
||||
file:
|
||||
path: "/etc/apt/keyrings"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Download Docker GPG key
|
||||
get_url:
|
||||
url: "{{ docker_gpg_key_url }}"
|
||||
dest: "{{ docker_gpg_key_path }}"
|
||||
mode: '0644'
|
||||
|
||||
- name: Get system architecture
|
||||
shell: dpkg --print-architecture
|
||||
register: system_arch
|
||||
|
||||
- name: Add Docker repository
|
||||
apt_repository:
|
||||
repo: "deb [arch={{ system_arch.stdout }} signed-by={{ docker_gpg_key_path }}] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable"
|
||||
state: present
|
||||
filename: docker
|
||||
|
||||
- name: Update apt cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: Install Docker packages
|
||||
apt:
|
||||
name:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
- docker-buildx-plugin
|
||||
- docker-compose-plugin
|
||||
state: latest
|
||||
notify: Restart Docker
|
||||
|
||||
- name: Add user to docker group
|
||||
user:
|
||||
name: "{{ ansible_user }}"
|
||||
groups: docker
|
||||
append: true
|
||||
|
||||
- name: Verify Docker installation by running the hello world image
|
||||
command: docker run hello-world
|
||||
register: hello_world_output
|
||||
ignore_errors: true
|
||||
become: no
|
||||
|
||||
- name: Display hello-world output
|
||||
debug:
|
||||
var: hello_world_output.stdout_lines
|
||||
|
||||
handlers:
|
||||
- name: Restart Docker
|
||||
service:
|
||||
name: docker
|
||||
state: restarted
|
||||
@@ -1,57 +0,0 @@
|
||||
- name: Install Docker if it isn't present
|
||||
import_playbook: setup-docker.yml
|
||||
|
||||
- name: Set up Stack Orchestrator
|
||||
hosts: "{{ target_host }}"
|
||||
|
||||
vars:
|
||||
target_host: "localhost"
|
||||
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||
|
||||
tasks:
|
||||
- name: Check if Stack Orchestrator is installed
|
||||
shell: which laconic-so
|
||||
register: is_so_present
|
||||
ignore_errors: yes
|
||||
|
||||
- block:
|
||||
- name: Exit if Stack Orchestrator is present
|
||||
debug:
|
||||
msg: "Stack Orchestrator already on host, ending play"
|
||||
- meta: end_play
|
||||
when: is_so_present.rc == 0
|
||||
|
||||
- name: Install jq
|
||||
apt:
|
||||
name: jq
|
||||
state: present
|
||||
update_cache: yes
|
||||
become: yes
|
||||
|
||||
- name: Ensure that directory ~/bin exists and is writable
|
||||
file:
|
||||
path: "{{ ansible_env.HOME }}/bin"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Download the laconic-so binary
|
||||
get_url:
|
||||
url: https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so
|
||||
dest: "{{ ansible_env.HOME }}/bin/laconic-so"
|
||||
mode: '0755'
|
||||
force: yes
|
||||
|
||||
- name: Ensure ~/.laconic-so directory exists
|
||||
file:
|
||||
path: "{{ ansible_env.HOME }}/.laconic-so"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Save the distribution url to ~/.laconic-so directory
|
||||
copy:
|
||||
dest: "{{ ansible_env.HOME }}/.laconic-so/config.yml"
|
||||
content: |
|
||||
distribution-url: https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so
|
||||
mode: '0644'
|
||||
Reference in New Issue
Block a user