From 450d2e8adf52c0eecdeba7faca1c4054b7b2d67b Mon Sep 17 00:00:00 2001 From: apoorvsadana <95699312+apoorvsadana@users.noreply.github.com> Date: Fri, 26 Jan 2024 20:22:43 +0530 Subject: [PATCH] logs, prometheus expose --- src/cli/run.rs | 1 + src/da/avail.rs | 8 ++++++-- src/utils/cmd.rs | 12 +++++++++--- src/utils/docker.rs | 4 ++-- src/utils/madara.rs | 11 +++++++++-- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/cli/run.rs b/src/cli/run.rs index 26781b9..1d8a077 100644 --- a/src/cli/run.rs +++ b/src/cli/run.rs @@ -23,6 +23,7 @@ pub enum RunError { #[error(transparent)] Other(#[from] eyre::Error), } + pub async fn run() { match start_app_chain().await { Ok(_) => { diff --git a/src/da/avail.rs b/src/da/avail.rs index 7f47fb0..b87a2b5 100644 --- a/src/da/avail.rs +++ b/src/da/avail.rs @@ -45,9 +45,13 @@ impl DaClient for AvailClient { log::info!("🔑 Secret phrase stored in app home: {}", file_path_str); log::info!("💧 Avail address: {}", pair.public()); log::info!( - "=> Please fund your Avail address to be able to submit blobs to the goldberg network. Docs: {}", + "📕 Please fund your Avail address to be able to submit blobs to the goldberg network. Docs: {}.", AVAIL_DOCS - ) + ); + log::info!( + "🛠️ If you want to use a custom Avail address, please enter your seed and address in the config file: {}.", + file_path_str + ); } generate_config(file_path_str.as_str(), &seed_str, pair.public().to_string().as_str())?; diff --git a/src/utils/cmd.rs b/src/utils/cmd.rs index ba37b7a..a953142 100644 --- a/src/utils/cmd.rs +++ b/src/utils/cmd.rs @@ -3,12 +3,18 @@ use std::path::PathBuf; use std::process::{Command, Output, Stdio}; pub fn execute_cmd(program: &str, args: &[&str], dir: &PathBuf) -> Result { - let output = execute_cmd_stdout(program, args, dir, Stdio::inherit())?; + let output = execute_cmd_stdio(program, args, dir, Stdio::inherit(), Stdio::inherit())?; Ok(output) } -pub fn execute_cmd_stdout(program: &str, args: &[&str], dir: &PathBuf, out: Stdio) -> Result { - let result = Command::new(program).current_dir(dir).args(args).stdout(out).stderr(Stdio::inherit()).output(); +pub fn execute_cmd_stdio>( + program: &str, + args: &[&str], + dir: &PathBuf, + out: T, + err: T, +) -> Result { + let result = Command::new(program).current_dir(dir).args(args).stdout(out).stderr(err).output(); match result { Ok(output) => { diff --git a/src/utils/docker.rs b/src/utils/docker.rs index f4e2bc2..2d199eb 100644 --- a/src/utils/docker.rs +++ b/src/utils/docker.rs @@ -53,8 +53,8 @@ pub async fn container_exists(container_name: &str) -> bool { log::debug!("❌ Container {} does not exist!", container_name); false } - Err(_) => { - panic!("Failed to fetch containers, panicking"); + Err(e) => { + panic!("Failed to fetch containers, panicking {}", e); } } } diff --git a/src/utils/madara.rs b/src/utils/madara.rs index 12da636..5d9c98b 100644 --- a/src/utils/madara.rs +++ b/src/utils/madara.rs @@ -41,8 +41,15 @@ pub fn setup_and_run_madara(config: AppChainConfig) -> Result<(), MadaraError> { let da_conf = format!("--da-conf={}", da_config_path); let base_path = format!("--base-path={}", config.base_path); - let mut args = - vec!["--chain=dev", "--alice", "--force-authoring", "--rpc-cors=all", "--tx-ban-seconds=0", &base_path]; + let mut args = vec![ + "--chain=dev", + "--alice", + "--force-authoring", + "--rpc-cors=all", + "--tx-ban-seconds=0", + "--prometheus-external", + &base_path, + ]; match config.da_layer { DALayer::Ethereum => {