add nostr-relay-rs and cleaned up install.sh script

This commit is contained in:
2025-08-16 15:49:00 +01:00
parent 9c731f729f
commit 0d81d48c25

View File

@@ -1,12 +1,13 @@
#!/usr/bin/env bash #!/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. printf "### multi-relay installer\n\nthis is written for ubuntu 24.04, may work with debian and other debian based distros. REQUIRES SUDO.\n"
echo "this script must be run as '. `pwd`/install.sh', if not, stop and invoke again with the . in front." 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." read -p "Press Enter to continue, ctrl-C to stop."
PREVPATH=`pwd` PREVPATH=`pwd`
printf "\n>>> updating apt \r" printf "\n>>> updating apt\n"
sudo apt update > /dev/null 2>&1 sudo apt update > /dev/null 2>&1
printf ">>> installing prerequisite deb packages \r" printf "\n>>> installing prerequisite deb packages\n"
sudo apt install -y \ sudo apt install -y \
git \ git \
build-essential \ build-essential \
@@ -25,57 +26,70 @@ sudo apt install -y \
automake \ automake \
libtool \ libtool \
libflatbuffers-dev \ libflatbuffers-dev \
libzstd-dev zlib1g-dev \ libzstd-dev \
zlib1g-dev \
protobuf-compiler \
pkg-config \
libssl-dev \
> /dev/null 2>&1 > /dev/null 2>&1
printf ">>> installing go environment script \r" printf "\n>>> installing go environment script\n"
cp .goenv $HOME/ cp .goenv $HOME/
chmod +x $HOME/.goenv chmod +x $HOME/.goenv
cd $HOME || exit1 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 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 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 tar xf go1.25.0.linux-amd64.tar.gz
printf ">>> setting environment for Go \r" printf "\n>>> setting environment for Go\n"
printf ">>> installing strfry \n" . $HOME/.goenv
echo printf "\ninstalling benchmark tool\n"
cd $PREVPATH || exit 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 && \ git clone https://github.com/hoytech/strfry.git && \
cd strfry && \ cd strfry && \
git submodule update --init && \ git submodule update --init && \
make setup-golpe && \ make setup-golpe && \
make -j$(nproc) && \ time make -j1 && \
mv strfry $HOME/.local/bin/ && \ mv strfry $HOME/.local/bin/
cd .. && \ cd $PREVPATH
rm -rf strfry rm -rf strfry
echo printf "\n>>> installing nostr-rs-relay\n"
printf ">>> installing khatru basic-badger\n" git clone -q https://git.sr.ht/\~gheartsfield/nostr-rs-relay && \
echo cd nostr-rs-relay && \
. $HOME/.goenv time cargo build -q -r --jobs 1 && \
git clone https://github.com/fiatjaf/khatru.git && \ mv target/release/nostr-rs-relay $HOME/.local/bin/
cd khatru/examples/basic-badger && \ cd $PREVPATH
go build && \ rm -rf nostr-rs-relay
mv basic-badger $HOME/.local/bin/khatru && \ printf "\nrun '. %s/.goenv' to configure environment for running Go, optionally add this to your .bashrc (already active now)\n" "$HOME"
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"