Skip to content

Commit

Permalink
chore: replace old binary/repo references
Browse files Browse the repository at this point in the history
Various things were updated in accordance with the branding alignment for the binaries and
repository:

* Renamed version arguments on various commands from `safe` -> `ant`
* Renamed version variables/arguments/fields from `safe` -> `ant`
* Ansible: renamed `safe_user` role -> `ant_user`
* Ansible: renamed `node-manager` role -> `antctl`
* General: updated lots of small references over the whole codebase, from `safe` -> `ant`.
  • Loading branch information
jacderida committed Dec 5, 2024
1 parent 4544a43 commit 833e4de
Show file tree
Hide file tree
Showing 45 changed files with 1,688 additions and 1,400 deletions.
2,035 changes: 1,188 additions & 847 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ name="testnet-deploy"

[dependencies]
alloy = { version = "0.5.3", default-features = false, features = ["signers"] }
ant-releases = { git = "https://github.com/jacderida/ant-releases.git", branch = "chore-rename_binaries" }
ant-service-management = { git = "https://github.com/maidsafe/autonomi.git", branch = "main" }
async-recursion = "1.0.4"
aws-config = "0.56.0"
aws-sdk-s3 = "0.29.0"
Expand All @@ -32,6 +34,9 @@ libp2p = { version = "0.54.1", features = [] }
log = "0.4"
indicatif = "0.17.3"
inquire = "0.6.2"
# watch out updating this, protoc compiler needs to be installed on all build systems
# arm builds + musl are very problematic
prost = { version = "0.9" }
rand = "0.8.5"
rayon = "1.8.0"
regex = "1.9.5"
Expand All @@ -40,18 +45,13 @@ sha2 = "0.10.7"
semver = { version = "1.0.20", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "~1.0.108"
sn_service_management = "~0.2.8"
sn-releases = "0.3.1"
thiserror = "1.0.23"
tar = "0.4"
tempfile = "3.8.0"
tokio = { version = "1.26", features = ["full"] }
tokio-stream = "0.1.14"
walkdir = "~2.5.0"
# watch out updating this, protoc compiler needs to be installed on all build systems
# arm builds + musl are very problematic
prost = { version = "0.9" }
tonic = { version = "0.6.2" }
walkdir = "~2.5.0"

[dev-dependencies]
httpmock = "0.6"
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
- name: fetch node manager inventory from remote machines
- name: fetch antctl inventory from remote machines
hosts: all
ignore_unreachable: yes
max_fail_percentage: 10
tasks:
- name: check if node registry file exists
stat:
path: "/var/safenode-manager/node_registry.json"
path: "/var/antctl/node_registry.json"
register: file_stat

- name: fetch inventory file
fetch:
src: "/var/safenode-manager/node_registry.json"
src: "/var/antctl/node_registry.json"
dest: "{{dest}}"
flat: no
validate_checksum: no
Expand Down
14 changes: 4 additions & 10 deletions resources/ansible/build.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
---
# We always build the faucet binary, but safenode only applies for using a custom branch.
- name: build binaries
hosts: all
become: False
roles:
- {
role: build_safe_network_binary,
bin_name: "autonomi",
bin_name: "ant",
when: custom_bin == "true"
}
- {
role: build_safe_network_binary,
bin_name: "safenode",
bin_name: "antnode",
when: custom_bin == "true"
}
- {
role: build_safe_network_binary,
bin_name: "safenode_rpc_client",
bin_name: "antctl",
when: custom_bin == "true"
}
- {
role: build_safe_network_binary,
bin_name: "safenode-manager",
when: custom_bin == "true"
}
- {
role: build_safe_network_binary,
bin_name: "safenodemand",
bin_name: "antctld",
when: custom_bin == "true"
}
6 changes: 3 additions & 3 deletions resources/ansible/cleanup_logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
tasks:
- name: remove rotated logs
shell: |
for file in $(find /mnt/safenode-storage/log/safenode/ -name "*.gz"); do
for file in $(find /mnt/antnode-storage/log/antnode/ -name "*.gz"); do
rm $file
done
- name: setup cron job to remove rotated logs every 10 minutes
ansible.builtin.cron:
name: "cleanup_logs"
minute: "*/10"
job: "find /mnt/safenode-storage/log/safenode/ -name \"*.gz\" -exec rm {} \\;"
job: "find /mnt/antnode-storage/log/antnode/ -name \"*.gz\" -exec rm {} \\;"
state: present
when: setup_cron == "true"
when: setup_cron == "true"
4 changes: 2 additions & 2 deletions resources/ansible/evm_nodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
max_fail_percentage: 10
ignore_unreachable: yes
roles:
- safe_user
- ant_user
- evm_node
tasks:
# Something is wrong with the journal service on Ubuntu that causes no
Expand All @@ -16,4 +16,4 @@
ansible.builtin.systemd:
name: systemd-journald
state: restarted
enabled: yes
enabled: yes
4 changes: 2 additions & 2 deletions resources/ansible/genesis_node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
vars:
is_genesis: True
roles:
- role: safe_user
- role: ant_user
become: True
- role: attach_volume
become: True
Expand All @@ -28,5 +28,5 @@
{ name: "{{ node_data_mount_path }}", owner: "root", group: "root", mode: 0755 },
when: provider == "aws"
}
- node-manager
- antctl
- genesis-node
19 changes: 3 additions & 16 deletions resources/ansible/nodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@
mode: 0644
when: logstash_stack_name is defined and logstash_stack_name | length > 0

