Compare commits

..

No commits in common. "main" and "master" have entirely different histories.
main ... master

5 changed files with 124 additions and 106 deletions

View File

@ -101,7 +101,7 @@ def check_logs(log_handler):
proof_speeds = deque(maxlen=100)
try:
logs = subprocess.run(['docker', 'compose', 'logs', '--since', '2h'], cwd='/root/node/', capture_output=True, text=True, check=True)
logs = subprocess.run(['docker', 'compose', 'logs', '--since', '24h'], cwd='/root/node/', capture_output=True, text=True, check=True)
log_content = logs.stdout
except subprocess.CalledProcessError as e:
raise RuntimeError(f"Error running docker compose logs: {e}") from e
@ -127,7 +127,7 @@ def check_logs(log_handler):
data = {
"errors": error_count,
"proved_steps": proved_count/10,
"proof_speed": int(avg_proof_speed)
"proof_speed": avg_proof_speed
}
log_handler.info(f"Result: {data}")
return data

View File

@ -1,12 +1,11 @@
#docker build -t nexus-image .
services:
nexus-prover:
image: nexus-image
container_name: nexus-prover
restart: unless-stopped
volumes:
- /root/node/prover-id:/root/.nexus/prover-id
- /root/prover-id:/root/.nexus/prover-id
logging:
driver: "json-file"
options:
max-file: 2
max-size: 1m
driver: "none"

View File

