Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
aa24574319 | ||
|
20a8d423aa | ||
|
91914d9486 | ||
|
1f5ba5ff58 | ||
|
3f4b1b51c0 | ||
|
f580f41130 | ||
|
5fa7675387 | ||
|
b5ac0b38f3 | ||
|
3cc574a592 |
@ -101,7 +101,7 @@ def check_logs(log_handler):
|
||||
proof_speeds = deque(maxlen=100)
|
||||
|
||||
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
|
||||
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": avg_proof_speed
|
||||
"proof_speed": int(avg_proof_speed)
|
||||
}
|
||||
log_handler.info(f"Result: {data}")
|
||||
return data
|
||||
|
@ -1,11 +1,12 @@
|
||||
#docker build -t nexus-image .
|
||||
|
||||
services:
|
||||
nexus-prover:
|
||||
image: nexus-image
|
||||
container_name: nexus-prover
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /root/prover-id:/root/.nexus/prover-id
|
||||
- /root/node/prover-id:/root/.nexus/prover-id
|
||||
logging:
|
||||
driver: "none"
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-file: 2
|
||||
max-size: 1m
|
213
playbook.yml
213
playbook.yml
@ -1,4 +1,4 @@
|
||||
- name: Nillion deployment playbook
|
||||
- name: Deployment playbook
|
||||
hosts: all
|
||||
become: true
|
||||
vars:
|
||||
@ -11,7 +11,7 @@
|
||||
create: yes
|
||||
block: |
|
||||
#1724983098
|
||||
cd /root/node/ ; docker compose logs -f
|
||||
cd /root/node/ ; docker compose logs --since 3h -f
|
||||
marker: ""
|
||||
|
||||
- name: Set locale to C.UTF-8
|
||||
@ -80,71 +80,68 @@
|
||||
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 }}"
|
||||
#- 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 }}"
|
||||
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: 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 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: 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: Update Docker daemon journald logging
|
||||
# ansible.builtin.copy:
|
||||
# dest: /etc/docker/daemon.json
|
||||
# content: |
|
||||
# { "log-driver": "journald" }
|
||||
# mode: '0644'
|
||||
|
||||
- name: Docker login
|
||||
ansible.builtin.shell: docker login -u "{{ docker_username }}" -p "{{ docker_password }}"
|
||||
@ -152,14 +149,23 @@
|
||||
changed_when: false
|
||||
failed_when: "'Login Succeeded' not in docker_login_result.stdout"
|
||||
|
||||
- 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: 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: Make update.sh executable
|
||||
ansible.builtin.shell: |
|
||||
@ -170,10 +176,7 @@
|
||||
|
||||
- name: Update environment variables
|
||||
ansible.builtin.shell: |
|
||||
./update.sh ADDRESS "{{ address }}"
|
||||
./update.sh PRIVATE "{{ private_key }}"
|
||||
./update.sh PUBLIC "{{ public_key }}"
|
||||
./update.sh RPC "{{ rpc_url }}"
|
||||
./update.sh ID "{{ id }}"
|
||||
./update.sh GRIST_SERVER "{{ grist_server }}"
|
||||
./update.sh GRIST_DOC_ID "{{ grist_doc_id }}"
|
||||
./update.sh GRIST_API_KEY "{{ grist_api_key }}"
|
||||
@ -181,15 +184,11 @@
|
||||
chdir: "{{ ansible_env.HOME }}/node"
|
||||
changed_when: false
|
||||
|
||||
- name: Download dockers images
|
||||
ansible.builtin.command: docker compose pull
|
||||
- name: Build dockers images
|
||||
ansible.builtin.command: docker build -t nexus-image .
|
||||
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
|
||||
@ -203,20 +202,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:
|
||||
@ -275,19 +274,6 @@
|
||||
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
|
||||
@ -319,18 +305,13 @@
|
||||
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/nillion-checker.service
|
||||
dest: /etc/systemd/system/node-checker.service
|
||||
content: |
|
||||
[Unit]
|
||||
Description=Nillion Checker Service
|
||||
Description=Node Checker Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
@ -349,9 +330,9 @@
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: yes
|
||||
|
||||
- name: Enable and start nillion-checker service
|
||||
- name: Enable and start node-checker service
|
||||
ansible.builtin.systemd:
|
||||
name: nillion-checker
|
||||
name: node-checker
|
||||
enabled: yes
|
||||
state: started
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/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
|
||||
|
Loading…
Reference in New Issue
Block a user