Compare commits

..

No commits in common. "main-22aug" and "main" have entirely different histories.

5 changed files with 124 additions and 172 deletions

View File

@ -1,3 +1,4 @@
version: '3'
services: services:
node: node:
@ -20,11 +21,6 @@ services:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"
stop_grace_period: 1m stop_grace_period: 1m
container_name: infernet-node container_name: infernet-node
logging:
driver: "json-file"
options:
max-file: 5
max-size: 10m
redis: redis:
image: redis:latest image: redis:latest
@ -37,11 +33,6 @@ services:
- redis-data:/data - redis-data:/data
restart: restart:
unless-stopped unless-stopped
logging:
driver: "json-file"
options:
max-file: 5
max-size: 10m
fluentbit: fluentbit:
image: fluent/fluent-bit:latest image: fluent/fluent-bit:latest
@ -56,11 +47,6 @@ services:
- network - network
restart: restart:
unless-stopped unless-stopped
logging:
driver: "json-file"
options:
max-file: 5
max-size: 10m
infernet-anvil: infernet-anvil:
image: ritualnetwork/infernet-anvil:1.0.0 image: ritualnetwork/infernet-anvil:1.0.0
@ -72,11 +58,6 @@ services:
container_name: infernet-anvil container_name: infernet-anvil
restart: restart:
unless-stopped unless-stopped
logging:
driver: "json-file"
options:
max-file: 5
max-size: 10m
networks: networks:
network: network:

View File

