diff --git a/node/tools/Makefile b/node/tools/Makefile new file mode 100644 index 00000000..668c04c8 --- /dev/null +++ b/node/tools/Makefile @@ -0,0 +1,12 @@ +.PHONY: run-node node-configs clean +IP?=127.0.0.1:3054 + +run-node: + export RUST_LOG=INFO && cd node-configs/${IP} && cargo run -- --database ./database/${IP} + +node-configs: + cargo run --bin localnet_config -- --input-addrs addresses.txt --output-dir node-configs + +clean: + rm -rf node-configs + rm -rf database diff --git a/node/tools/README.md b/node/tools/README.md new file mode 100644 index 00000000..ff01923b --- /dev/null +++ b/node/tools/README.md @@ -0,0 +1,5 @@ +# Running a test node + +1. Generate a file named `addresses.txt` in the root directory of the tools crate, containing node addresses in the format `IP:PORT`, with each address on a separate line. +2. Run `make node-configs`. This command will establish a directory named `node-configs` and create a folder for each address listed in the `.txt` file, providing the necessary configuration files for the respective node. +3. Execute `make run-node IP=`. The default value for this command would be `127.0.0.1:3054`. Note that running this command will take control of the terminal. diff --git a/node/tools/src/main.rs b/node/tools/src/main.rs index 3701b64d..8b9f4f69 100644 --- a/node/tools/src/main.rs +++ b/node/tools/src/main.rs @@ -51,8 +51,8 @@ async fn main() -> anyhow::Result<()> { fs::create_dir_all("logs/")?; let log_file = fs::File::create("logs/output.log")?; - // Create the logger for stdout. This will produce human-readable logs for - // all events of level INFO or higher. + // Create the logger for stdout. This will produce human-readable logs for ERROR events. + // To see logs for other events, set the RUST_LOG environment to the desired level. let stdout_log = tracing_subscriber::fmt::layer() .pretty() .with_ansi(std::env::var("NO_COLOR").is_err() && std::io::stdout().is_terminal())