Initial commit (code only without large binaries)
This commit is contained in:
11
EdgeReporter/build/build-all.sh
Normal file
11
EdgeReporter/build/build-all.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
./build.sh linux amd64
|
||||
./build.sh linux 386
|
||||
#./build.sh linux arm64
|
||||
./build.sh linux mips64
|
||||
./build.sh linux mips64le
|
||||
./build.sh darwin amd64
|
||||
#./build.sh darwin arm64
|
||||
./build.sh windows amd64
|
||||
./build.sh windows 386
|
||||
71
EdgeReporter/build/build.sh
Normal file
71
EdgeReporter/build/build.sh
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function build() {
|
||||
ROOT=$(dirname $0)
|
||||
NAME="edge-reporter"
|
||||
VERSION=$(lookup-version $ROOT/../internal/const/const.go)
|
||||
DIST=$ROOT/"../dist/${NAME}"
|
||||
OS=${1}
|
||||
ARCH=${2}
|
||||
EXE=""
|
||||
|
||||
if [ -z $OS ]; then
|
||||
echo "usage: build.sh OS ARCH"
|
||||
exit
|
||||
fi
|
||||
if [ -z $ARCH ]; then
|
||||
echo "usage: build.sh OS ARCH"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$OS" == "windows" ]; then
|
||||
EXE=".exe"
|
||||
fi
|
||||
|
||||
echo "checking ..."
|
||||
ZIP_PATH=$(which zip)
|
||||
if [ -z $ZIP_PATH ]; then
|
||||
echo "we need 'zip' command to compress files"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "copying ..."
|
||||
if [ ! -d $DIST ]; then
|
||||
mkdir $DIST
|
||||
mkdir $DIST/bin
|
||||
mkdir $DIST/configs
|
||||
mkdir $DIST/logs
|
||||
fi
|
||||
cp $ROOT/configs/api_reporter.template.yaml $DIST/configs
|
||||
|
||||
echo "building v${VERSION}/${OS}/${ARCH} ..."
|
||||
ZIP="${NAME}-${OS}-${ARCH}-v${VERSION}.zip"
|
||||
|
||||
env GOOS=${OS} GOARCH=${ARCH} go build -trimpath -o $DIST/bin/${NAME}${EXE} -ldflags="-s -w" $ROOT/../cmd/edge-reporter/main.go
|
||||
|
||||
echo "zip files"
|
||||
cd "${DIST}/../" || exit
|
||||
if [ -f "${ZIP}" ]; then
|
||||
rm -f "${ZIP}"
|
||||
fi
|
||||
zip -r -X -q "${ZIP}" ${NAME}/
|
||||
rm -rf ${NAME}
|
||||
cd - || exit
|
||||
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
function lookup-version() {
|
||||
FILE=$1
|
||||
VERSION_DATA=$(cat $FILE)
|
||||
re="Version[ ]+=[ ]+\"([0-9.]+)\""
|
||||
if [[ $VERSION_DATA =~ $re ]]; then
|
||||
VERSION=${BASH_REMATCH[1]}
|
||||
echo $VERSION
|
||||
else
|
||||
echo "could not match version"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
build $1 $2
|
||||
2
EdgeReporter/build/configs/.gitignore
vendored
Normal file
2
EdgeReporter/build/configs/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
api.yaml
|
||||
api_reporter.yaml
|
||||
3
EdgeReporter/build/configs/api_reporter.template.yaml
Normal file
3
EdgeReporter/build/configs/api_reporter.template.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
rpc.endpoints: [ "http://127.0.0.1:8003" ]
|
||||
nodeId: ""
|
||||
secret: ""
|
||||
1
EdgeReporter/build/logs/.gitignore
vendored
Normal file
1
EdgeReporter/build/logs/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.log
|
||||
Reference in New Issue
Block a user