From 4bb1f4c9f1b6cbd25a9daace7912c3ab443fc4ed Mon Sep 17 00:00:00 2001 From: Theophilus Date: Fri, 17 Nov 2023 20:02:21 +0100 Subject: [PATCH 1/4] fix: change to config structure made in https://github.com/bitcoin-dev-project/sim-ln/pull/152 --- docker/setup-volume.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docker/setup-volume.sh b/docker/setup-volume.sh index b46141da..40ac50e0 100755 --- a/docker/setup-volume.sh +++ b/docker/setup-volume.sh @@ -28,11 +28,10 @@ NODE_COUNT=$(cat $SIMFILE_PATH_ON_HOST | jq '.nodes | length') # Loop Over Each Node for (( i=0; i<$NODE_COUNT; i++ )); do - NODE_TYPE=$(cat $SIMFILE_PATH_ON_HOST | jq -r ".nodes[$i] | keys[0]") # Determine if it's LND or CLN. - NODE_ID=$(cat $SIMFILE_PATH_ON_HOST | jq -r ".nodes[$i].$NODE_TYPE.id") # Extract node ID for directory creation. - NODE_TLS_PATH_ON_HOST=$(cat $SIMFILE_PATH_ON_HOST | jq -r ".nodes[$i].$NODE_TYPE.cert") # TLS path - NODE_MACAROON_PATH_ON_HOST=$(cat $SIMFILE_PATH_ON_HOST | jq -r ".nodes[$i].$NODE_TYPE.macaroon") # Macaroon path - + NODE_ID=$(cat $SIMFILE_PATH_ON_HOST | jq -r ".nodes[$i].id") # Extract node ID for directory creation. + NODE_TLS_PATH_ON_HOST=$(cat $SIMFILE_PATH_ON_HOST | jq -r ".nodes[$i].cert") # TLS path + NODE_MACAROON_PATH_ON_HOST=$(cat $SIMFILE_PATH_ON_HOST | jq -r ".nodes[$i].macaroon") # Macaroon path + # Create staging directories for each node mkdir -p $STAGING_DIR/lnd/$NODE_ID From a495e9d41ca6a7e006188d7adb04cc7747166a06 Mon Sep 17 00:00:00 2001 From: Theophilus Date: Fri, 17 Nov 2023 20:05:27 +0100 Subject: [PATCH 2/4] feat: update to path specification in https://github.com/bitcoin-dev-project/sim-ln/pull/132 --- Makefile | 17 ++++++++++------- docker/README.md | 1 + docker/entrypoint.sh | 7 ++++++- docker/setup-volume.sh | 6 +++--- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 68777f3f..c4b779eb 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ LOG_LEVEL ?= info +DEFAULT_DATA_DIR ?= /data_dir +DEFAULT_SIMFILE_PATH ?= /data_dir/sim.json build-docker: docker build -f docker/Dockerfile -t sim-ln . @@ -15,17 +17,18 @@ help: @echo "stop Stops the Docker container." @echo "" @echo "Variables:" - @echo "SIMFILE_PATH Path to the sim.json file." - @echo "LOG_LEVEL Set the logging level (default: info) e.g. " - @echo "HELP Set to true to print the help message (default: false) e.g. " - @echo "PRINT_BATCH_SIZE Set the batch size for printing the results e.g. " - @echo "TOTAL_TIME Set the total time for the simulation e.g. " + @echo "SIMFILE_PATH Path to the sim.json file." + @echo "LOG_LEVEL Set the logging level (default: info) e.g. ." + @echo "HELP Set to true to print the help message (default: false) e.g. ." + @echo "PRINT_BATCH_SIZE Set the batch size for printing the results e.g. ." + @echo "TOTAL_TIME Set the total time for the simulation e.g. ." + @echo "DATA_DIR Set the data directory for the simulation containing simulation files and results e.g. Date: Thu, 25 Jan 2024 10:19:36 +0100 Subject: [PATCH 3/4] docs: fix docker run commands --- docker/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index a9d3c4eb..9de43807 100644 --- a/docker/README.md +++ b/docker/README.md @@ -73,7 +73,7 @@ make run-docker You can adjust the logging level by providing the `LOG_LEVEL` variable. The default value is `info`. Example: ```bash -make run LOG_LEVEL=debug +make run-docker LOG_LEVEL=debug ``` Other configurable variables include: @@ -86,7 +86,7 @@ Other configurable variables include: Example usage: ```bash -make run PRINT_BATCH_SIZE=100 TOTAL_TIME=5000 +make run-docker PRINT_BATCH_SIZE=100 TOTAL_TIME=5000 ``` For an interactive session: From bbda19fe0e038ce97418e688a2037bd5dd17d823 Mon Sep 17 00:00:00 2001 From: Theophilus Date: Thu, 25 Jan 2024 11:26:11 +0100 Subject: [PATCH 4/4] chore: update Dockerfile to clean up apt-get cache This commit updates the Dockerfile to clean up the apt-get cache after installing clang and llvm. This helps reduce the size of the Docker image. --- docker/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 7453bb5f..0a8acdfa 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,7 +10,10 @@ ENV TARGET_RUST_ARCH="x86_64-unknown-linux-musl" FROM base as builder-arm64 ENV TARGET_RUST_ARCH="aarch64-unknown-linux-musl" -RUN apt-get update && apt-get install clang llvm -y --no-install-recommends +RUN apt-get update \ + && apt-get install clang llvm -y --no-install-recommends \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* ENV CC_aarch64_unknown_linux_musl=clang ENV AR_aarch64_unknown_linux_musl=llvm-ar ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld"