Skip to content

Commit

Permalink
Add go and protoc install scripts
Browse files Browse the repository at this point in the history
Signed-off-by: David Schall <[email protected]>
  • Loading branch information
dhschall committed Nov 11, 2023
1 parent 5229227 commit 4916f80
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/invoker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 43 additions & 0 deletions utils/install_go.sh
Original file line number Diff line number Diff line change
@@ -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)"
41 changes: 41 additions & 0 deletions utils/install_protoc.sh
Original file line number Diff line number Diff line change
@@ -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/[email protected]
go install google.golang.org/grpc/cmd/[email protected]

sh -c "echo 'export PATH=\$PATH:\$(go env GOPATH)/bin' >> $HOME/.bashrc"
export PATH="$PATH:$(go env GOPATH)/bin"

0 comments on commit 4916f80

Please sign in to comment.