Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heaptrack builds non musl #21

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ resources/safe
*.orig
*.key
*.csr
heaptracks/*
33 changes: 24 additions & 9 deletions resources/ansible/logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
register: temp_dir

- name: copy logs to temporary directory
shell: cp -r /home/safe/.local/share/safe/node/* {{ temp_dir.stdout }}
shell: find /home/safe/.local/share/safe/node/ -name "safenode.log" -o -name "safenode.log*" -o -name "*.log" -exec cp {} {{ temp_dir.stdout }} \;

- name: retrieve list of log files from temporary directory
shell: find {{ temp_dir.stdout }} -name "*.log" -o -name "*.cash_note"
shell: find {{ temp_dir.stdout }} -name "safenode.log" -o -name "safenode.log*" -o -name "*.log" # -o -name "*.cash_note"
register: find_result
when: resources_only == "false"

Expand All @@ -31,13 +31,28 @@
with_items: "{{ find_result.stdout_lines }}"
when: resources_only == "false"

- name: fetch resource file
fetch:
src: "{{ item }}"
dest: "../../logs/{{env_name}}/"
flat: no
with_items: "{{ find_result_resource_only.stdout_lines }}"
when: resources_only == "true"
# - name: fetch resource file
# fetch:
# src: "{{ item }}"
# dest: "../../logs/{{env_name}}/"
# flat: no
# with_items: "{{ find_result_resource_only.stdout_lines }}"
# when: resources_only == "true"


# - name: copy heaptracks to temporary directory
# shell: cp -r /root/* {{ temp_dir.stdout }}

# - name: retrieve list of heaptrack files from temporary directory
# shell: find {{ temp_dir.stdout }} -name "heaptrack*"
# register: find_result_heaptrack

# - name: fetch each heaptrack
# fetch:
# src: "{{ item }}"
# dest: "../../logs/{{env_name}}/"
# flat: no
# with_items: "{{ find_result_heaptrack.stdout_lines }}"

- name: remove temporary directory
command: rm -rf {{ temp_dir.stdout }}
Expand Down
6 changes: 6 additions & 0 deletions resources/ansible/nodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@
name: systemd-journald
state: restarted
enabled: yes
# spawn extra heaptrack node
- name: spawn heaptracked node
become: True
ansible.builtin.shell: heaptrack safenode --peer {{genesis_multiaddr}} > /heaptrack-safenode.log 2>&1 &
async: 31536000 # This is a duration of 1 year
poll: 0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bin_name: safenode
org: maidsafe
branch: main
bin_archive_filename: "{{ bin_name }}-{{ testnet_name }}-x86_64-unknown-linux-musl.tar.gz"
bin_archive_filename: "{{ bin_name }}-{{ testnet_name }}-x86_64.tar.gz"
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
- name: "build {{ bin_name }} binary"
ansible.builtin.shell: |
source $HOME/.cargo/env
cargo build --target x86_64-unknown-linux-musl --release --bin {{bin_name}}
RUSTFLAGS="-C debuginfo=2" cargo build --release --bin {{bin_name}}
args:
chdir: "{{ ansible_env.HOME }}/safe_network"
creates: "{{ ansible_env.HOME }}/safe_network/target/x86_64-unknown-linux-musl/release/{{bin_name}}"
creates: "{{ ansible_env.HOME }}/safe_network/target/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 }}/safe_network/target/release"
cmd: cp {{bin_name}} /tmp/

- name: archive binary
Expand Down
2 changes: 1 addition & 1 deletion resources/ansible/roles/faucet/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
org: maidsafe
branch: main
faucet_archive_filename: faucet-{{ testnet_name }}-x86_64-unknown-linux-musl.tar.gz
faucet_archive_filename: faucet-{{ testnet_name }}-x86_64.tar.gz
faucet_archive_url: https://sn-node.s3.eu-west-2.amazonaws.com/{{ org }}/{{ branch }}/{{ faucet_archive_filename }}
faucet_archive_dest_path: /usr/local/bin
2 changes: 1 addition & 1 deletion resources/ansible/roles/faucet/templates/faucet.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description=Safe Faucet Service
[Service]
ExecStart={{ faucet_archive_dest_path }}/faucet \
--peer {{ genesis_multiaddr }} \
server
server
StandardOutput=journal
StandardError=inherit
User=safe
Expand Down
4 changes: 2 additions & 2 deletions resources/ansible/roles/node/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
is_genesis: False
otlp_endpoint: http://dev-testnet-infra-f2016fb1217aaf30.elb.eu-west-2.amazonaws.com:4317
node_archive_filename: safenode-latest-x86_64-unknown-linux-musl.tar.gz
node_archive_filename: safenode-latest-x86_64.tar.gz
node_archive_url: https://sn-node.s3.eu-west-2.amazonaws.com/{{ node_archive_filename }}
node_archive_dest_path: /usr/local/bin
node_port: 12000
Expand All @@ -10,4 +10,4 @@ node_instance_count: 20
node_data_dir_path: /home/safe/.local/share/safe/node/data
node_logs_dir_path: /home/safe/.local/share/safe/node/logs
rust_log_setting: safenode=trace
rust_log_otlp_setting: safenode=trace
rust_log_otlp_setting: safenode=trace
8 changes: 4 additions & 4 deletions resources/ansible/roles/rust/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
state: present
with_items:
- build-essential
- musl
- musl-tools
# - musl
# - musl-tools
register: result
until: result is succeeded
retries: 3
delay: 5

- name: install rustup and musl target
# rustup target add x86_64-unknown-linux-musl
- name: install rustup
ansible.builtin.shell: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y
source $HOME/.cargo/env
rustup target add x86_64-unknown-linux-musl
args:
creates: "{{ ansible_env.HOME }}/.cargo/env"
executable: /bin/bash
2 changes: 1 addition & 1 deletion resources/scripts/resource-usage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ while true; do
fi
rss=$(ps -p $pid -o rss=)
cpu=$(top -b -n1 -p $pid | awk 'NR>7 {print $9}')
count=$(find "$folder" -name '*' -not -name '*.pid' -type f | wc -l)
count=$(find "$folder/record_store" -name '*' -not -name '*.pid' -type f | wc -l)
printf "%-52s %-8s %-10s %-10s %s\n" \
"$peer_id" \
"$pid" \
Expand Down
2 changes: 1 addition & 1 deletion resources/terraform/testnet/digital-ocean/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ variable "droplet_ssh_keys" {
}

variable "droplet_size" {
default = "s-2vcpu-4gb"
default = "s-4vcpu-8gb"
}

variable "build_machine_size" {
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ impl TestnetDeploy {
let rpc_client_path = self.working_directory_path.join("safenode_rpc_client");
if !rpc_client_path.is_file() {
println!("Downloading the rpc client for safenode...");
let archive_name = "safenode_rpc_client-latest-x86_64-unknown-linux-musl.tar.gz";
let archive_name = "safenode_rpc_client-latest-x86_64.tar.gz";
get_and_extract_archive_from_s3(
&*self.s3_repository,
"sn-node-rpc-client",
Expand Down Expand Up @@ -816,7 +816,7 @@ impl TestnetDeploy {
&mut extra_vars,
"node_archive_url",
&format!(
"https://sn-node.s3.eu-west-2.amazonaws.com/{}/{}/safenode-{}-x86_64-unknown-linux-musl.tar.gz",
"https://sn-node.s3.eu-west-2.amazonaws.com/{}/{}/safenode-{}-x86_64.tar.gz",
repo_owner,
branch,
name),
Expand All @@ -827,7 +827,7 @@ impl TestnetDeploy {
&mut extra_vars,
"node_archive_url",
&format!(
"https://github.com/maidsafe/safe_network/releases/download/sn_node-v{version}/safenode-{version}-x86_64-unknown-linux-musl.tar.gz",
"https://github.com/maidsafe/safe_network/releases/download/sn_node-v{version}/safenode-{version}-x86_64.tar.gz",
),
);
}
Expand Down Expand Up @@ -890,7 +890,7 @@ impl TestnetDeploy {
&mut extra_vars,
"safenode_rpc_client_archive_url",
&format!(
"https://sn-node.s3.eu-west-2.amazonaws.com/{}/{}/safenode_rpc_client-{}-x86_64-unknown-linux-musl.tar.gz",
"https://sn-node.s3.eu-west-2.amazonaws.com/{}/{}/safenode_rpc_client-{}-x86_64.tar.gz",
repo_owner,
branch,
name),
Expand Down
4 changes: 2 additions & 2 deletions src/manage_test_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl TestDataClient {
get_and_extract_archive_from_s3(
s3_repository,
"sn-node",
&format!("{repo_owner}/{branch}/safe-{name}-x86_64-unknown-linux-musl.tar.gz"),
&format!("{repo_owner}/{branch}/safe-{name}-x86_64.tar.gz"),
working_directory_path,
)
.await?;
Expand All @@ -274,7 +274,7 @@ impl TestDataClient {
) -> Result<()> {
let safe_client_path = working_directory_path.join("safe");
if !safe_client_path.exists() {
let archive_name = format!("safe-{version}-x86_64-unknown-linux-musl.tar.gz");
let archive_name = format!("safe-{version}-x86_64.tar.gz");
let archive_path = working_directory_path.join(archive_name.clone());
let url = format!("{BASE_URL}/sn_cli-v{version}/{archive_name}");
println!("url = {url}");
Expand Down
2 changes: 1 addition & 1 deletion src/ssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl SshClientInterface for SshClient {
suppress_output,
)
.map_err(|e| {
Error::SshCommandFailed(format!("Failed to copy script file to remote host: {e}"))
Error::SshCommandFailed(format!("Failed to copy script file to remote host {ip_address:?}: {e}"))
})?;

let args = vec![
Expand Down