From 35004835c60168c9af51f7592957ef1ea56ad7db Mon Sep 17 00:00:00 2001 From: David Schall Date: Thu, 9 Nov 2023 01:41:17 -0700 Subject: [PATCH] Add go and protoc install scripts Signed-off-by: David Schall --- tools/invoker/README.md | 3 ++- utils/install_go.sh | 43 +++++++++++++++++++++++++++++++++++++++++ utils/install_protoc.sh | 41 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100755 utils/install_go.sh create mode 100755 utils/install_protoc.sh diff --git a/tools/invoker/README.md b/tools/invoker/README.md index 634f5925..113c76cc 100644 --- a/tools/invoker/README.md +++ b/tools/invoker/README.md @@ -35,8 +35,9 @@ An example input file for eventing can look like this: ### Invoker usage `make invoker` can be used to build a binary of the invoker. Once this and the input file are ready, calling `./invoker` will start the process. +> Note: You need to have go and protoc installed on your machine to build the invoker. Refere to [this](https://golang.org/doc/install) for installation instructions or our install scripts `./utils/install_go.sh` and `./utils/install_protoc.sh`. -Additional inputs can be provided to set the desired duration (`--time`), requests per second (`-rps`) or port (`-port`) to be used. `-dbg` can be set for extra debug logs, and additionally tracing can be enabled for the invoker using the boolean `-trace` flag, in which case the `-zipkin` option may also need to be used in order to specify the address of the zipkin span collector. +Additional inputs can be provided to set the desired duration (`--time`), requests per second (`-rps`) or port (`-port`) to be used. `-dbg` can be set for extra debug logs, and additionally tracing can be enabled for the invoker using the boolean `-trace` flag, in which case the `-zipkin` option may also need to be used in order to specify the address of the zipkin span collector. Example usage: ```bash diff --git a/utils/install_go.sh b/utils/install_go.sh new file mode 100755 index 00000000..7cd58ca0 --- /dev/null +++ b/utils/install_go.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# MIT License +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +set -e + +VERSION=1.21.4 +ARCH=amd64 + +if [ $(uname -i) == "aarch64" ]; then ARCH=arm64 ; fi + +GO_BUILD="go${VERSION}.linux-${ARCH}" + +wget --continue https://golang.org/dl/${GO_BUILD}.tar.gz + +sudo rm -rf /usr/local/go +sudo tar -C /usr/local -xzf ${GO_BUILD}.tar.gz + +export PATH=$PATH:/usr/local/go/bin + +sudo sh -c "echo 'export PATH=\$PATH:/usr/local/go/bin' >> /etc/profile" +sh -c "echo 'export PATH=\$PATH:/usr/local/go/bin' >> $HOME/.bashrc" + +echo "Installed: $(go version)" \ No newline at end of file diff --git a/utils/install_protoc.sh b/utils/install_protoc.sh new file mode 100755 index 00000000..1012324a --- /dev/null +++ b/utils/install_protoc.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# MIT License +# +# Copyright (c) 2023 David Schall and vHive-Serverless +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +PB_VERSION=25.0 + +PB_REL="https://github.com/protocolbuffers/protobuf/releases" +curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip + +unzip protoc-$PB_VERSION-linux-x86_64.zip -d $HOME/.local + + +sh -c "echo 'export PATH=\$PATH:\$HOME/.local/bin' >> $HOME/.bashrc" +export PATH="$PATH:$HOME/.local/bin" + +go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31 +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3 + +sh -c "echo 'export PATH=\$PATH:\$(go env GOPATH)/bin' >> $HOME/.bashrc" +export PATH="$PATH:$(go env GOPATH)/bin" \ No newline at end of file