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) proof_speeds = deque(maxlen=100)
try: 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 log_content = logs.stdout
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
raise RuntimeError(f"Error running docker compose logs: {e}") from e raise RuntimeError(f"Error running docker compose logs: {e}") from e
@ -127,7 +127,7 @@ def check_logs(log_handler):
data = { data = {
"errors": error_count, "errors": error_count,
"proved_steps": proved_count/10, "proved_steps": proved_count/10,
"proof_speed": int(avg_proof_speed) "proof_speed": avg_proof_speed
} }
log_handler.info(f"Result: {data}") log_handler.info(f"Result: {data}")
return data return data

View File

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

View File

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

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/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 python3 /root/node/checker.py

View File

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