- name: deploy safenode to remaining nodes
- name: deploy antnode to remaining nodes
hosts: all
become: False
max_fail_percentage: 10
ignore_unreachable: yes
vars:
is_genesis: False
safenode_rpc_client_archive_filename: safenode_rpc_client-latest-x86_64-unknown-linux-musl.tar.gz
safenode_rpc_client_archive_url: https://sn-node-rpc-client.s3.eu-west-2.amazonaws.com/{{ safenode_rpc_client_archive_filename }}
roles:
- role: safe_user
- role: ant_user
become: True
- role: attach_volume
become: True
Expand All @@ -34,7 +32,7 @@
{ name: "{{ node_data_mount_path }}", owner: "root", group: "root", mode: 0755 },
when: provider == "aws"
}
- node-manager
- antctl
- {
role: private_node,
become: True,
Expand All @@ -54,17 +52,6 @@
name: systemd-journald
state: restarted
enabled: yes
# The RPC client is setup on all nodes for use with the metrics solution
- name: get the latest version or a custom build of the RPC client
ansible.builtin.get_url:
url: "{{ safenode_rpc_client_archive_url }}"
dest: /tmp/{{ safenode_rpc_client_archive_filename }}
- name: extract the RPC client binary to /usr/local/bin
become: True
ansible.builtin.unarchive:
src: "/tmp/{{ safenode_rpc_client_archive_filename }}"
dest: /usr/local/bin
remote_src: True
- name: restart telegraf
become: True
ansible.builtin.systemd:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
- name: user for running node
ansible.builtin.user:
name: safe
name: ant
shell: /bin/bash

- name: create .ssh directory for safe user
- name: create .ssh directory for ant user
ansible.builtin.file:
path: /home/safe/.ssh
owner: safe
group: safe
path: /home/ant/.ssh
owner: ant
group: ant
state: directory
mode: '0755'

# This is necessary for the logstash service, which runs as the logstash user, to
# read the log files under /home/safe/.local/share/safe/node.
# read the log files under /home/ant/.local/share/ant/node.
- name: make home directory accessible for logstash user
ansible.builtin.file:
path: /home/safe
path: /home/ant
mode: '0755'

# This is a bit of a hack, but it allows the `safe` user to have SSH access using the same
# This is a bit of a hack, but it allows the `ant` user to have SSH access using the same
# authorized_keys, which is useful for running utility scripts.
- name: create .ssh directory for safe user
- name: create .ssh directory for ant user
ansible.builtin.file:
path: /home/safe/.ssh
owner: safe
group: safe
path: /home/ant/.ssh
owner: ant
group: ant
state: directory
mode: '0755'
when: provider == "digital-ocean"

- name: copy authorized_keys to safe user
- name: copy authorized_keys to ant user
ansible.builtin.copy:
src: /root/.ssh/authorized_keys
dest: /home/safe/.ssh/authorized_keys
owner: safe
group: safe
dest: /home/ant/.ssh/authorized_keys
owner: ant
group: ant
remote_src: true
mode: '0600'
when: provider == "digital-ocean"
9 changes: 9 additions & 0 deletions resources/ansible/roles/antctl/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
public_rpc: False
node_rpc_ip: "127.0.0.1"
node_instance_count: 20
binary_dir: /usr/local/bin
antctl_archive_filename: antctl-latest-x86_64-unknown-linux-musl.tar.gz
antctl_archive_url: https://antctl.s3.eu-west-2.amazonaws.com/{{ antctl_archive_filename }}
antctld_archive_filename: antctld-latest-x86_64-unknown-linux-musl.tar.gz
antctld_archive_url: https://antctld.s3.eu-west-2.amazonaws.com/{{ antctld_archive_filename }}
52 changes: 52 additions & 0 deletions resources/ansible/roles/antctl/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
- name: check if antctl binary exists
ansible.builtin.stat:
path: "{{ binary_dir}}/antctl"
register: antctl_binary

- name: get the private IP for the instance
set_fact:
node_rpc_ip: "{{ instance_facts.instances[0].network_interfaces[0].private_ip_address }}"
when: provider == "aws" and public_rpc and not antctl_binary.stat.exists

- name: use the public IP as the RPC address on DO
set_fact:
node_rpc_ip: "{{ ansible_host }}"
when: provider == "digital-ocean" and public_rpc and not antctl_binary.stat.exists

- name: download the antctl binary
ansible.builtin.get_url:
url: "{{ antctl_archive_url }}"
dest: /tmp/{{ antctl_archive_filename }}
when: not antctl_binary.stat.exists

- name: extract the antctl binary to /usr/local/bin
become: True
ansible.builtin.unarchive:
src: "/tmp/{{ antctl_archive_filename }}"
dest: "{{ binary_dir }}"
remote_src: True
when: not antctl_binary.stat.exists

- name: download the antctld binary
ansible.builtin.get_url:
url: "{{ antctld_archive_url }}"
dest: /tmp/{{ antctld_archive_filename }}
when: not antctl_binary.stat.exists

- name: extract the antctld binary to /tmp/antctld
become: True
ansible.builtin.unarchive:
src: "/tmp/{{ antctld_archive_filename }}"
dest: /tmp/
remote_src: True
when: not antctl_binary.stat.exists

- name: add antctld
become: true
command: antctl -v daemon add --address {{ node_rpc_ip }} --path /tmp/antctld
when: not antctl_binary.stat.exists

- name: start antctld
become: true
command: antctl -v daemon start
10 changes: 5 additions & 5 deletions resources/ansible/roles/attach_volume/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,18 @@
when: not volume_in_fstab

- name: create dir for mount point
command: mkdir -p /mnt/safenode-storage
command: mkdir -p /mnt/antnode-storage
when: not volume_in_fstab

- name: create subdirs
command: mkdir -p /mnt/safenode-storage/{{ item }}
command: mkdir -p /mnt/antnode-storage/{{ item }}
loop:
- data
- log
when: not volume_in_fstab

- name: mount the logical volume
command: mount -o discard,defaults,noatime /dev/lvm_vol_group/striped_logical_volume /mnt/safenode-storage
command: mount -o discard,defaults,noatime /dev/lvm_vol_group/striped_logical_volume /mnt/antnode-storage
when: not volume_in_fstab

- name: check fstab
Expand All @@ -90,5 +90,5 @@
when: not volume_in_fstab

- name: change fstab so the volume will be mounted after a reboot
command: echo '/dev/lvm_vol_group/striped_logical_volume /mnt/safenode-storage ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
when: not volume_added_to_fstab and not volume_in_fstab
command: echo '/dev/lvm_vol_group/striped_logical_volume /mnt/antnode-storage ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
when: not volume_added_to_fstab and not volume_in_fstab
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bin_name: safenode
bin_name: antnode
org: maidsafe
branch: main
# The archive is stored inside "https://sn-node.s3.eu-west-2.amazonaws.com/{org}/{branch}/{bin_name}-{testnet_name}-x86_64-unknown-linux-musl.tar.gz"
bin_archive_filename: "{{ bin_name }}-{{ testnet_name }}-x86_64-unknown-linux-musl.tar.gz"
# csv of the features that you want to enable on safenode. By default, none of the features are enabled.
safenode_features_list: ""
antnode_features_list: ""
18 changes: 8 additions & 10 deletions resources/ansible/roles/build_safe_network_binary/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set_fact:
aws_secret_key: "{{ lookup('file', 'files/s3_deploy_secret_access_key') }}"

- name: clone safe_network repo
- name: clone autonomi repo
ansible.builtin.git:
repo: https://github.com/{{ org }}/safe_network
repo: https://github.com/{{ org }}/autonomi
version: "{{ branch }}"
dest: "{{ ansible_env.HOME }}/safe_network"
dest: "{{ ansible_env.HOME }}/autonomi"

# only enable safenode features
- name: "build {{ bin_name }} binary"
Expand All @@ -34,21 +34,19 @@
export PAYMENT_FORWARD_PK={{ payment_forward_pk }}
{% endif %}
{% if bin_name == 'safenode' and safenode_features_list != "" %}
cargo build --target x86_64-unknown-linux-musl --release --bin {{bin_name}} --no-default-features --features={{safenode_features_list}}
{% elif bin_name == 'faucet' %}
cargo build --target x86_64-unknown-linux-musl --release --bin {{bin_name}} --features="distribution"
{% if bin_name == 'antnode' and antnode_features_list != "" %}
cargo build --target x86_64-unknown-linux-musl --release --bin {{bin_name}} --no-default-features --features={{antnode_features_list}}
{% else %}
cargo build --target x86_64-unknown-linux-musl --release --bin {{bin_name}}
{% endif %}
args:
chdir: "{{ ansible_env.HOME }}/safe_network"
creates: "{{ ansible_env.HOME }}/safe_network/target/x86_64-unknown-linux-musl/release/{{bin_name}}"
chdir: "{{ ansible_env.HOME }}/autonomi"
creates: "{{ ansible_env.HOME }}/autonomi/target/x86_64-unknown-linux-musl/release/{{bin_name}}"
executable: /bin/bash

- name: copy binary to tmp directory
ansible.builtin.command:
chdir: "{{ ansible_env.HOME }}/safe_network/target/x86_64-unknown-linux-musl/release"
chdir: "{{ ansible_env.HOME }}/autonomi/target/x86_64-unknown-linux-musl/release"
cmd: cp {{bin_name}} /tmp/

- name: archive binary
Expand Down
Loading

0 comments on commit 833e4de

Please sign in to comment.