@ -1,44 +1,16 @@
--- ---
- name: System Setup and Configuration - name: System Setup and Configuration
hosts: all hosts: all
become: true become: yes
tasks: tasks:
- name: Set locale to C.UTF-8 - name: Set locale to C.UTF-8
command: localectl set-locale LANG=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 - name: Update /etc/bash.bashrc
ansible.builtin.blockinfile: blockinfile:
path: /etc/bash.bashrc path: /etc/bash.bashrc
block: | block: |
export HISTTIMEFORMAT='%F, %T ' export HISTTIMEFORMAT='%F, %T '
@ -51,23 +23,27 @@
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
alias ls='ls --color=auto' alias ls='ls --color=auto'
shopt -s cmdhist shopt -s cmdhist
create: true
marker: ""
mode: '0644'
- name: Update .inputrc for the current user - name: Ensure ~/.inputrc exists
ansible.builtin.blockinfile: file:
path: "{{ ansible_env.HOME }}/.inputrc" path: /root/.inputrc
state: touch
- name: Update ~/.inputrc
blockinfile:
path: ~/.inputrc
block: | block: |
"\e[A": history-search-backward "\e[A": history-search-backward
"\e[B": history-search-forward "\e[B": history-search-forward
create: true
marker: "" - name: Ensure ~/.nanorc exists
mode: '0644' file:
path: /root/.nanorc
state: touch
- name: Update ~/.nanorc - name: Update ~/.nanorc
ansible.builtin.blockinfile: blockinfile:
path: "{{ ansible_env.HOME }}/.nanorc" path: ~/.nanorc
block: | block: |
set nohelp set nohelp
set tabsize 4 set tabsize 4
@ -78,31 +54,24 @@
set backupdir /tmp/ set backupdir /tmp/
set locking set locking
include /usr/share/nano/*.nanorc include /usr/share/nano/*.nanorc
create: true
marker: ""
mode: '0644'
- name: Set hostname - name: Set hostname
ansible.builtin.hostname: shell: |
name: "{{ serverid }}" hostnamectl set-hostname {{ serverid }}
echo "127.0.1.1 {{ serverid }}" >> /etc/hosts
- 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
- name: Update and upgrade apt - name: Update and upgrade apt
ansible.builtin.apt: apt:
update_cache: true update_cache: yes
upgrade: dist upgrade: dist
force_apt_get: true force_apt_get: yes
register: apt_update_result register: apt_update_result
until: apt_update_result is success retries: 50
delay: 50
until: apt_update_result is succeeded
- name: Install necessary packages - name: Install necessary packages
ansible.builtin.apt: apt:
name: name:
- apt-transport-https - apt-transport-https
- ca-certificates - ca-certificates
@ -114,115 +83,132 @@
state: present state: present
- name: Install pip package web3 - name: Install pip package web3
ansible.builtin.pip: pip:
name: web3 name: web3
extra_args: --break-system-packages extra_args: --break-system-packages
# - name: Install Docker - name: Install Docker
# ansible.builtin.shell: curl -sL https://get.docker.com | sudo sh - shell: curl -sL https://get.docker.com | sudo sh -
#
# - name: Update Docker daemon configuration for journald logging - name: Ensure /etc/docker/daemon.json exists
# ansible.builtin.copy: file:
# dest: /etc/docker/daemon.json path: /etc/docker/daemon.json
# content: | state: touch
# { "log-driver": "journald" }
# - name: Update Docker daemon configuration for journald logging
# - name: Restart Docker copy:
# ansible.builtin.service: dest: /etc/docker/daemon.json
# name: docker content: |
# state: restarted {
"log-driver": "journald"
}
- name: Restart Docker
service:
name: docker
state: restarted
- name: Docker login - 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 - name: Update journald log SystemMaxUse=2G configuration
# ansible.builtin.lineinfile: lineinfile:
# path: /etc/systemd/journald.conf path: /etc/systemd/journald.conf
# regexp: '^SystemMaxUse=' line: 'SystemMaxUse=2G'
# line: 'SystemMaxUse=2G' insertafter: EOF
# state: present create: yes
# backup: yes
# validate: 'journaldctl check-config %s' - name: Restart journald
# service:
# - name: Restart journald name: systemd-journald
# ansible.builtin.service: state: restarted
# name: systemd-journald
# state: restarted
- name: Setup Foundry - name: Setup Foundry
ansible.builtin.shell: | shell: |
mkdir -p ~/foundry && cd ~/foundry mkdir -p ~/foundry && cd ~/foundry
curl -L https://foundry.paradigm.xyz | bash curl -L https://foundry.paradigm.xyz | bash
args: args:
executable: /bin/bash executable: /bin/bash
- name: Run foundryup - name: Run foundryup
ansible.builtin.shell: | shell: |
source ~/.bashrc && foundryup source ~/.bashrc && foundryup
args: args:
executable: /bin/bash executable: /bin/bash
- name: Clone repository - name: Clone ritual-says-gm repository
ansible.builtin.git: git:
repo: https://gitea.vvzvlad.xyz/vvzvlad/ritual.git repo: https://gitea.vvzvlad.xyz/vvzvlad/ritual-says-gm.git
dest: "{{ ansible_env.HOME }}/ritual" dest: ~/ritual-says-gm
version: "{{ git_version }}" force: yes
force: true
async: "{{ 60 * 15 }}"
poll: 30
- name: Update wallet, private key and RPC URL in project - name: Update wallet, private key and RPC URL in project
ansible.builtin.shell: bash update.sh {{ wallet }} {{ private_key }} {{ rpc_url }} shell: |
args: cd ~/ritual-says-gm
chdir: "{{ ansible_env.HOME }}/ritual" 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 - name: Install Forge and Infernet SDK
ansible.builtin.shell: | shell: |
rm -rf {{ ansible_env.HOME }}/ritual/projects/hello-world/contracts/lib/forge-std cd ~/foundry && source ~/.bashrc && foundryup
rm -rf {{ ansible_env.HOME }}/ritual/projects/hello-world/contracts/lib/infernet-sdk cd ~/ritual-says-gm
cd {{ ansible_env.HOME }}/foundry && source {{ ansible_env.HOME }}/.bashrc && foundryup cd projects/hello-world/contracts
cd {{ ansible_env.HOME }}/ritual/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:
executable: /bin/bash executable: /bin/bash
- name: Deploy container - name: Deploy container
ansible.builtin.shell: project=hello-world make deploy-container shell: |
args: cd ~/ritual-says-gm && project=hello-world make deploy-container
chdir: "{{ ansible_env.HOME }}/ritual"
- name: Deploy contracts - 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 register: contract_deploy_output
args: ignore_errors: yes
chdir: "{{ ansible_env.HOME }}/ritual" retries: 3
retries: 5 delay: 53
delay: 120 until: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" in contract_deploy_output.stdout'
failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_deploy_output.stdout'
- name: Update CallContract.s.sol with contract address - name: Update CallContract.s.sol with contract address
ansible.builtin.shell: bash update_contracts.sh shell: |
args: cd ~/ritual-says-gm
chdir: "{{ ansible_env.HOME }}/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
- name: Call contract - name: Call contract
ansible.builtin.shell: project=hello-world make call-contract 2>&1 shell: cd ~/ritual-says-gm && project=hello-world make call-contract 2>&1
register: contract_call_output register: contract_output
args: ignore_errors: yes
chdir: "{{ ansible_env.HOME }}/ritual" retries: 3
retries: 5 delay: 55
delay: 120 until: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" in contract_output.stdout'
failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_call_output.stdout'
# - name: Set Docker containers to restart unless stopped - name: Set Docker containers to restart unless stopped
# ansible.builtin.shell: | shell: |
# docker update --restart unless-stopped hello-world docker update --restart unless-stopped hello-world
# docker update --restart unless-stopped infernet-node docker update --restart unless-stopped infernet-node
# docker update --restart unless-stopped deploy-redis-1 docker update --restart unless-stopped deploy-redis-1
# docker update --restart unless-stopped infernet-anvil docker update --restart unless-stopped infernet-anvil
# docker update --restart unless-stopped deploy-fluentbit-1 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 - name: Remove docker login credentials
ansible.builtin.shell: rm -rf /root/.docker/config.json shell: rm -rf /root/.docker/config.json
ignore_errors: yes

View File

@ -24,8 +24,8 @@
}, },
"forward_stats": true, "forward_stats": true,
"snapshot_sync": { "snapshot_sync": {
"sleep": 3, "sleep": 2,
"batch_size": 1800, "batch_size": 10000,
"starting_sub_id": 100000 "starting_sub_id": 100000
}, },
"containers": [ "containers": [

View File

@ -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

View File

@ -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