Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/commands/start/curio/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,8 @@ fn build_docker_create_args(
docker_args.extend_from_slice(&["-e".to_string(), env.clone()]);
}

docker_args.push("-e".to_string());
docker_args.push(crate::constants::CURIO_LOG_LEVEL.to_string());

Ok(docker_args)
}
6 changes: 6 additions & 0 deletions src/commands/start/curio/db_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ fn create_base_cluster(
docker_args.push(env);
}

docker_args.push("-e");
docker_args.push(crate::constants::CURIO_LOG_LEVEL);

// Add image and command
let bash_cmd = format!(
"sleep 3 && /usr/local/bin/lotus-bins/curio config new-cluster {}",
Expand Down Expand Up @@ -311,6 +314,9 @@ fn create_pdp_layer(context: &SetupContext, sp_index: usize) -> Result<(), Box<d
docker_args.push(env);
}

docker_args.push("-e");
docker_args.push(crate::constants::CURIO_LOG_LEVEL);

// Add image and command with heredoc for config
let bash_cmd = format!(
"sleep 5 && /usr/local/bin/lotus-bins/curio config create --title pdp-only << 'EOF'\n{}\nEOF",
Expand Down
3 changes: 3 additions & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ pub const ENV_FOC_DEVNET_CONTRACT_MULTICALL: &str = "FOC_CONTRACT_MULTICALL";
pub const ENV_FOC_DEVNET_CONTRACT_SIMPLE: &str = "FOC_CONTRACT_SIMPLE";
pub const ENV_FOC_DEVNET_CONTRACT_USDFC: &str = "FOC_CONTRACT_USDFC";

/// Curio logging configuration
pub const CURIO_LOG_LEVEL: &str = "GOLOG_LOG_LEVEL=pdp=debug";

/// File paths within containers
pub const LOTUS_BINARY_PATH: &str = "/usr/local/bin/lotus-bins/lotus";
pub const LOTUS_MINER_BINARY_PATH: &str = "/usr/local/bin/lotus-bins/lotus-miner";
21 changes: 19 additions & 2 deletions src/docker/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,31 @@ pub fn docker_command(args: &[&str]) -> Result<Output, Box<dyn Error>> {

/// Get logs from a Docker container.
///
/// Collects both stdout and stderr. Go programs (e.g. Curio)
/// write all log output to stderr, so both streams must be collected to get complete
/// logs.
///
/// # Arguments
/// * `container_name` - The name of the container to get logs from
///
/// # Returns
/// The container logs on success.
/// The combined stdout + stderr container logs on success.
pub fn get_container_logs(container_name: &str) -> Result<String, Box<dyn Error>> {
let output = docker_command(&["logs", container_name])?;
Ok(String::from_utf8_lossy(&output.stdout).to_string())

let mut logs = String::new();
let stdout_str = String::from_utf8_lossy(&output.stdout);
let stderr_str = String::from_utf8_lossy(&output.stderr);
logs.push_str(&stdout_str);
if !stdout_str.is_empty()
&& !stderr_str.is_empty()
&& !stdout_str.ends_with('\n')
&& !stderr_str.starts_with('\n')
{
logs.push('\n');
}
logs.push_str(&stderr_str);
Ok(logs)
}

/// Check if a port is available (not in use)
Expand Down
Loading