From 0d81d48c25a998232fe284962c4e64421173797c Mon Sep 17 00:00:00 2001 From: mleku Date: Sat, 16 Aug 2025 15:49:00 +0100 Subject: [PATCH] add nostr-relay-rs and cleaned up install.sh script --- cmd/benchmark/install.sh | 106 ++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 46 deletions(-) diff --git a/cmd/benchmark/install.sh b/cmd/benchmark/install.sh index e455f58..163f582 100755 --- a/cmd/benchmark/install.sh +++ b/cmd/benchmark/install.sh @@ -1,12 +1,13 @@ #!/usr/bin/env bash -echo multi-relay installer - this is written for ubuntu 24.04, may work with debian and other debian based distros. REQUIRES SUDO. -echo "this script must be run as '. `pwd`/install.sh', if not, stop and invoke again with the . in front." +printf "### multi-relay installer\n\nthis is written for ubuntu 24.04, may work with debian and other debian based distros. REQUIRES SUDO.\n" +printf "\nthis script must be run as '. %s/install.sh', if not, stop and invoke again with the . in front.\n" "`pwd`" +printf "\nnote that the c++ and rust builds are run single threaded to limit memory usage; go builds do not use more than one CPU thread. also all go builds are done after cleaning the module cache to be fair\n\n" read -p "Press Enter to continue, ctrl-C to stop." PREVPATH=`pwd` -printf "\n>>> updating apt \r" +printf "\n>>> updating apt\n" sudo apt update > /dev/null 2>&1 -printf ">>> installing prerequisite deb packages \r" +printf "\n>>> installing prerequisite deb packages\n" sudo apt install -y \ git \ build-essential \ @@ -25,57 +26,70 @@ sudo apt install -y \ automake \ libtool \ libflatbuffers-dev \ - libzstd-dev zlib1g-dev \ + libzstd-dev \ + zlib1g-dev \ + protobuf-compiler \ + pkg-config \ + libssl-dev \ > /dev/null 2>&1 -printf ">>> installing go environment script \r" +printf "\n>>> installing go environment script\n" cp .goenv $HOME/ chmod +x $HOME/.goenv cd $HOME || exit1 -printf ">>> downloading Go \r" +printf "\n>>> downloading Go\n" wget -nc https://go.dev/dl/go1.25.0.linux-amd64.tar.gz > /dev/null 2>&1 -printf ">>> removing previous Go installation \r" +printf "\n>>> removing previous Go installation\n" sudo rm -rf $HOME/go -printf ">>> unpacking Go install archive \r" +printf "\n>>> unpacking Go install archive\n" tar xf go1.25.0.linux-amd64.tar.gz -printf ">>> setting environment for Go \r" -printf ">>> installing strfry \n" -echo -cd $PREVPATH || exit +printf "\n>>> setting environment for Go\n" +. $HOME/.goenv +printf "\ninstalling benchmark tool\n" +cd $PREVPATH +go build && mv benchmark $HOME/.local/bin/relay-benchmark +printf "\n>>> installing rust using rustup (just press enter for default version)\n" +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +printf "\n>>> setting rust environment variables to use cargo\n" +. "$HOME/.cargo/env" +cd $PREVPATH +printf "\n>>> installing ORLY\n" +go clean -modcache +cd ../.. +time go build && \ + mv orly.dev $HOME/.local/bin/orly +cd $PREVPATH +printf "\n>>> installing khatru basic-badger\n" +go clean -modcache +git clone https://github.com/fiatjaf/khatru.git && \ + cd khatru/examples/basic-badger && \ + time go build && \ + mv basic-badger $HOME/.local/bin/khatru +cd $PREVPATH +rm -rf khatru +printf "\n>>> installing relayer\n" +go clean -modcache +git clone https://github.com/mleku/relayer.git && \ + cd relayer && \ + cd examples/basic && \ + time go build && \ + mv basic $HOME/.local/bin/relayer +cd $PREVPATH +rm -rf relayer +printf "\n>>> installing strfry\n" git clone https://github.com/hoytech/strfry.git && \ cd strfry && \ git submodule update --init && \ make setup-golpe && \ - make -j$(nproc) && \ - mv strfry $HOME/.local/bin/ && \ - cd .. && \ - rm -rf strfry -echo -printf ">>> installing khatru basic-badger\n" -echo -. $HOME/.goenv -git clone https://github.com/fiatjaf/khatru.git && \ - cd khatru/examples/basic-badger && \ - go build && \ - mv basic-badger $HOME/.local/bin/khatru && \ - cd ../../.. && \ - rm -rf khatru -echo -printf ">>> installing relayer\n" -echo -git clone https://github.com/mleku/relayer.git && \ - cd relayer && \ - cd examples/basic && \ - go build && \ - mv basic $HOME/.local/bin/relayer && \ - cd ../.. && \ - rm -rf relayer -echo -printf ">>> installing ORLY\n" -echo -cd ../../.. -go build && \ - mv orly.dev $HOME/.local/bin/orly && \ - cd $PREVPATH || exit - -printf "run '. %s/.goenv' to configure environment for running Go, optionally add this to your .bashrc (already active now)\n" "$HOME" + time make -j1 && \ + mv strfry $HOME/.local/bin/ +cd $PREVPATH +rm -rf strfry +printf "\n>>> installing nostr-rs-relay\n" +git clone -q https://git.sr.ht/\~gheartsfield/nostr-rs-relay && \ + cd nostr-rs-relay && \ + time cargo build -q -r --jobs 1 && \ + mv target/release/nostr-rs-relay $HOME/.local/bin/ +cd $PREVPATH +rm -rf nostr-rs-relay +printf "\nrun '. %s/.goenv' to configure environment for running Go, optionally add this to your .bashrc (already active now)\n" "$HOME"