Compare commits
No commits in common. "main-22aug" and "main" have entirely different histories.
main-22aug
...
main
@ -1,3 +1,4 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
node:
|
||||
@ -20,11 +21,6 @@ services:
|
||||
- "host.docker.internal:host-gateway"
|
||||
stop_grace_period: 1m
|
||||
container_name: infernet-node
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-file: 5
|
||||
max-size: 10m
|
||||
|
||||
redis:
|
||||
image: redis:latest
|
||||
@ -37,11 +33,6 @@ services:
|
||||
- redis-data:/data
|
||||
restart:
|
||||
unless-stopped
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-file: 5
|
||||
max-size: 10m
|
||||
|
||||
fluentbit:
|
||||
image: fluent/fluent-bit:latest
|
||||
@ -56,11 +47,6 @@ services:
|
||||
- network
|
||||
restart:
|
||||
unless-stopped
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-file: 5
|
||||
max-size: 10m
|
||||
|
||||
infernet-anvil:
|
||||
image: ritualnetwork/infernet-anvil:1.0.0
|
||||
@ -72,11 +58,6 @@ services:
|
||||
container_name: infernet-anvil
|
||||
restart:
|
||||
unless-stopped
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-file: 5
|
||||
max-size: 10m
|
||||
|
||||
networks:
|
||||
network:
|
||||
|
252
playbook.yml
252
playbook.yml
@ -1,44 +1,16 @@
|
||||
---
|
||||
- name: System Setup and Configuration
|
||||
hosts: all
|
||||
become: true
|
||||
become: yes
|
||||
|
||||
|
||||
|
||||
tasks:
|
||||
- name: Set locale to C.UTF-8
|
||||
command: localectl set-locale LANG=C.UTF-8
|
||||
|
||||
- name: Create APT configuration file to assume yes
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/apt/apt.conf.d/90forceyes
|
||||
content: |
|
||||
APT::Get::Assume-Yes "true";
|
||||
mode: '0644'
|
||||
|
||||
- name: Append command to .bash_history
|
||||
ansible.builtin.blockinfile:
|
||||
path: "~/.bash_history"
|
||||
create: true
|
||||
block: |
|
||||
cd ~/ritual; bash rebuild.sh
|
||||
nano ~/ritual/projects/hello-world/container/config.json
|
||||
docker logs infernet-node -f
|
||||
docker logs --since 10m infernet-node -f
|
||||
marker: ""
|
||||
mode: '0644'
|
||||
|
||||
|
||||
- name: Append command to .bash_rc
|
||||
ansible.builtin.blockinfile:
|
||||
path: "~/.bashrc"
|
||||
create: true
|
||||
insertafter: EOF
|
||||
block: |
|
||||
cd /root/ritual
|
||||
marker: ""
|
||||
mode: '0644'
|
||||
|
||||
- name: Update /etc/bash.bashrc
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: /etc/bash.bashrc
|
||||
block: |
|
||||
export HISTTIMEFORMAT='%F, %T '
|
||||
@ -51,23 +23,27 @@
|
||||
export LC_ALL=C.UTF-8
|
||||
alias ls='ls --color=auto'
|
||||
shopt -s cmdhist
|
||||
create: true
|
||||
marker: ""
|
||||
mode: '0644'
|
||||
|
||||
- name: Update .inputrc for the current user
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ ansible_env.HOME }}/.inputrc"
|
||||
- name: Ensure ~/.inputrc exists
|
||||
file:
|
||||
path: /root/.inputrc
|
||||
state: touch
|
||||
|
||||
- name: Update ~/.inputrc
|
||||
blockinfile:
|
||||
path: ~/.inputrc
|
||||
block: |
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
create: true
|
||||
marker: ""
|
||||
mode: '0644'
|
||||
|
||||
- name: Ensure ~/.nanorc exists
|
||||
file:
|
||||
path: /root/.nanorc
|
||||
state: touch
|
||||
|
||||
- name: Update ~/.nanorc
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ ansible_env.HOME }}/.nanorc"
|
||||
blockinfile:
|
||||
path: ~/.nanorc
|
||||
block: |
|
||||
set nohelp
|
||||
set tabsize 4
|
||||
@ -78,31 +54,24 @@
|
||||
set backupdir /tmp/
|
||||
set locking
|
||||
include /usr/share/nano/*.nanorc
|
||||
create: true
|
||||
marker: ""
|
||||
mode: '0644'
|
||||
|
||||
- name: Set hostname
|
||||
ansible.builtin.hostname:
|
||||
name: "{{ serverid }}"
|
||||
|
||||
- name: Ensure hostname is in /etc/hosts
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/hosts
|
||||
regexp: '^127\.0\.1\.1\s+'
|
||||
line: "127.0.1.1 {{ serverid }}"
|
||||
state: present
|
||||
shell: |
|
||||
hostnamectl set-hostname {{ serverid }}
|
||||
echo "127.0.1.1 {{ serverid }}" >> /etc/hosts
|
||||
|
||||
- name: Update and upgrade apt
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
apt:
|
||||
update_cache: yes
|
||||
upgrade: dist
|
||||
force_apt_get: true
|
||||
force_apt_get: yes
|
||||
register: apt_update_result
|
||||
until: apt_update_result is success
|
||||
retries: 50
|
||||
delay: 50
|
||||
until: apt_update_result is succeeded
|
||||
|
||||
- name: Install necessary packages
|
||||
ansible.builtin.apt:
|
||||
apt:
|
||||
name:
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
@ -114,115 +83,132 @@
|
||||
state: present
|
||||
|
||||
- name: Install pip package web3
|
||||
ansible.builtin.pip:
|
||||
pip:
|
||||
name: web3
|
||||
extra_args: --break-system-packages
|
||||
|
||||
# - name: Install Docker
|
||||
# ansible.builtin.shell: curl -sL https://get.docker.com | sudo sh -
|
||||
#
|
||||
# - name: Update Docker daemon configuration for journald logging
|
||||
# ansible.builtin.copy:
|
||||
# dest: /etc/docker/daemon.json
|
||||
# content: |
|
||||
# { "log-driver": "journald" }
|
||||
#
|
||||
# - name: Restart Docker
|
||||
# ansible.builtin.service:
|
||||
# name: docker
|
||||
# state: restarted
|
||||
- name: Install Docker
|
||||
shell: curl -sL https://get.docker.com | sudo sh -
|
||||
|
||||
- name: Ensure /etc/docker/daemon.json exists
|
||||
file:
|
||||
path: /etc/docker/daemon.json
|
||||
state: touch
|
||||
|
||||
- name: Update Docker daemon configuration for journald logging
|
||||
copy:
|
||||
dest: /etc/docker/daemon.json
|
||||
content: |
|
||||
{
|
||||
"log-driver": "journald"
|
||||
}
|
||||
|
||||
- name: Restart Docker
|
||||
service:
|
||||
name: docker
|
||||
state: restarted
|
||||
|
||||
- name: Docker login
|
||||
ansible.builtin.shell: docker login -u {{ docker_username }} -p {{ docker_password }}
|
||||
shell: docker login -u {{ docker_username }} -p {{ docker_password }}
|
||||
|
||||
# - name: Update journald log SystemMaxUse=2G configuration
|
||||
# ansible.builtin.lineinfile:
|
||||
# path: /etc/systemd/journald.conf
|
||||
# regexp: '^SystemMaxUse='
|
||||
# line: 'SystemMaxUse=2G'
|
||||
# state: present
|
||||
# backup: yes
|
||||
# validate: 'journaldctl check-config %s'
|
||||
#
|
||||
# - name: Restart journald
|
||||
# ansible.builtin.service:
|
||||
# name: systemd-journald
|
||||
# state: restarted
|
||||
- name: Update journald log SystemMaxUse=2G configuration
|
||||
lineinfile:
|
||||
path: /etc/systemd/journald.conf
|
||||
line: 'SystemMaxUse=2G'
|
||||
insertafter: EOF
|
||||
create: yes
|
||||
|
||||
- name: Restart journald
|
||||
service:
|
||||
name: systemd-journald
|
||||
state: restarted
|
||||
|
||||
- name: Setup Foundry
|
||||
ansible.builtin.shell: |
|
||||
shell: |
|
||||
mkdir -p ~/foundry && cd ~/foundry
|
||||
curl -L https://foundry.paradigm.xyz | bash
|
||||
args:
|
||||
executable: /bin/bash
|
||||
|
||||
- name: Run foundryup
|
||||
ansible.builtin.shell: |
|
||||
shell: |
|
||||
source ~/.bashrc && foundryup
|
||||
args:
|
||||
executable: /bin/bash
|
||||
|
||||
- name: Clone repository
|
||||
ansible.builtin.git:
|
||||
repo: https://gitea.vvzvlad.xyz/vvzvlad/ritual.git
|
||||
dest: "{{ ansible_env.HOME }}/ritual"
|
||||
version: "{{ git_version }}"
|
||||
force: true
|
||||
async: "{{ 60 * 15 }}"
|
||||
poll: 30
|
||||
- name: Clone ritual-says-gm repository
|
||||
git:
|
||||
repo: https://gitea.vvzvlad.xyz/vvzvlad/ritual-says-gm.git
|
||||
dest: ~/ritual-says-gm
|
||||
force: yes
|
||||
|
||||
- name: Update wallet, private key and RPC URL in project
|
||||
ansible.builtin.shell: bash update.sh {{ wallet }} {{ private_key }} {{ rpc_url }}
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/ritual"
|
||||
shell: |
|
||||
cd ~/ritual-says-gm
|
||||
bash update.sh {{ wallet }} {{ private_key }} {{ rpc_url }}
|
||||
|
||||
- name: Remove old Forge and Infernet SDK
|
||||
shell: |
|
||||
cd ~/ritual-says-gm
|
||||
rm -rf projects/hello-world/contracts/lib/forge-std
|
||||
rm -rf projects/hello-world/contracts/lib/infernet-sdk
|
||||
|
||||
- name: Install Forge and Infernet SDK
|
||||
ansible.builtin.shell: |
|
||||
rm -rf {{ ansible_env.HOME }}/ritual/projects/hello-world/contracts/lib/forge-std
|
||||
rm -rf {{ ansible_env.HOME }}/ritual/projects/hello-world/contracts/lib/infernet-sdk
|
||||
cd {{ ansible_env.HOME }}/foundry && source {{ ansible_env.HOME }}/.bashrc && foundryup
|
||||
cd {{ ansible_env.HOME }}/ritual/projects/hello-world/contracts
|
||||
shell: |
|
||||
cd ~/foundry && source ~/.bashrc && foundryup
|
||||
cd ~/ritual-says-gm
|
||||
cd projects/hello-world/contracts
|
||||
forge install --no-commit foundry-rs/forge-std
|
||||
forge install --no-commit ritual-net/infernet-sdk
|
||||
args:
|
||||
executable: /bin/bash
|
||||
|
||||
- name: Deploy container
|
||||
ansible.builtin.shell: project=hello-world make deploy-container
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/ritual"
|
||||
shell: |
|
||||
cd ~/ritual-says-gm && project=hello-world make deploy-container
|
||||
|
||||
- name: Deploy contracts
|
||||
ansible.builtin.shell: project=hello-world make deploy-contracts 2>&1
|
||||
shell: cd ~/ritual-says-gm && project=hello-world make deploy-contracts 2>&1
|
||||
register: contract_deploy_output
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/ritual"
|
||||
retries: 5
|
||||
delay: 120
|
||||
failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_deploy_output.stdout'
|
||||
ignore_errors: yes
|
||||
retries: 3
|
||||
delay: 53
|
||||
until: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" in contract_deploy_output.stdout'
|
||||
|
||||
- name: Update CallContract.s.sol with contract address
|
||||
ansible.builtin.shell: bash update_contracts.sh
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/ritual"
|
||||
shell: |
|
||||
cd ~/ritual-says-gm
|
||||
contract_address=$(jq -r '.transactions[0].contractAddress' projects/hello-world/contracts/broadcast/Deploy.s.sol/8453/run-latest.json)
|
||||
checksum_address=$(python3 toChecksumAddress.py $contract_address)
|
||||
sed -i "s/SaysGM(.*/SaysGM($checksum_address);/" projects/hello-world/contracts/script/CallContract.s.sol
|
||||
|
||||
- name: Call contract
|
||||
ansible.builtin.shell: project=hello-world make call-contract 2>&1
|
||||
register: contract_call_output
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/ritual"
|
||||
retries: 5
|
||||
delay: 120
|
||||
failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_call_output.stdout'
|
||||
shell: cd ~/ritual-says-gm && project=hello-world make call-contract 2>&1
|
||||
register: contract_output
|
||||
ignore_errors: yes
|
||||
retries: 3
|
||||
delay: 55
|
||||
until: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" in contract_output.stdout'
|
||||
|
||||
# - name: Set Docker containers to restart unless stopped
|
||||
# ansible.builtin.shell: |
|
||||
# docker update --restart unless-stopped hello-world
|
||||
# docker update --restart unless-stopped infernet-node
|
||||
# docker update --restart unless-stopped deploy-redis-1
|
||||
# docker update --restart unless-stopped infernet-anvil
|
||||
# docker update --restart unless-stopped deploy-fluentbit-1
|
||||
- name: Set Docker containers to restart unless stopped
|
||||
shell: |
|
||||
docker update --restart unless-stopped hello-world
|
||||
docker update --restart unless-stopped infernet-node
|
||||
docker update --restart unless-stopped deploy-redis-1
|
||||
docker update --restart unless-stopped infernet-anvil
|
||||
docker update --restart unless-stopped deploy-fluentbit-1
|
||||
|
||||
- name: Create APT configuration file to assume yes
|
||||
copy:
|
||||
dest: /etc/apt/apt.conf.d/90forceyes
|
||||
content: |
|
||||
APT::Get::Assume-Yes "true";
|
||||
|
||||
- name: Set permissions on APT configuration file
|
||||
file:
|
||||
path: /etc/apt/apt.conf.d/90forceyes
|
||||
mode: '0644'
|
||||
|
||||
- name: Remove docker login credentials
|
||||
ansible.builtin.shell: rm -rf /root/.docker/config.json
|
||||
shell: rm -rf /root/.docker/config.json
|
||||
ignore_errors: yes
|
@ -24,8 +24,8 @@
|
||||
},
|
||||
"forward_stats": true,
|
||||
"snapshot_sync": {
|
||||
"sleep": 3,
|
||||
"batch_size": 1800,
|
||||
"sleep": 2,
|
||||
"batch_size": 10000,
|
||||
"starting_sub_id": 100000
|
||||
},
|
||||
"containers": [
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
cd ~/ritual
|
||||
project=hello-world make deploy-container
|
||||
project=hello-world make deploy-contracts
|
||||
bash update_contracts.sh
|
||||
project=hello-world make call-contract
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
cd ~/ritual
|
||||
contract_address=$(jq -r '.transactions[0].contractAddress' projects/hello-world/contracts/broadcast/Deploy.s.sol/8453/run-latest.json)
|
||||
checksum_address=$(python3 toChecksumAddress.py $contract_address)
|
||||
sed -i "s/SaysGM(.*/SaysGM($checksum_address);/" projects/hello-world/contracts/script/CallContract.s.sol
|
Loading…
Reference in New Issue
Block a user