statping/Makefile

416 lines
19 KiB
Makefile
Raw Normal View History

2018-11-29 02:03:41 +00:00
VERSION=$(shell cat version.txt)
2018-12-04 10:13:08 +00:00
SIGN_KEY=B76D61FAA6DB759466E83D9964B9C6AAE2D55278
2018-12-04 04:17:29 +00:00
BINARY_NAME=statping
2019-12-29 21:52:19 +00:00
GOBUILD=go build -a
2020-05-12 01:05:46 +00:00
GOVERSION=1.14.0
NODE_VERSION=12.18.2
2019-12-29 21:52:19 +00:00
XGO=xgo -go $(GOVERSION) --dest=build
2020-07-24 01:36:30 +00:00
BUILDVERSION=-ldflags "-X main.VERSION=${VERSION}"
2020-04-13 23:52:33 +00:00
TRVIS_SECRET=O3/2KTOV8krv+yZ1EB/7D1RQRe6NdpFUEJNJkMS/ollYqmz3x2mCO7yIgIJKCKguLXZxjM6CxJcjlCrvUwibL+8BBp7xJe4XFIOrjkPvbbVPry4HkFZCf2GfcUK6o4AByQ+RYqsW2F17Fp9KLQ1rL3OT3eLTwCAGKx3tlY8y+an43zkmo5dN64V6sawx26fh6XTfww590ey+ltgQTjf8UPNup2wZmGvMo9Hwvh/bYR/47bR6PlBh6vhlKWyotKf2Fz1Bevbu0zc35pee5YlsrHR+oSF+/nNd/dOij34BhtqQikUR+zQVy9yty8SlmneVwD3yOENvlF+8roeKIXb6P6eZnSMHvelhWpAFTwDXq2N3d/FIgrQtLxsAFTI3nTHvZgs6OoTd6dA0wkhuIGLxaL3FOeztCdxP5J/CQ9GUcTvifh5ArGGwYxRxQU6rTgtebJcNtXFISP9CEUR6rwRtb6ax7h6f1SbjUGAdxt+r2LbEVEk4ZlwHvdJ2DtzJHT5DQtLrqq/CTUgJ8SJFMkrJMp/pPznKhzN4qvd8oQJXygSXX/gz92MvoX0xgpNeLsUdAn+PL9KketfR+QYosBz04d8k05E+aTqGaU7FUCHPTLwlOFvLD8Gbv0zsC/PWgSLXTBlcqLEz5PHwPVHTcVzspKj/IyYimXpCSbvu1YOIjyc=
2018-12-19 19:07:05 +00:00
PUBLISH_BODY='{ "request": { "branch": "master", "message": "Homebrew update version v${VERSION}", "config": { "env": { "VERSION": "${VERSION}", "COMMIT": "$(TRAVIS_COMMIT)" } } } }'
2020-04-15 11:45:23 +00:00
TRAVIS_BUILD_CMD='{ "request": { "branch": "master", "message": "Compile master for Statping v${VERSION}", "config": { "merge_mode": "replace", "language": "go", "go": 1.14, "install": true, "sudo": "required", "services": ["docker"], "env": { "secure": "${TRVIS_SECRET}" }, "before_deploy": ["git config --local user.name \"hunterlong\"", "git config --local user.email \"info@socialeck.com\"", "git tag v$(VERSION) --force"], "deploy": [{ "provider": "releases", "api_key": "$$GITHUB_TOKEN", "file_glob": true, "file": "build/*", "skip_cleanup": true, "on": { "branch": "master" } }], "before_script": ["rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install stable", "nvm install 10.17.0", "nvm use 10.17.0 --default", "npm install -g sass yarn cross-env", "pip install --user awscli"], "script": ["make release"], "after_success": [], "after_deploy": ["make post-release"] } } }'
2020-03-09 18:17:55 +00:00
TEST_DIR=$(GOPATH)/src/github.com/statping/statping
PATH:=$(GOPATH)/bin:$(PATH)
2020-04-24 13:00:08 +00:00
OS = freebsd linux openbsd
ARCHS = 386 arm amd64 arm64
2018-08-15 08:08:50 +00:00
2020-07-24 02:48:13 +00:00
all: build-deps compile install test build
2020-07-24 01:36:30 +00:00
2020-07-24 02:48:13 +00:00
test: clean compile
2020-07-30 23:14:41 +00:00
go test -v -p=1 -ldflags="-X main.VERSION=${VERSION}" -coverprofile=coverage.out ./...
2020-07-24 01:36:30 +00:00
2020-07-24 02:50:20 +00:00
build: clean
2020-07-24 02:54:37 +00:00
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o statping --tags "netgo linux" ./cmd
2020-03-04 10:29:00 +00:00
2020-07-30 23:14:41 +00:00
go-build: clean
rm -rf source/dist
rm -rf source/rice-box.go
wget https://assets.statping.com/source.tar.gz
tar -xvf source.tar.gz
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o statping --tags "netgo" ./cmd
lint:
go fmt ./...
golint ./...
impi --local github.com/statping/statping/ --scheme stdLocalThirdParty ./...
goimports ./...
2020-02-28 06:37:48 +00:00
up:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml up -d --remove-orphans
make print_details
2020-02-27 10:04:27 +00:00
down:
2020-02-28 06:37:48 +00:00
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml down --volumes --remove-orphans
2020-02-28 07:56:17 +00:00
lite: clean
2020-03-19 10:36:32 +00:00
docker build -t statping/statping:dev -f dev/Dockerfile.dev .
2020-02-29 15:00:08 +00:00
docker-compose -f dev/docker-compose.lite.yml down
docker-compose -f dev/docker-compose.lite.yml up --remove-orphans
2020-02-28 07:56:17 +00:00
2020-02-28 06:37:48 +00:00
reup: down clean compose-build-full up
2020-03-19 02:08:29 +00:00
# build all arch's and release Statping
2020-03-21 20:56:17 +00:00
release: test-deps
2020-03-19 02:08:29 +00:00
wget -O statping.gpg $(SIGN_URL)
gpg --import statping.gpg
2020-04-13 12:19:57 +00:00
make build-all
2020-03-19 02:08:29 +00:00
2020-03-19 01:50:53 +00:00
test-ci: clean compile test-deps
DB_CONN=sqlite go test -v -covermode=count -coverprofile=coverage.out -p=1 ./...
2020-03-19 03:25:18 +00:00
goveralls -coverprofile=coverage.out -service=travis-ci -repotoken ${COVERALLS}
2020-03-19 01:50:53 +00:00
cypress: clean
2020-04-02 04:44:41 +00:00
echo "Statping Bin: "`which statping`
echo "Statping Version: "`statping version`
cd frontend && yarn test
2020-04-02 04:44:41 +00:00
killall statping
2020-03-19 02:08:29 +00:00
test-api:
DB_CONN=sqlite DB_HOST=localhost DB_DATABASE=sqlite DB_PASS=none DB_USER=none statping &
sleep 5000 && newman run source/tmpl/postman.json -e dev/postman_environment.json --delay-request 500
2020-03-19 02:08:29 +00:00
2020-03-19 01:50:53 +00:00
test-deps:
go get golang.org/x/tools/cmd/cover
go get github.com/mattn/goveralls
go get github.com/GeertJohan/go.rice/rice
2020-05-12 01:57:17 +00:00
go get github.com/mattn/go-sqlite3
go install github.com/mattn/go-sqlite3
2020-03-13 04:06:06 +00:00
deps:
go get -d -v -t ./...
2020-04-02 04:44:41 +00:00
protoc:
cd types/proto && protoc --gofast_out=plugins=grpc:. statping.proto
2020-02-29 23:36:31 +00:00
yarn-serve:
cd frontend && yarn serve
2020-03-04 10:29:00 +00:00
yarn-install:
cd frontend && rm -rf node_modules && yarn
2020-02-29 23:36:31 +00:00
go-run:
go run ./cmd
2020-02-28 06:37:48 +00:00
start:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml start
stop:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml stop
2020-01-15 04:58:22 +00:00
2020-02-27 10:04:27 +00:00
logs:
docker logs statping --follow
2018-12-04 19:13:24 +00:00
2020-03-06 09:33:46 +00:00
db-up:
docker-compose -f dev/docker-compose.db.yml up -d --remove-orphans
db-down:
2020-04-15 13:05:22 +00:00
docker-compose -f dev/docker-compose.db.yml down --volumes --remove-orphans
2020-03-06 09:33:46 +00:00
2020-02-27 10:04:27 +00:00
console:
docker exec -t -i statping /bin/sh
2018-08-17 16:13:20 +00:00
2020-02-28 06:37:48 +00:00
compose-build-full: docker-base
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml build --parallel --build-arg VERSION=${VERSION}
2020-02-27 10:04:27 +00:00
docker-base:
2020-03-15 06:09:03 +00:00
docker build -t statping/statping:base -f Dockerfile.base --build-arg VERSION=${VERSION} .
2020-02-27 10:04:27 +00:00
docker-latest: docker-base
2020-03-13 04:06:06 +00:00
docker build -t statping/statping:latest --build-arg VERSION=${VERSION} .
2018-10-08 21:15:01 +00:00
2020-02-27 10:04:27 +00:00
docker-vue:
2020-03-13 04:06:06 +00:00
docker build -t statping/statping:vue --build-arg VERSION=${VERSION} .
docker-test:
docker-compose -f docker-compose.test.yml up --remove-orphans
2020-03-16 06:51:15 +00:00
push-base: clean compile docker-base
2020-03-13 04:06:06 +00:00
docker push statping/statping:base
2020-03-06 18:46:01 +00:00
2020-03-16 06:51:15 +00:00
push-vue: clean compile docker-base docker-vue
2020-03-13 04:06:06 +00:00
docker push statping/statping:base
docker push statping/statping:vue
2020-03-01 06:31:55 +00:00
2020-02-28 07:56:17 +00:00
modd:
modd -f ./dev/modd.conf
2020-02-27 10:04:27 +00:00
top:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml top
2019-12-18 11:36:29 +00:00
2020-02-27 10:04:27 +00:00
frontend-build:
2020-07-24 01:36:30 +00:00
@echo "Removing old frontend distributions..."
@rm -rf source/dist && rm -rf frontend/dist
@echo "yarn install and build static frontend"
2020-03-21 20:41:58 +00:00
cd frontend && yarn && yarn build
@cp -r frontend/dist source/
@cp -r frontend/src/assets/scss source/dist/
@cp frontend/public/favicon.ico source/dist/
@cp frontend/public/robots.txt source/dist/
@cp frontend/public/banner.png source/dist/
2020-07-24 01:36:30 +00:00
@cp -r frontend/public/favicon source/dist/
@echo "Frontend build complete at ./source/dist"
2019-12-18 11:36:29 +00:00
2020-03-19 01:50:53 +00:00
frontend-copy:
cp -r source/tmpl/*.* source/dist/
2020-03-19 02:30:19 +00:00
yarn:
rm -rf source/dist && rm -rf frontend/dist
cd frontend && yarn
# compile assets using SASS and Rice. compiles scss -> css, and run rice embed-go
2020-08-06 07:58:00 +00:00
compile: frontend-build
2020-03-06 22:18:06 +00:00
rm -f source/rice-box.go
2020-03-21 14:27:18 +00:00
cd source && rice embed-go
2020-08-06 07:58:00 +00:00
make generate
2018-08-14 04:13:06 +00:00
2020-03-06 22:18:06 +00:00
embed:
cd source && rice embed-go
2020-03-03 16:19:55 +00:00
install: build
2020-02-27 10:04:27 +00:00
mv $(BINARY_NAME) $(GOPATH)/bin/$(BINARY_NAME)
2018-08-14 04:13:06 +00:00
2020-03-25 19:23:50 +00:00
install-local: build
mv $(BINARY_NAME) /usr/local/bin/$(BINARY_NAME)
2020-08-03 10:35:48 +00:00
install-darwin:
go build -a -ldflags "-X main.VERSION=${VERSION}" -o statping --tags "netgo darwin" ./cmd
mv $(BINARY_NAME) /usr/local/bin/$(BINARY_NAME)
2020-02-27 10:04:27 +00:00
generate:
go generate ./...
2018-08-14 04:13:06 +00:00
2020-05-12 01:05:46 +00:00
build-all: clean compile build-folders build-linux build-linux-arm build-darwin build-win compress-folders
build-deps:
2020-07-24 01:36:30 +00:00
apt install -y libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi \
libncurses5-dev build-essential bison flex libssl-dev bc gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libsqlite3-dev gcc-mingw-w64 gcc-mingw-w64-x86-64
2020-05-12 01:05:46 +00:00
build-darwin:
GO111MODULE="on" GOOS=darwin GOARCH=amd64 \
go build -a -ldflags "-s -w -X main.VERSION=${VERSION}" -o releases/statping-darwin-amd64/statping --tags "netgo darwin" ./cmd
build-win:
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GO111MODULE="on" GOOS=windows GOARCH=amd64 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-windows-amd64/statping.exe ./cmd
CGO_ENABLED=1 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ GO111MODULE="on" GOOS=windows GOARCH=386 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-windows-386/statping.exe ./cmd
2020-05-12 01:05:46 +00:00
build-linux:
2020-07-24 04:11:31 +00:00
CGO_ENABLED=1 GO111MODULE="on" GOOS=linux GOARCH=amd64 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-amd64/statping --tags "netgo linux" ./cmd
2020-07-24 04:11:31 +00:00
CGO_ENABLED=1 GO111MODULE="on" GOOS=linux GOARCH=386 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-386/statping --tags "netgo linux" ./cmd
2020-05-12 01:05:46 +00:00
build-linux-arm:
2020-07-24 04:11:31 +00:00
CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc-6 CXX=arm-linux-gnueabihf-g++-6 GO111MODULE="on" GOOS=linux GOARCH=arm GOARM=6 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-arm6/statping --tags "netgo" ./cmd
CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc-6 CXX=arm-linux-gnueabihf-g++-6 GO111MODULE="on" GOOS=linux GOARCH=arm GOARM=7 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-arm7/statping --tags "netgo" ./cmd
CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc-6 CXX=aarch64-linux-gnu-g++-6 GO111MODULE="on" GOOS=linux GOARCH=arm64 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-arm64/statping --tags "netgo" ./cmd
2020-05-12 01:05:46 +00:00
2020-05-11 20:17:56 +00:00
build-folders:
mkdir build || true
for os in windows darwin linux;\
do \
2020-07-20 22:24:44 +00:00
for arch in 386 amd64 arm6 arm7 arm64;\
2020-05-11 20:17:56 +00:00
do \
mkdir -p releases/statping-$$os-$$arch/; \
done \
done
compress-folders:
mkdir build || true
for os in darwin linux;\
do \
2020-07-20 22:24:44 +00:00
for arch in 386 amd64 arm6 arm7 arm64;\
2020-05-11 20:17:56 +00:00
do \
chmod +x releases/statping-$$os-$$arch/statping || true; \
tar -czf releases/statping-$$os-$$arch.tar.gz -C releases/statping-$$os-$$arch statping || true; \
done \
done
2020-05-12 01:05:46 +00:00
chmod +x releases/statping-windows-386/statping.exe || true
chmod +x releases/statping-windows-amd64/statping.exe || true
chmod +x releases/statping-windows-arm/statping.exe || true
zip -j releases/statping-windows-386.zip releases/statping-windows-386/statping.exe || true; \
zip -j releases/statping-windows-amd64.zip releases/statping-windows-amd64/statping.exe || true; \
zip -j releases/statping-windows-arm.zip releases/statping-windows-arm/statping.exe || true; \
2020-05-11 20:17:56 +00:00
find ./releases/ -name "*.tar.gz" -type f -size +1M -exec mv "{}" build/ \;
find ./releases/ -name "*.zip" -type f -size +1M -exec mv "{}" build/ \;
2020-05-05 09:22:07 +00:00
# remove files for a clean compile/build
2018-08-14 04:13:06 +00:00
clean:
2020-07-24 01:36:30 +00:00
@echo "Cleaning temporary and build folders..."
@rm -rf ./{logs,assets,plugins,*.db,config.yml,.sass-cache,config.yml,statping,build,.sass-cache,index.html,vendor}
@rm -rf cmd/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log,*.html,*.json}
@rm -rf core/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
@rm -rf types/notifications/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
@rm -rf handlers/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
@rm -rf notifiers/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
@rm -rf source/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
@rm -rf types/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
@rm -rf utils/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
@rm -rf frontend/{logs,plugins,*.db,config.yml,.sass-cache,*.log}
@rm -rf dev/{logs,assets,plugins,*.db,config.yml,.sass-cache,*.log,test/app,plugin/*.so}
@rm -rf frontend/cypress/videos
@rm -f coverage.* sass
@rm -rf **/*.db-journal
@find . -name "*.out" -type f -delete
@find . -name "*.cpu" -type f -delete
@find . -name "*.mem" -type f -delete
@rm -rf {build,releases,tmp,source/build,snap,parts,prime,snap,stage}
@echo "Finished removing temporary and build folders"
2018-08-17 01:43:12 +00:00
2020-02-28 06:37:48 +00:00
print_details:
@echo \==== Statping Development Instance ====
@echo \Statping Vue Frontend: http://localhost:8888
@echo \Statping Backend API: http://localhost:8585
@echo \==== Statping Instances ====
@echo \Statping SQLite: http://localhost:4000
@echo \Statping MySQL: http://localhost:4005
@echo \Statping Postgres: http://localhost:4010
@echo \==== Databases ====
@echo \PHPMyAdmin: http://localhost:6000 \(MySQL database management\)
@echo \SQLite Web: http://localhost:6050 \(SQLite database management\)
@echo \PGAdmin: http://localhost:7000 \(Postgres database management \| email: admin@admin.com password: admin\)
@echo \Prometheus: http://localhost:7050 \(Prometheus Web UI\)
@echo \==== Monitoring and IDE ====
@echo \Grafana: http://localhost:3000 \(username: admin, password: admin\)
2020-03-19 02:08:29 +00:00
coverage: test-deps
$(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=travis -repotoken $(COVERALLS)
# build Statping using a travis ci trigger
2020-04-15 10:40:58 +00:00
travis-build:
2020-03-19 02:08:29 +00:00
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $(TRAVIS_API)" -d $(TRAVIS_BUILD_CMD) https://api.travis-ci.com/repo/statping%2Fstatping/requests
2020-03-04 10:29:00 +00:00
download-key:
2020-03-20 06:21:33 +00:00
wget -O statping.gpg $(SIGN_URL)
2020-03-04 10:29:00 +00:00
gpg --import statping.gpg
2020-03-03 16:19:55 +00:00
# push the :dev docker tag using curl
2020-04-15 16:04:54 +00:00
dockerhub-dev:
docker build --build-arg VERSION=${VERSION} -t statping/statping:dev --no-cache -f Dockerfile.base .
docker push statping/statping:dev
2020-03-03 16:19:55 +00:00
2020-04-15 16:04:54 +00:00
dockerhub:
docker build --build-arg VERSION=${VERSION} -t statping/statping:base --no-cache -f Dockerfile.base .
docker build --build-arg VERSION=${VERSION} -t statping/statping:latest --no-cache -f Dockerfile .
docker tag statping/statping statping/statping:v${VERSION}
docker push statping/statping:base
docker push statping/statping:v${VERSION}
docker push statping/statping
2020-04-15 16:04:54 +00:00
docker-build-dev:
docker build --build-arg VERSION=${VERSION} -t hunterlong/statping:latest --no-cache -f Dockerfile .
docker tag hunterlong/statping:dev hunterlong/statping:dev-v${VERSION}
2020-04-15 16:04:54 +00:00
post-release: frontend-build upload_to_s3 publish-homebrew dockerhub
2020-03-03 16:19:55 +00:00
# update the homebrew application to latest for mac
publish-homebrew:
2020-03-19 10:36:32 +00:00
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $(TRAVIS_API)" -d $(PUBLISH_BODY) https://api.travis-ci.com/repo/statping%2Fhomebrew-statping/requests
2020-03-03 16:19:55 +00:00
2020-07-30 23:14:41 +00:00
upload_to_s3:
tar -czvf source.tar.gz source/
aws s3 cp source.tar.gz s3://assets.statping.com/
rm -rf source.tar.gz
aws s3 cp source/dist/css/ s3://assets.statping.com/css/ --recursive --exclude "*" --include "*.css"
aws s3 cp source/dist/js/ s3://assets.statping.com/js/ --recursive --exclude "*" --include "*.js"
aws s3 cp source/dist/scss/ s3://assets.statping.com/scss/ --recursive --exclude "*" --include "*.scss"
aws s3 cp install.sh s3://assets.statping.com/
2020-03-03 16:19:55 +00:00
travis_s3_creds:
mkdir -p ~/.aws
echo "[default]\naws_access_key_id = ${AWS_ACCESS_KEY_ID}\naws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}" > ~/.aws/credentials
sign-all:
gpg --default-key $SIGN_KEY --detach-sign --armor statpinger
valid-sign:
gpg --verify statping.asc
sentry-release:
sentry-cli releases new -p backend -p frontend v${VERSION}
sentry-cli releases set-commits --auto v${VERSION}
sentry-cli releases finalize v${VERSION}
2020-03-03 16:19:55 +00:00
download-bins: clean
mkdir build || true
wget "https://github.com/statping/statping/releases/download/v${VERSION}/statping-linux-386.tar.gz"
wget "https://github.com/statping/statping/releases/download/v${VERSION}/statping-linux-amd64.tar.gz"
wget "https://github.com/statping/statping/releases/download/v${VERSION}/statping-linux-arm.tar.gz"
wget "https://github.com/statping/statping/releases/download/v${VERSION}/statping-linux-arm64.tar.gz"
mv statping-linux-386.tar.gz build/
mv statping-linux-amd64.tar.gz build/
mv statping-linux-arm.tar.gz build/
mv statping-linux-arm64.tar.gz build/
snapcraft: download-bins
mkdir snap
mv snapcraft.yaml snap/
2020-04-15 02:28:09 +00:00
PWD=$(shell pwd)
snapcraft clean statping
2020-04-15 10:07:48 +00:00
docker run --rm -v ${PWD}/build/statping-linux-amd64.tar.gz:/build/statping-linux.tar.gz -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=amd64"
snapcraft clean statping
2020-04-15 10:07:48 +00:00
docker run --rm -v ${PWD}/build/statping-linux-386.tar.gz:/build/statping-linux.tar.gz -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=i386"
snapcraft clean statping
2020-04-15 10:07:48 +00:00
docker run --rm -v ${PWD}/build/statping-linux-arm64.tar.gz:/build/statping-linux.tar.gz -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=arm64"
snapcraft clean statping
docker run --rm -v ${PWD}/build/statping-linux-arm.tar.gz:/build/statping-linux.tar.gz -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=arm"
2020-04-15 10:07:48 +00:00
snapcraft push statping_${VERSION}_amd64.snap --release stable
2020-04-15 02:28:09 +00:00
snapcraft push statping_${VERSION}_arm64.snap --release stable
snapcraft push statping_${VERSION}_i386.snap --release stable
snapcraft push statping_${VERSION}_arm.snap --release stable
2020-04-15 02:28:09 +00:00
2020-04-21 06:55:39 +00:00
postman: clean compile
2020-04-16 18:40:43 +00:00
API_SECRET=demosecret123 statping --port=8080 > /dev/null &
2020-04-16 09:57:00 +00:00
sleep 3
newman run -e dev/postman_environment.json dev/postman.json
killall statping
2020-05-20 06:41:50 +00:00
certs:
openssl req -newkey rsa:2048 \
-new -nodes -x509 \
-days 3650 \
-out cert.pem \
-keyout key.pem \
-subj "/C=US/ST=California/L=Santa Monica/O=Statping/OU=Development/CN=localhost"
2020-07-14 01:21:39 +00:00
buildx-latest: multiarch
2020-07-13 21:36:18 +00:00
docker buildx create --name statping-latest
docker buildx inspect --builder statping-latest --bootstrap
2020-07-14 08:38:02 +00:00
docker buildx build --builder statping-latest --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile -t statping/statping:latest -t statping/statping:v${VERSION} --build-arg=VERSION=${VERSION} .
2020-07-13 21:36:18 +00:00
docker buildx rm statping-latest
2020-07-12 21:51:59 +00:00
2020-07-14 01:21:39 +00:00
buildx-dev: multiarch
2020-07-12 21:51:59 +00:00
docker buildx create --name statping-dev
2020-07-13 21:36:18 +00:00
docker buildx inspect --builder statping-dev --bootstrap
2020-07-14 08:38:02 +00:00
docker buildx build --builder statping-dev --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile -t statping/statping:dev --build-arg=VERSION=${VERSION} .
2020-07-13 21:36:18 +00:00
docker buildx rm statping-dev
2020-07-12 21:51:59 +00:00
2020-07-13 21:36:18 +00:00
buildx-base: multiarch
2020-07-12 21:51:59 +00:00
docker buildx create --name statping-base
2020-07-13 21:36:18 +00:00
docker buildx inspect --builder statping-base --bootstrap
2020-07-14 08:38:02 +00:00
docker buildx build --builder statping-base --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile.base -t statping/statping:base --build-arg=VERSION=${VERSION} .
2020-07-13 21:36:18 +00:00
docker buildx rm statping-base
2020-07-09 19:29:46 +00:00
2020-07-13 21:36:18 +00:00
multiarch:
mkdir /tmp/.buildx-cache || true
2020-07-13 21:36:18 +00:00
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
2020-07-30 23:14:41 +00:00
delve:
go build -gcflags "all=-N -l" -o statping ./cmd
dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient exec ./statping
check:
@echo "Checking the programs required for the build are installed..."
2020-07-24 01:36:30 +00:00
@echo "go: $(shell go version) - $(shell which go)" && go version >/dev/null 2>&1 || (echo "ERROR: go 1.14 is required."; exit 1)
@echo "node: $(shell node --version) - $(shell which node)" && node --version >/dev/null 2>&1 || (echo "ERROR: node 12.x is required."; exit 1)
@echo "yarn: $(shell yarn --version) - $(shell which yarn)" && yarn --version >/dev/null 2>&1 || (echo "ERROR: yarn is required."; exit 1)
@echo "All required programs are installed!"
2020-08-03 10:35:48 +00:00
.PHONY: all check build certs multiarch install-darwin go-build build-all buildx-base buildx-dev buildx-latest build-alpine test-all test test-api docker frontend up down print_details lite sentry-release snapcraft build-linux build-mac build-win build-all postman
2019-12-29 21:01:53 +00:00
.SILENT: travis_s3_creds