From 718946c5b1d6d09bdbd1833117a90a487bb68ab1 Mon Sep 17 00:00:00 2001 From: Rossignolskier Date: Fri, 30 Aug 2024 21:16:53 +0200 Subject: [PATCH] use venv for monitoring --- roles/configure_ubuntu/tasks/packages.yaml | 1 + .../tasks/install_monitoring_script.yaml | 24 +++++++++---------- roles/monitoring/tasks/packages.yaml | 1 + .../monitoring/templates/output_starter.sh.j2 | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/roles/configure_ubuntu/tasks/packages.yaml b/roles/configure_ubuntu/tasks/packages.yaml index 1fbb485..9674d62 100644 --- a/roles/configure_ubuntu/tasks/packages.yaml +++ b/roles/configure_ubuntu/tasks/packages.yaml @@ -19,6 +19,7 @@ - gpg-agent - python3 - python3-pip + - python3-venv - ufw - rsyslog tags: diff --git a/roles/monitoring/tasks/install_monitoring_script.yaml b/roles/monitoring/tasks/install_monitoring_script.yaml index e9dea73..6efc302 100644 --- a/roles/monitoring/tasks/install_monitoring_script.yaml +++ b/roles/monitoring/tasks/install_monitoring_script.yaml @@ -1,14 +1,4 @@ --- -- name: Install python packages - pip: - name: - - requests - - numpy - state: present - executable: pip3 - tags: - monitoring.script - - name: Delete script folder file: path: "{{ solana_home }}/monitoring" @@ -26,6 +16,17 @@ tags: monitoring.script +- name: Install python packages + pip: + name: + - requests + - numpy + state: present + virtualenv: "{{ solana_home }}/monitoring" + # executable: pip3 + tags: + monitoring.script + - name: ensure secrets_path exists stat: path: "{{ secrets_path }}" @@ -72,13 +73,10 @@ - "measurement_validator_info.py" - "output_gossip.py" - "output_validator_measurements.py" - - "output_tds_measurements.py" - "output_validators_info.py" - "output_validators.py" - "request_utils.py" - "solana_rpc.py" - - "tds_info.py" - - "measurement_tds_info.py" - "validator_monitoring.py" tags: - monitoring.script diff --git a/roles/monitoring/tasks/packages.yaml b/roles/monitoring/tasks/packages.yaml index 51ffb17..da89bd7 100644 --- a/roles/monitoring/tasks/packages.yaml +++ b/roles/monitoring/tasks/packages.yaml @@ -10,6 +10,7 @@ - gpg-agent - python3 - python3-pip + - python3-virtualenv - coreutils tags: - config.packages diff --git a/roles/monitoring/templates/output_starter.sh.j2 b/roles/monitoring/templates/output_starter.sh.j2 index 218d4ea..5ae78b1 100644 --- a/roles/monitoring/templates/output_starter.sh.j2 +++ b/roles/monitoring/templates/output_starter.sh.j2 @@ -1,5 +1,5 @@ #!/bin/bash - +source "{{ solana_home }}/monitoring/bin/activate" result=$(timeout -k 50 45 python3 "{{ solana_home }}/monitoring/$1.py") if [ -z "${result}" ]