From 583a24942f561cf3feb290677f5a21aa1a853e37 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Mon, 2 Oct 2023 12:58:48 +0200 Subject: [PATCH 01/10] heaptrack builds non musl --- .DS_Store | Bin 0 -> 6148 bytes .gitignore | 1 + resources/ansible/logs.yml | 15 +++++++++++++++ resources/ansible/nodes.yml | 6 ++++++ .../build_safe_network_binary/defaults/main.yml | 2 +- .../build_safe_network_binary/tasks/main.yml | 6 +++--- resources/ansible/roles/faucet/defaults/main.yml | 2 +- .../roles/faucet/templates/faucet.service.j2 | 2 +- resources/ansible/roles/node/defaults/main.yml | 4 ++-- resources/ansible/roles/rust/tasks/main.yml | 8 ++++---- src/lib.rs | 6 +++--- src/manage_test_data.rs | 4 ++-- 12 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 /heaptrack-safenode.log 2>&1 & + async: 31536000 # This is a duration of 1 year + poll: 0 \ No newline at end of file diff --git a/resources/ansible/roles/build_safe_network_binary/defaults/main.yml b/resources/ansible/roles/build_safe_network_binary/defaults/main.yml index d878eb75..afe92f31 100644 --- a/resources/ansible/roles/build_safe_network_binary/defaults/main.yml +++ b/resources/ansible/roles/build_safe_network_binary/defaults/main.yml @@ -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" diff --git a/resources/ansible/roles/build_safe_network_binary/tasks/main.yml b/resources/ansible/roles/build_safe_network_binary/tasks/main.yml index bb72d9d5..0c05e90c 100644 --- a/resources/ansible/roles/build_safe_network_binary/tasks/main.yml +++ b/resources/ansible/roles/build_safe_network_binary/tasks/main.yml @@ -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 diff --git a/resources/ansible/roles/faucet/defaults/main.yml b/resources/ansible/roles/faucet/defaults/main.yml index 74015032..c56e1b17 100644 --- a/resources/ansible/roles/faucet/defaults/main.yml +++ b/resources/ansible/roles/faucet/defaults/main.yml @@ -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 diff --git a/resources/ansible/roles/faucet/templates/faucet.service.j2 b/resources/ansible/roles/faucet/templates/faucet.service.j2 index 88565950..0c232390 100644 --- a/resources/ansible/roles/faucet/templates/faucet.service.j2 +++ b/resources/ansible/roles/faucet/templates/faucet.service.j2 @@ -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 diff --git a/resources/ansible/roles/node/defaults/main.yml b/resources/ansible/roles/node/defaults/main.yml index 6e949f1d..eb9042d3 100644 --- a/resources/ansible/roles/node/defaults/main.yml +++ b/resources/ansible/roles/node/defaults/main.yml @@ -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 @@ -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 \ No newline at end of file diff --git a/resources/ansible/roles/rust/tasks/main.yml b/resources/ansible/roles/rust/tasks/main.yml index 12523493..b22c1880 100644 --- a/resources/ansible/roles/rust/tasks/main.yml +++ b/resources/ansible/roles/rust/tasks/main.yml @@ -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 diff --git a/src/lib.rs b/src/lib.rs index 56b8a34f..8c1578f1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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", @@ -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), @@ -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", ), ); } diff --git a/src/manage_test_data.rs b/src/manage_test_data.rs index 96fd8ce6..29495ab4 100644 --- a/src/manage_test_data.rs +++ b/src/manage_test_data.rs @@ -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?; @@ -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}"); From 255b51f8d62131f167ac0a6d8e87626ad1e8dd35 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Sun, 29 Oct 2023 14:05:51 +0100 Subject: [PATCH 02/10] reduce log CN copying --- resources/ansible/logs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/ansible/logs.yml b/resources/ansible/logs.yml index a9c4283d..cdba68a2 100644 --- a/resources/ansible/logs.yml +++ b/resources/ansible/logs.yml @@ -11,7 +11,7 @@ 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 "*.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" From 29ac97aed161cd217a5723d5489d77ed0604a38b Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Thu, 2 Nov 2023 12:04:28 +0100 Subject: [PATCH 03/10] rpc --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 8c1578f1..66d588d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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), From 6990a35e3644948167d1310954c403a40b290f42 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Wed, 15 Nov 2023 11:45:02 +0100 Subject: [PATCH 04/10] log err --- src/ssh.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ssh.rs b/src/ssh.rs index c0da2d93..8fa8cabb 100644 --- a/src/ssh.rs +++ b/src/ssh.rs @@ -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![ From b42ada72123e5d3e9504a311fe99deade09cceb6 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Thu, 16 Nov 2023 20:24:06 +0100 Subject: [PATCH 05/10] more reliable --- resources/ansible/logs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/ansible/logs.yml b/resources/ansible/logs.yml index cdba68a2..3fcec8fb 100644 --- a/resources/ansible/logs.yml +++ b/resources/ansible/logs.yml @@ -44,7 +44,7 @@ shell: cp -r /root/* {{ temp_dir.stdout }} - name: retrieve list of heaptrack files from temporary directory - shell: find {{ temp_dir.stdout }} -name heaptrack* + shell: find {{ temp_dir.stdout }} -name "heaptrack*" register: find_result_heaptrack - name: fetch each heaptrack From cf122522df18a18d6f35c4f2abdbe30e65283781 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Fri, 17 Nov 2023 10:19:56 +0100 Subject: [PATCH 06/10] better log pull --- resources/ansible/logs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/ansible/logs.yml b/resources/ansible/logs.yml index 3fcec8fb..1552e27f 100644 --- a/resources/ansible/logs.yml +++ b/resources/ansible/logs.yml @@ -11,10 +11,10 @@ register: temp_dir - name: copy logs to temporary directory - shell: find /home/safe/.local/share/safe/node/ -name "*.log" -exec cp {} {{ temp_dir.stdout }} \; + shell: find /home/safe/.local/share/safe/node/ -name "safenode.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 "*.cash_note" register: find_result when: resources_only == "false" From 86daab5ee28ceebcc84456ebd2146f3f6cf3d4b5 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Tue, 21 Nov 2023 13:04:45 +0100 Subject: [PATCH 07/10] log --- resources/ansible/logs.yml | 2 +- resources/terraform/testnet/digital-ocean/variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/ansible/logs.yml b/resources/ansible/logs.yml index 1552e27f..835a8228 100644 --- a/resources/ansible/logs.yml +++ b/resources/ansible/logs.yml @@ -11,7 +11,7 @@ register: temp_dir - name: copy logs to temporary directory - shell: find /home/safe/.local/share/safe/node/ -name "safenode.log*" -exec cp {} {{ 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 "safenode.log*" # -o -name "*.cash_note" diff --git a/resources/terraform/testnet/digital-ocean/variables.tf b/resources/terraform/testnet/digital-ocean/variables.tf index d07004bb..e24bbd86 100644 --- a/resources/terraform/testnet/digital-ocean/variables.tf +++ b/resources/terraform/testnet/digital-ocean/variables.tf @@ -17,7 +17,7 @@ variable "droplet_ssh_keys" { } variable "droplet_size" { - default = "s-2vcpu-4gb" + default = "s-4vcpu-8gb" } variable "build_machine_size" { From 8e49dd460a803e37d423982da3adabb6e0ad2ba7 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Wed, 22 Nov 2023 10:37:01 +0100 Subject: [PATCH 08/10] badlogs --- resources/ansible/logs.yml | 2 +- resources/scripts/resource-usage.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/ansible/logs.yml b/resources/ansible/logs.yml index 835a8228..8f1c70f3 100644 --- a/resources/ansible/logs.yml +++ b/resources/ansible/logs.yml @@ -14,7 +14,7 @@ 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 "safenode.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" diff --git a/resources/scripts/resource-usage.sh b/resources/scripts/resource-usage.sh index f900849b..7ac68397 100644 --- a/resources/scripts/resource-usage.sh +++ b/resources/scripts/resource-usage.sh @@ -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" \ From 7fe2764d3546667d595962d01f784c335355c78c Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Thu, 23 Nov 2023 07:42:56 +0100 Subject: [PATCH 09/10] noheap --- resources/ansible/logs.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/resources/ansible/logs.yml b/resources/ansible/logs.yml index 8f1c70f3..8289e34d 100644 --- a/resources/ansible/logs.yml +++ b/resources/ansible/logs.yml @@ -40,19 +40,19 @@ when: resources_only == "true" - - name: copy heaptracks to temporary directory - shell: cp -r /root/* {{ temp_dir.stdout }} + # - 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: 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: 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 }} From 8687f704658bea5990337e7f436d75f370e8d04f Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Thu, 23 Nov 2023 12:25:37 +0100 Subject: [PATCH 10/10] x --- resources/ansible/logs.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/ansible/logs.yml b/resources/ansible/logs.yml index 8289e34d..049dbcf3 100644 --- a/resources/ansible/logs.yml +++ b/resources/ansible/logs.yml @@ -31,13 +31,13 @@ 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