From aec270bc5e406a2bb455726fd2cd6be49bcff33a Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Fri, 26 Apr 2024 17:27:51 +0530 Subject: [PATCH 1/2] .docker: Adapt NeoC# Dockerfile for ARM-based Mac Publishing dotnet with -r linux-x64 is unavailable on ARM base architecture. Close #162 Signed-off-by: Ekaterina Pavlova --- .docker/build/Dockerfile.sharp.sources.from_binaries | 12 ++++++------ .../Dockerfile.sharp.sources.from_local_dependencies | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.docker/build/Dockerfile.sharp.sources.from_binaries b/.docker/build/Dockerfile.sharp.sources.from_binaries index ae2b439..7393db6 100644 --- a/.docker/build/Dockerfile.sharp.sources.from_binaries +++ b/.docker/build/Dockerfile.sharp.sources.from_binaries @@ -7,7 +7,7 @@ RUN set -x \ unzip \ wget -# Publish neo-cli from source as a self-contained deployment for linux-64 into /neo-cli folder (all dependant .dlls are included). +# Publish neo-cli from source as a self-contained deployment into /neo-cli folder (all dependant .dlls are included). # See https://docs.microsoft.com/ru-ru/dotnet/core/deploying/#publish-self-contained for details. ENV CLIBRANCH="v3.6.0" RUN wget -O /tmp/neo-cli.zip https://github.com/neo-project/neo-node/archive/${CLIBRANCH}.zip && \ @@ -17,7 +17,7 @@ RUN wget -O /tmp/neo-cli.zip https://github.com/neo-project/neo-node/archive/${C cp -r tmp/neo-node/*/Neo.ConsoleService /build && \ cp tmp/neo-node/*/NuGet.Config /build/neo-cli && \ dotnet restore /build/neo-cli && \ - dotnet publish -c Release --framework net7.0 -r linux-x64 /build/neo-cli -o /neo-cli && \ + dotnet publish -c Release --framework net7.0 /build/neo-cli -o /neo-cli && \ rm -rf /build /tmp/neo-cli.zip /tmp/neo-node # Build neo-modules from source into /Plugins folder (only plugin .dll and plugin config are included, if you need other dependant .dlls, see the next step) @@ -42,21 +42,21 @@ RUN dotnet publish -c Release --framework net7.0 /tmp/neo-modules/*/src/RpcServe cp /tmp/neo-modules/*/src/RocksDBStore/bin/Release/net7.0/publish/RocksDbSharp.dll /Plugins/ && \ rm -rf /tmp/neo-modules.zip /tmp/neo-modules -# Publish neo-vm from source as a self-contained deployment for linux-64 into /neo-vm folder (although neo-vm does not have dependant .dlls) +# Publish neo-vm from source as a self-contained deployment into /neo-vm folder (although neo-vm does not have dependant .dlls) ENV NEOVMBRANCH="v3.6.0" RUN wget -O /tmp/neo-vm.zip https://github.com/neo-project/neo-vm/archive/${NEOVMBRANCH}.zip && \ unzip -q -d /tmp/neo-vm/ /tmp/neo-vm.zip && \ ls -l /tmp/* && \ dotnet restore /tmp/neo-vm/*/src/Neo.VM/ && \ - dotnet publish -c Release --framework net7.0 -r linux-x64 /tmp/neo-vm/*/src/Neo.VM/ -o /neo-vm && \ + dotnet publish -c Release --framework net7.0 /tmp/neo-vm/*/src/Neo.VM/ -o /neo-vm && \ rm -rf /tmp/neo-vm.zip tmp/neo-vm -# Publish neo from source as a self-contained deployment for linux-64 into /neo folder (all dependant .dlls are included) +# Publish neo from source as a self-contained deployment into /neo folder (all dependant .dlls are included) ENV NEOBRANCH="v3.6.0" RUN wget -O /tmp/neo.zip https://github.com/neo-project/neo/archive/${NEOBRANCH}.zip && \ unzip -q -d /tmp/neo/ /tmp/neo.zip && \ dotnet restore /tmp/neo/*/src/Neo/ && \ - dotnet publish -c Release --framework net7.0 -r linux-x64 /tmp/neo/*/src/Neo/ -o /neo && \ + dotnet publish -c Release --framework net7.0 /tmp/neo/*/src/Neo/ -o /neo && \ rm -rf /tmp/neo.zip tmp/neo # All things are published, so build the final image by copying binaries from Build diff --git a/.docker/build/Dockerfile.sharp.sources.from_local_dependencies b/.docker/build/Dockerfile.sharp.sources.from_local_dependencies index a537256..4f82a09 100644 --- a/.docker/build/Dockerfile.sharp.sources.from_local_dependencies +++ b/.docker/build/Dockerfile.sharp.sources.from_local_dependencies @@ -44,9 +44,9 @@ RUN sed -i '/PackageReference Include="Neo" Version=/c \ ' /neo-project/neo/src/Neo/Neo.csproj && \ sed -i '/' /neo-project/neo-modules/src/Directory.Build.props -# Publish neo-cli from source as a self-contained deployment for linux-64 into /neo-cli folder (all dependant .dlls are included). +# Publish neo-cli from source as a self-contained deployment into /neo-cli folder (all dependant .dlls are included). # See https://docs.microsoft.com/ru-ru/dotnet/core/deploying/#publish-self-contained for details. -RUN dotnet publish -c Release --framework net7.0 -r linux-x64 /neo-project/neo-node/neo-cli -o /neo-cli +RUN dotnet publish -c Release --framework net7.0 /neo-project/neo-node/neo-cli -o /neo-cli # Build neo-modules from source into /Plugins folder (only plugin .dll and plugin config are included, if you need other dependant .dlls, see the next step) RUN mkdir /Plugins && \ From baadb4c7722de6600f7476540d056253d76afa0d Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Fri, 26 Apr 2024 17:39:02 +0530 Subject: [PATCH 2/2] runner.sh: transform boolean --log flag to string flag For MacOS NEOBENCH_LOGGER should be set to json-file as journald and syslog are not supported by this architecture. Close #159 Signed-off-by: Ekaterina Pavlova --- README.md | 19 ++++++++++++++++++- runner.sh | 20 ++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fd34748..e96d79c 100644 --- a/README.md +++ b/README.md @@ -264,7 +264,17 @@ The following default configurations are available: ## Runner usage (`./runner.sh`) ``` + -v, --validators Consensus node count. + Possible values: 1, 4 (default), 7. + -n, --nodes Consensus node type. + Possible values: go (default), mixed, sharp. + -r, --rpc RPC node type. Default is the same as --nodes. -h, --help Show usage message. + -b, --benchmark Benchmark type. + Possible values: NEO (default) or GAS + --from Number of tx senders (default: 1) + --to Number of fund receivers (default: 1) + --vote Whether or not candidates should be voted for before the bench. -d Benchmark description. -m Benchmark mode. Example: -m wrk -m rate @@ -282,6 +292,11 @@ The following default configurations are available: -t Request timeout. Used for RPC requests. Example: -t 30s + -l, --log Container logging facility. Default value is none. + Example: -l journald -l syslog -l json-file + --tc Arguments to pass to 'tc qdisc netem' inside the container. + Example: 'delay 100ms' + ``` ## Build options @@ -410,7 +425,7 @@ To add one more node configuration, provide all necessary information to the `no Name|Description| Default |Example ---|---|---------|--- -NEOBENCH_LOGGER|Container logging facility| `none` |`none`, `journald`, `syslog` +NEOBENCH_LOGGER|Container logging facility| `none` |`none`, `journald`, `syslog`,`json-file` NEOBENCH_TC|Parameters passed to the `tc qdisc` (netem discipline) on container startup| |`delay 100ms` NEOBENCH_TYPE|Type of the load| `NEO` |`NEO`, `GAS` NEOBENCH_FROM_COUNT|Number of tx senders| `1` | `1` @@ -418,6 +433,8 @@ NEOBENCH_TO_COUNT|Number of fund receivers| `1` | `1` NEOBENCH_VALIDATOR_COUNT|Number of validators| `4` | `1`, `4`, `7` NEOBENCH_VOTE|Vote for validators before the bench| empty |`1` or empty +For MacOS NEOBENCH_LOGGER should be set to `json-file` as `journald` and +`syslog` are not supported by this architecture. ## Benchmark results visualisation There's a Python plotting script available for benchmark data visualisation. diff --git a/runner.sh b/runner.sh index 5eafe1b..7fe3aa4 100755 --- a/runner.sh +++ b/runner.sh @@ -47,7 +47,8 @@ show_help() { echo " -t Request timeout." echo " Used for RPC requests." echo " Example: -t 30s" - echo " -l, --log Enable logging on consensus nodes." + echo " -l, --log Container logging facility. Default value is none." + echo " Example: -l journald -l syslog -l json-file" echo " --tc Arguments to pass to 'tc qdisc netem' inside the container." echo " Example: 'delay 100ms'" exit 0 @@ -68,7 +69,22 @@ while test $# -gt 0; do case $_opt in -h | --help) show_help ;; - -l | --log) export NEOBENCH_LOGGER=journald ;; + -l | --log) + if [[ $# -gt 0 && ${1:0:1} != "-" ]]; then + case "$1" in + "syslog" | "journald" | "json-file" | "none") + export NEOBENCH_LOGGER="$1" + shift + ;; + *) + fatal "unknown logger specified: $1" + ;; + esac + else + export NEOBENCH_LOGGER="none" + fi + ;; + --vote) export NEOBENCH_VOTE=1 ;; -v | --validators)