Refactor playbook to use 'node' directory instead of 'ritual'; add grpcbalancer installation steps
This commit is contained in:
parent
671c7a4507
commit
3a2847295a
86
playbook.yml
86
playbook.yml
@ -19,8 +19,8 @@
|
|||||||
path: "~/.bash_history"
|
path: "~/.bash_history"
|
||||||
create: true
|
create: true
|
||||||
block: |
|
block: |
|
||||||
cd ~/ritual; bash rebuild.sh
|
cd ~/node; bash rebuild.sh
|
||||||
nano ~/ritual/projects/hello-world/container/config.json
|
nano ~/node/projects/hello-world/container/config.json
|
||||||
docker logs infernet-node -f
|
docker logs infernet-node -f
|
||||||
docker logs --since 10m infernet-node -f
|
docker logs --since 10m infernet-node -f
|
||||||
marker: ""
|
marker: ""
|
||||||
@ -33,7 +33,7 @@
|
|||||||
create: true
|
create: true
|
||||||
insertafter: EOF
|
insertafter: EOF
|
||||||
block: |
|
block: |
|
||||||
cd /root/ritual
|
cd /root/node
|
||||||
marker: ""
|
marker: ""
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
|
|
||||||
@ -118,39 +118,6 @@
|
|||||||
name: web3
|
name: web3
|
||||||
extra_args: --break-system-packages
|
extra_args: --break-system-packages
|
||||||
|
|
||||||
- name: Install grpcbalancer dependencies
|
|
||||||
ansible.builtin.pip:
|
|
||||||
name:
|
|
||||||
- grist-api
|
|
||||||
- flask
|
|
||||||
- requests
|
|
||||||
- waitress
|
|
||||||
extra_args: --break-system-packages --no-dependencies
|
|
||||||
|
|
||||||
- name: Create grpcbalancer directory
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: /opt/grpc-balancer
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
|
|
||||||
- name: Copy grpcbalancer files
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: "{{ ansible_env.HOME }}/ritual/grpcbalancer/grpcbalancer.py"
|
|
||||||
dest: /usr/local/bin/grpc-balancer
|
|
||||||
mode: '0755'
|
|
||||||
|
|
||||||
- name: Install grpcbalancer service
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: "{{ ansible_env.HOME }}/ritual/grpcbalancer/grpc-balancer.service"
|
|
||||||
dest: /etc/systemd/system/
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Start and enable grpcbalancer service
|
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: grpc-balancer
|
|
||||||
state: started
|
|
||||||
enabled: yes
|
|
||||||
daemon_reload: yes
|
|
||||||
|
|
||||||
# - name: Install Docker
|
# - name: Install Docker
|
||||||
# ansible.builtin.shell: curl -sL https://get.docker.com | sudo sh -
|
# ansible.builtin.shell: curl -sL https://get.docker.com | sudo sh -
|
||||||
@ -199,7 +166,7 @@
|
|||||||
- name: Clone repository
|
- name: Clone repository
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: https://gitea.vvzvlad.xyz/vvzvlad/ritual.git
|
repo: https://gitea.vvzvlad.xyz/vvzvlad/ritual.git
|
||||||
dest: "{{ ansible_env.HOME }}/ritual"
|
dest: "{{ ansible_env.HOME }}/node"
|
||||||
version: "{{ git_version }}"
|
version: "{{ git_version }}"
|
||||||
force: true
|
force: true
|
||||||
async: "{{ 60 * 15 }}"
|
async: "{{ 60 * 15 }}"
|
||||||
@ -215,15 +182,44 @@
|
|||||||
./update.sh PRIVATE_KEY "{{ private_key }}"
|
./update.sh PRIVATE_KEY "{{ private_key }}"
|
||||||
./update.sh RPC_URL "{{ rpc_url }}"
|
./update.sh RPC_URL "{{ rpc_url }}"
|
||||||
args:
|
args:
|
||||||
chdir: "{{ ansible_env.HOME }}/ritual"
|
chdir: "{{ ansible_env.HOME }}/node"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
|
||||||
|
- name: Install grpcbalancer dependencies
|
||||||
|
ansible.builtin.pip:
|
||||||
|
name:
|
||||||
|
- grist-api
|
||||||
|
- flask
|
||||||
|
- requests
|
||||||
|
- waitress
|
||||||
|
extra_args: --break-system-packages --no-dependencies
|
||||||
|
|
||||||
|
- name: Copy grpcbalancer files
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ ansible_env.HOME }}/node/grpcbalancer/grpcbalancer.py"
|
||||||
|
dest: /usr/local/bin/grpc-balancer
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Install grpcbalancer service
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ ansible_env.HOME }}/node/grpcbalancer/grpc-balancer.service"
|
||||||
|
dest: /etc/systemd/system/
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Start and enable grpcbalancer service
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: grpc-balancer
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
|
||||||
- name: Install Forge and Infernet SDK
|
- name: Install Forge and Infernet SDK
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
rm -rf {{ ansible_env.HOME }}/ritual/projects/hello-world/contracts/lib/forge-std
|
rm -rf {{ ansible_env.HOME }}/node/projects/hello-world/contracts/lib/forge-std
|
||||||
rm -rf {{ ansible_env.HOME }}/ritual/projects/hello-world/contracts/lib/infernet-sdk
|
rm -rf {{ ansible_env.HOME }}/node/projects/hello-world/contracts/lib/infernet-sdk
|
||||||
cd {{ ansible_env.HOME }}/foundry && source {{ ansible_env.HOME }}/.bashrc && foundryup
|
cd {{ ansible_env.HOME }}/foundry && source {{ ansible_env.HOME }}/.bashrc && foundryup
|
||||||
cd {{ ansible_env.HOME }}/ritual/projects/hello-world/contracts
|
cd {{ ansible_env.HOME }}/node/projects/hello-world/contracts
|
||||||
forge install --no-commit foundry-rs/forge-std
|
forge install --no-commit foundry-rs/forge-std
|
||||||
forge install --no-commit ritual-net/infernet-sdk
|
forge install --no-commit ritual-net/infernet-sdk
|
||||||
args:
|
args:
|
||||||
@ -232,13 +228,13 @@
|
|||||||
- name: Deploy container
|
- name: Deploy container
|
||||||
ansible.builtin.shell: project=hello-world make deploy-container
|
ansible.builtin.shell: project=hello-world make deploy-container
|
||||||
args:
|
args:
|
||||||
chdir: "{{ ansible_env.HOME }}/ritual"
|
chdir: "{{ ansible_env.HOME }}/node"
|
||||||
|
|
||||||
- name: Deploy contracts
|
- name: Deploy contracts
|
||||||
ansible.builtin.shell: project=hello-world make deploy-contracts 2>&1
|
ansible.builtin.shell: project=hello-world make deploy-contracts 2>&1
|
||||||
register: contract_deploy_output
|
register: contract_deploy_output
|
||||||
args:
|
args:
|
||||||
chdir: "{{ ansible_env.HOME }}/ritual"
|
chdir: "{{ ansible_env.HOME }}/node"
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 120
|
delay: 120
|
||||||
failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_deploy_output.stdout'
|
failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_deploy_output.stdout'
|
||||||
@ -246,13 +242,13 @@
|
|||||||
- name: Update CallContract.s.sol with contract address
|
- name: Update CallContract.s.sol with contract address
|
||||||
ansible.builtin.shell: bash update_contracts.sh
|
ansible.builtin.shell: bash update_contracts.sh
|
||||||
args:
|
args:
|
||||||
chdir: "{{ ansible_env.HOME }}/ritual"
|
chdir: "{{ ansible_env.HOME }}/node"
|
||||||
|
|
||||||
- name: Call contract
|
- name: Call contract
|
||||||
ansible.builtin.shell: project=hello-world make call-contract 2>&1
|
ansible.builtin.shell: project=hello-world make call-contract 2>&1
|
||||||
register: contract_call_output
|
register: contract_call_output
|
||||||
args:
|
args:
|
||||||
chdir: "{{ ansible_env.HOME }}/ritual"
|
chdir: "{{ ansible_env.HOME }}/node"
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 120
|
delay: 120
|
||||||
failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_call_output.stdout'
|
failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_call_output.stdout'
|
||||||
|
Loading…
Reference in New Issue
Block a user