@ -1,4 +1,4 @@
- name: Deployment playbook
- name: Nillion deployment playbook
hosts: all
become: true
vars:
@ -11,7 +11,7 @@
create: yes
block: |
#1724983098
cd /root/node/ ; docker compose logs --since 3h -f
cd /root/node/ ; docker compose logs -f
marker: ""
- name: Set locale to C.UTF-8
@ -80,68 +80,71 @@
echo "127.0.1.1 {{ serverid }}" >> /etc/hosts
changed_when: false
#- name: Update and upgrade apt
# ansible.builtin.apt:
# update_cache: true
# #upgrade: dist
# #force_apt_get: true
# #autoremove: true
# register: apt_update_result
# retries: 5
# delay: 50
# until: apt_update_result is succeeded
# async: "{{ 60 * 20 }}"
# poll: 30
#- name: Install packages
# ansible.builtin.apt:
# name:
# - ca-certificates
# - zlib1g-dev
# - libncurses5-dev
# - libgdbm-dev
# - libnss3-dev
# - curl
# - jq
# - git
# - zip
# - wget
# - make
# - python3
# - python3-pip
# - iftop
# state: present
# update_cache: true
# async: "{{ 60 * 20 }}"
# poll: 30
- name: Clone repository
ansible.builtin.git:
repo: https://gitea.vvzvlad.xyz/vvzvlad/nexus
dest: "{{ ansible_env.HOME }}/node"
version: "{{ git_version }}"
force: true
async: "{{ 60 * 15 }}"
- name: Update and upgrade apt
ansible.builtin.apt:
update_cache: true
upgrade: dist
force_apt_get: true
autoremove: true
register: apt_update_result
retries: 5
delay: 50
until: apt_update_result is succeeded
async: "{{ 60 * 20 }}"
poll: 30
#- name: Install grist-api and colorama (attempt 1)
# ansible.builtin.command: pip3 install grist-api colorama --break-system-packages
# args:
# chdir: "{{ ansible_env.HOME }}/node"
# changed_when: false
- name: Install packages
ansible.builtin.apt:
name:
- ca-certificates
- zlib1g-dev
- libncurses5-dev
- libgdbm-dev
- libnss3-dev
- curl
- jq
- git
- zip
- wget
- make
- python3
- python3-pip
- iftop
state: present
update_cache: true
async: "{{ 60 * 20 }}"
poll: 30
#- name: Install Docker
# ansible.builtin.shell: curl -fsSL https://get.docker.com | bash
# changed_when: false
# async: "{{ 60 * 5 }}"
# poll: 30
- name: Install Docker
ansible.builtin.shell: curl -fsSL https://get.docker.com | bash
changed_when: false
async: "{{ 60 * 5 }}"
poll: 30
#- name: Update Docker daemon journald logging
# ansible.builtin.copy:
# dest: /etc/docker/daemon.json
# content: |
# { "log-driver": "journald" }
# mode: '0644'
- name: Update Docker daemon journald logging
ansible.builtin.copy:
dest: /etc/docker/daemon.json
content: |
{ "log-driver": "journald" }
mode: '0644'
- name: Restart Docker
ansible.builtin.service:
name: docker
state: restarted
- name: Update journald log SystemMaxUse=2G configuration
ansible.builtin.lineinfile:
path: /etc/systemd/journald.conf
line: 'SystemMaxUse=2G'
insertafter: EOF
create: true
mode: '0644'
- name: Restart journald
ansible.builtin.service:
name: systemd-journald
state: restarted
- name: Docker login
ansible.builtin.shell: docker login -u "{{ docker_username }}" -p "{{ docker_password }}"
@ -149,23 +152,14 @@
changed_when: false
failed_when: "'Login Succeeded' not in docker_login_result.stdout"
#- name: Restart Docker
# ansible.builtin.service:
# name: docker
# state: restarted
#- name: Update journald log SystemMaxUse=2G configuration
# ansible.builtin.lineinfile:
# path: /etc/systemd/journald.conf
# line: 'SystemMaxUse=2G'
# insertafter: EOF
# create: true
# mode: '0644'
#- name: Restart journald
# ansible.builtin.service:
# name: systemd-journald
# state: restarted
- name: Clone repository
ansible.builtin.git:
repo: https://gitea.vvzvlad.xyz/vvzvlad/nillion
dest: "{{ ansible_env.HOME }}/node"
version: "{{ git_version }}"
force: true
async: "{{ 60 * 15 }}"
poll: 30
- name: Make update.sh executable
ansible.builtin.shell: |
@ -176,7 +170,10 @@
- name: Update environment variables
ansible.builtin.shell: |
./update.sh ID "{{ id }}"
./update.sh ADDRESS "{{ address }}"
./update.sh PRIVATE "{{ private_key }}"
./update.sh PUBLIC "{{ public_key }}"
./update.sh RPC "{{ rpc_url }}"
./update.sh GRIST_SERVER "{{ grist_server }}"
./update.sh GRIST_DOC_ID "{{ grist_doc_id }}"
./update.sh GRIST_API_KEY "{{ grist_api_key }}"
@ -184,11 +181,15 @@
chdir: "{{ ansible_env.HOME }}/node"
changed_when: false
- name: Build dockers images
ansible.builtin.command: docker build -t nexus-image .
- name: Download dockers images
ansible.builtin.command: docker compose pull
args:
chdir: "{{ ansible_env.HOME }}/node"
environment:
COMPOSE_INTERACTIVE_NO_CLI: 'true'
changed_when: false
async: "{{ 60 * 45 }}"
poll: "{{ 60 * 5 }}"
- name: Check external IP before
ansible.builtin.command: curl https://ifconfig.me
@ -202,20 +203,20 @@
fail_msg: "The returned value is not a valid IP address."
success_msg: "The returned value is a valid IP address."
#- name: Download tun2socks
# ansible.builtin.get_url:
# url: https://github.com/xjasonlyu/tun2socks/releases/download/v2.5.2/tun2socks-linux-amd64.zip
# dest: /tmp/tun2socks-linux-amd64.zip
# mode: '0644'
# async: "{{ 60 * 5 }}"
# poll: 30
- name: Download tun2socks
ansible.builtin.get_url:
url: https://github.com/xjasonlyu/tun2socks/releases/download/v2.5.2/tun2socks-linux-amd64.zip
dest: /tmp/tun2socks-linux-amd64.zip
mode: '0644'
async: "{{ 60 * 5 }}"
poll: 30
#- name: Unzip tun2socks
# ansible.builtin.unarchive:
# src: /tmp/tun2socks-linux-amd64.zip
# dest: /usr/local/sbin/
# remote_src: true
# mode: '0755'
- name: Unzip tun2socks
ansible.builtin.unarchive:
src: /tmp/tun2socks-linux-amd64.zip
dest: /usr/local/sbin/
remote_src: true
mode: '0755'
- name: Create proxy file
ansible.builtin.copy:
@ -274,6 +275,19 @@
name: tun2socks
state: restarted
- name: Check API availability for RPC URL
ansible.builtin.uri:
url: "{{ rpc_url }}/health?"
method: GET
return_content: true
timeout: 30
register: rpc_url_response
retries: 3
delay: 60
failed_when:
- rpc_url_response.status != 200
- rpc_url_response.json is not none and rpc_url_response.json is not defined
- name: Check external IP after
ansible.builtin.command: curl https://ifconfig.me
register: ip_after
@ -305,13 +319,18 @@
async: "{{ 60 * 80 }}"
poll: "{{ 60 }}"
- name: Install grist-api and colorama
ansible.builtin.command: pip3 install grist-api colorama --break-system-packages
args:
chdir: "{{ ansible_env.HOME }}/node"
changed_when: false
- name: Copy checker service file
ansible.builtin.copy:
dest: /etc/systemd/system/node-checker.service
dest: /etc/systemd/system/nillion-checker.service
content: |
[Unit]
Description=Node Checker Service
Description=Nillion Checker Service
After=network.target
[Service]
@ -330,9 +349,9 @@
ansible.builtin.systemd:
daemon_reload: yes
- name: Enable and start node-checker service
- name: Enable and start nillion-checker service
ansible.builtin.systemd:
name: node-checker
name: nillion-checker
enabled: yes
state: started

View File

@ -1,4 +1,4 @@
#!/bin/bash
curl -o /root/node/checker.py https://gitea.vvzvlad.xyz/vvzvlad/nexus/raw/branch/main/checker.py
curl -o /root/node/checker.py https://gitea.vvzvlad.xyz/vvzvlad/nillion/raw/branch/main/checker.py
python3 /root/node/checker.py

View File

@ -10,7 +10,7 @@ NEW_VALUE=$2
# Список файлов
FILES=(
"prover-id"
"credentials.json"
"docker-compose.yml"
"grist.json"
)