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

Simplify config #99

Merged
merged 7 commits into from
Sep 3, 2024
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
9 changes: 5 additions & 4 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ docker_image = "test_da_commit"
sleep_secs = 5

# Configuration for how metrics should be collected and scraped
# OPTIONAL, skip metrics collection if missing
[metrics]
# Path to a `prometheus.yml` file to use in Prometheus. If using a custom config file, be sure to add a
# file discovery section as follows:
Expand All @@ -131,13 +132,13 @@ prometheus_config = "./docker/prometheus.yml"
# Whether to start Grafana with built-in dashboards
# OPTIONAL, DEFAULT: true
use_grafana = true
# Whether to start cadvisor for system monitoring
# OPTIONAL, DEFAULT: true
use_cadvisor = true

# Configuration for how logs should be collected and stored
# OPTIONAL
# OPTIONAL, info to stdout if missing
[logs]
# Log rotation policy. Supported values: hourly, daily, never
# OPTIONAL, DEFAULT: daily
rotation = "daily"
# Path to the log directory
# OPTIONAL, DEFAULT: /var/logs/commit-boost
log_dir_path = "./logs"
Expand Down
10 changes: 10 additions & 0 deletions configs/minimal.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Minimal PBS config, with no metrics and only stdout logs

chain = "Holesky"

[pbs]
port = 18550

[[relays]]
id = "example-relay"
url = "http://0xa1cec75a3f0661e99299274182938151e8433c61a19222347ea1313d839229cb4ce4e3e5aa2bdeb71c8fcf1b084963c2@abc.xyz"
18 changes: 18 additions & 0 deletions configs/pbs_metrics.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# PBS + metrics + logs to file

chain = "Holesky"

[pbs]
port = 18550

[[relays]]
id = "example-relay"
url = "http://0xa1cec75a3f0661e99299274182938151e8433c61a19222347ea1313d839229cb4ce4e3e5aa2bdeb71c8fcf1b084963c2@abc.xyz"

[metrics]
prometheus_config = "./docker/prometheus.yml"
use_grafana = true
use_cadvisor = false

[logs]
log_dir_path = "./logs"
11 changes: 6 additions & 5 deletions crates/cli/src/docker_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,14 @@ fn is_command_available(command: &str) -> bool {
.map_or(false, |output| output.status.success())
}

pub fn handle_docker_start(compose_path: String, env_path: String) -> Result<()> {
pub fn handle_docker_start(compose_path: String, env_path: Option<String>) -> Result<()> {
println!("Starting Commit-Boost with compose file: {}", compose_path);

// load env file
let env_file = dotenvy::from_filename_override(env_path)?;

println!("Loaded env file: {:?}", env_file);
// load env file if present
if let Some(env_path) = env_path {
let env_file = dotenvy::from_filename_override(env_path)?;
println!("Loaded env file: {:?}", env_file);
}

// start docker compose
run_docker_compose!(compose_path, "up", "-d");
Expand Down
Loading
Loading