Compare commits

...

9 Commits
master ... main

Author SHA1 Message Date
vvzvlad
aa24574319 update playbook 2024-12-12 19:23:21 +03:00
vvzvlad
20a8d423aa remove upgrade target 2024-12-12 15:41:25 +03:00
vvzvlad
91914d9486 fix error 2024-12-12 03:35:36 +03:00
vvzvlad
1f5ba5ff58 playbook update 2024-12-12 03:23:39 +03:00
vvzvlad
3f4b1b51c0 update checker 2024-12-12 03:04:07 +03:00
vvzvlad
f580f41130 change to 2h 2024-12-12 03:03:22 +03:00
vvzvlad
5fa7675387 update compose 2024-12-12 03:01:47 +03:00
vvzvlad
b5ac0b38f3 update playbook 2024-12-12 02:58:07 +03:00
vvzvlad
3cc574a592 update 2024-12-12 02:32:36 +03:00
5 changed files with 106 additions and 124 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', '24h'], cwd='/root/node/', capture_output=True, text=True, check=True) logs = subprocess.run(['docker', 'compose', 'logs', '--since', '2h'], 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": avg_proof_speed "proof_speed": int(avg_proof_speed)
} }
log_handler.info(f"Result: {data}") log_handler.info(f"Result: {data}")
return data return data

View File

@ -1,11 +1,12 @@
#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/prover-id:/root/.nexus/prover-id - /root/node/prover-id:/root/.nexus/prover-id
logging: logging:
driver: "none" driver: "json-file"
options:
max-file: 2
max-size: 1m

View File

@ -1,4 +1,4 @@
- name: Nillion deployment playbook - name: 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 -f cd /root/node/ ; docker compose logs --since 3h -f
marker: "" marker: ""
- name: Set locale to C.UTF-8 - name: Set locale to C.UTF-8
@ -80,71 +80,68 @@
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 packages #- name: Install grist-api and colorama (attempt 1)
ansible.builtin.apt: # ansible.builtin.command: pip3 install grist-api colorama --break-system-packages
name: # args:
- ca-certificates # chdir: "{{ ansible_env.HOME }}/node"
- zlib1g-dev # changed_when: false
- 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 }}"
@ -152,14 +149,23 @@
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: Clone repository #- name: Restart Docker
ansible.builtin.git: # ansible.builtin.service:
repo: https://gitea.vvzvlad.xyz/vvzvlad/nillion # name: docker
dest: "{{ ansible_env.HOME }}/node" # state: restarted
version: "{{ git_version }}"
force: true #- name: Update journald log SystemMaxUse=2G configuration
async: "{{ 60 * 15 }}" # ansible.builtin.lineinfile:
poll: 30 # 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: Make update.sh executable - name: Make update.sh executable
ansible.builtin.shell: | ansible.builtin.shell: |
@ -170,10 +176,7 @@
- name: Update environment variables - name: Update environment variables
ansible.builtin.shell: | ansible.builtin.shell: |
./update.sh ADDRESS "{{ address }}" ./update.sh ID "{{ id }}"
./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 }}"
@ -181,15 +184,11 @@
chdir: "{{ ansible_env.HOME }}/node" chdir: "{{ ansible_env.HOME }}/node"
changed_when: false changed_when: false
- name: Download dockers images - name: Build dockers images
ansible.builtin.command: docker compose pull ansible.builtin.command: docker build -t nexus-image .
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
@ -203,20 +202,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:
@ -275,19 +274,6 @@
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
@ -319,18 +305,13 @@
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/nillion-checker.service dest: /etc/systemd/system/node-checker.service
content: | content: |
[Unit] [Unit]
Description=Nillion Checker Service Description=Node Checker Service
After=network.target After=network.target
[Service] [Service]
@ -349,9 +330,9 @@
ansible.builtin.systemd: ansible.builtin.systemd:
daemon_reload: yes daemon_reload: yes
- name: Enable and start nillion-checker service - name: Enable and start node-checker service
ansible.builtin.systemd: ansible.builtin.systemd:
name: nillion-checker name: node-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/nillion/raw/branch/main/checker.py curl -o /root/node/checker.py https://gitea.vvzvlad.xyz/vvzvlad/nexus/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=(
"credentials.json" "prover-id"
"docker-compose.yml" "docker-compose.yml"
"grist.json" "grist.json"
) )