mirror of https://github.com/statping/statping
updates
parent
eb5e291e56
commit
29c332f0d9
96
Makefile
96
Makefile
|
@ -2,7 +2,7 @@ VERSION=$(shell cat version.txt)
|
|||
SIGN_KEY=B76D61FAA6DB759466E83D9964B9C6AAE2D55278
|
||||
BINARY_NAME=statping
|
||||
GOBUILD=go build -a
|
||||
GOVERSION=1.13.5
|
||||
GOVERSION=1.14
|
||||
XGO=xgo -go $(GOVERSION) --dest=build
|
||||
BUILDVERSION=-ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=$(TRAVIS_COMMIT)"
|
||||
TRVIS_SECRET=lRqWSt5BoekFK6+padJF+b77YkGdispPXEUKNuD7/Hxb7yJMoI8T/n8xZrTHtCZPdjtpy7wIlJCezNoYEZB3l2GnD6Y1QEZEXF7MIxP7hwsB/uSc5/lgdGW0ZLvTBfv6lwI/GjQIklPBW/4xcKJtj4s1YBP7xvqyIb/lDN7TiOqAKF4gqRVVfsxvlkm7j4TiPCXtz17hYQfU8kKBbd+vd3PuZgdWqs//5RwKk3Ld8QR8zoo9xXQVC5NthiyVbHznzczBsHy2cRZZoWxyi7eJM1HrDw8Jn/ivJONIHNv3RgFVn2rAoKu1X8F6FyuvPO0D2hWC62mdO/e0kt4X0mn9/6xlLSKwrHir67UgNVQe3tvlH0xNKh+yNZqR5x9t0V54vNks6Pgbhas5EfLHoWn5cF4kbJzqkXeHjt1msrsqpA3HKbmtwwjJr4Slotfiu22mAhqLSOV+xWV+IxrcNnrEq/Pa+JAzU12Uyxs8swaLJGPRAlWnJwzL9HK5aOpN0sGTuSEsTwj0WxeMMRx25YEq3+LZOgwOy3fvezmeDnKuBZa6MVCoMMpx1CRxMqAOlTGZXHjj+ZPmqDUUBpzAsFSzIdVRgcnDlLy7YRiz3tVWa1G5S07l/VcBN7ZgvCwOWZ0QgOH0MxkoDfhrfoMhNO6MBFDTRKCEl4TroPEhcInmXU8=
|
||||
|
@ -71,13 +71,13 @@ frontend-build:
|
|||
cp -r source/tmpl/*.* source/dist/
|
||||
|
||||
# compile assets using SASS and Rice. compiles scss -> css, and run rice embed-go
|
||||
compile: generate
|
||||
compile: frontend-build generate
|
||||
cd source && rice embed-go
|
||||
|
||||
build:
|
||||
build: clean
|
||||
$(GOBUILD) $(BUILDVERSION) -o $(BINARY_NAME) ./cmd
|
||||
|
||||
install:
|
||||
install: build
|
||||
mv $(BINARY_NAME) $(GOPATH)/bin/$(BINARY_NAME)
|
||||
|
||||
generate:
|
||||
|
@ -122,5 +122,93 @@ print_details:
|
|||
@echo \==== Monitoring and IDE ====
|
||||
@echo \Grafana: http://localhost:3000 \(username: admin, password: admin\)
|
||||
|
||||
# build Statping for Mac, 64 and 32 bit
|
||||
build-mac: compile
|
||||
mkdir build
|
||||
$(XGO) $(BUILDVERSION) --targets=darwin/amd64,darwin/386 ./cmd
|
||||
|
||||
# build Statping for Linux 64, 32 bit, arm6/arm7
|
||||
build-linux: compile
|
||||
$(XGO) $(BUILDVERSION) --targets=linux/amd64,linux/386,linux/arm-7,linux/arm-6,linux/arm64 ./cmd
|
||||
|
||||
# build for windows 64 bit only
|
||||
build-windows: compile
|
||||
$(XGO) $(BUILDVERSION) --targets=windows-6.0/amd64 ./cmd
|
||||
|
||||
# build Alpine linux binary (used in docker images)
|
||||
build-alpine: compile
|
||||
$(XGO) --targets=linux/amd64 -ldflags="-X main.VERSION=${VERSION} -X main.COMMIT=$(TRAVIS_COMMIT) -linkmode external -extldflags -static" -out alpine ./cmd
|
||||
|
||||
# build :latest docker tag
|
||||
docker-build-latest:
|
||||
docker build --build-arg VERSION=${VERSION} -t hunterlong/statping:latest --no-cache -f Dockerfile .
|
||||
docker tag hunterlong/statping:latest hunterlong/statping:v${VERSION}
|
||||
|
||||
# compress built binaries into tar.gz and zip formats
|
||||
compress:
|
||||
cd build && mv alpine-linux-amd64 $(BINARY_NAME)
|
||||
cd build && gpg --default-key $(SIGN_KEY) --batch --detach-sign --output statping.asc --armor $(BINARY_NAME)
|
||||
cd build && tar -czvf $(BINARY_NAME)-linux-alpine.tar.gz $(BINARY_NAME) statping.asc && rm -f $(BINARY_NAME) statping.asc
|
||||
cd build && mv cmd-darwin-10.6-amd64 $(BINARY_NAME)
|
||||
cd build && gpg --default-key $(SIGN_KEY) --batch --detach-sign --output statping.asc --armor $(BINARY_NAME)
|
||||
cd build && tar -czvf $(BINARY_NAME)-osx-x64.tar.gz $(BINARY_NAME) statping.asc && rm -f $(BINARY_NAME) statping.asc
|
||||
cd build && mv cmd-darwin-10.6-386 $(BINARY_NAME)
|
||||
cd build && gpg --default-key $(SIGN_KEY) --batch --detach-sign --output statping.asc --armor $(BINARY_NAME)
|
||||
cd build && tar -czvf $(BINARY_NAME)-osx-x32.tar.gz $(BINARY_NAME) statping.asc && rm -f $(BINARY_NAME) statping.asc
|
||||
cd build && mv cmd-linux-amd64 $(BINARY_NAME)
|
||||
cd build && gpg --default-key $(SIGN_KEY) --batch --detach-sign --output statping.asc --armor $(BINARY_NAME)
|
||||
cd build && tar -czvf $(BINARY_NAME)-linux-x64.tar.gz $(BINARY_NAME) statping.asc && rm -f $(BINARY_NAME) statping.asc
|
||||
cd build && mv cmd-linux-386 $(BINARY_NAME)
|
||||
cd build && gpg --default-key $(SIGN_KEY) --batch --detach-sign --output statping.asc --armor $(BINARY_NAME)
|
||||
cd build && tar -czvf $(BINARY_NAME)-linux-x32.tar.gz $(BINARY_NAME) statping.asc && rm -f $(BINARY_NAME) statping.asc
|
||||
cd build && mv cmd-windows-6.0-amd64.exe $(BINARY_NAME).exe
|
||||
cd build && gpg --default-key $(SIGN_KEY) --batch --detach-sign --output statping.asc --armor $(BINARY_NAME).exe
|
||||
cd build && zip $(BINARY_NAME)-windows-x64.zip $(BINARY_NAME).exe statping.asc && rm -f $(BINARY_NAME).exe statping.asc
|
||||
cd build && mv cmd-linux-arm-7 $(BINARY_NAME)
|
||||
cd build && gpg --default-key $(SIGN_KEY) --batch --detach-sign --output statping.asc --armor $(BINARY_NAME)
|
||||
cd build && tar -czvf $(BINARY_NAME)-linux-arm7.tar.gz $(BINARY_NAME) statping.asc && rm -f $(BINARY_NAME) statping.asc
|
||||
cd build && mv cmd-linux-arm-6 $(BINARY_NAME)
|
||||
cd build && gpg --default-key $(SIGN_KEY) --batch --detach-sign --output statping.asc --armor $(BINARY_NAME)
|
||||
cd build && tar -czvf $(BINARY_NAME)-linux-arm6.tar.gz $(BINARY_NAME) statping.asc && rm -f $(BINARY_NAME) statping.asc
|
||||
cd build && mv cmd-linux-arm64 $(BINARY_NAME)
|
||||
cd build && gpg --default-key $(SIGN_KEY) --batch --detach-sign --output statping.asc --armor $(BINARY_NAME)
|
||||
cd build && tar -czvf $(BINARY_NAME)-linux-arm64.tar.gz $(BINARY_NAME) statping.asc && rm -f $(BINARY_NAME) statping.asc
|
||||
|
||||
# push the :dev docker tag using curl
|
||||
publish-dev:
|
||||
curl -H "Content-Type: application/json" --data '{"docker_tag": "dev"}' -X POST $(DOCKER)
|
||||
|
||||
# update the homebrew application to latest for mac
|
||||
publish-homebrew:
|
||||
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/hunterlong%2Fhomebrew-statping/requests
|
||||
|
||||
upload_to_s3:
|
||||
aws s3 cp ./source/css $(ASSETS_BKT) --recursive --exclude "*" --include "*.css"
|
||||
aws s3 cp ./source/js $(ASSETS_BKT) --recursive --exclude "*" --include "*.js"
|
||||
aws s3 cp ./source/font $(ASSETS_BKT) --recursive --exclude "*" --include "*.eot" --include "*.svg" --include "*.woff" --include "*.woff2" --include "*.ttf" --include "*.css"
|
||||
aws s3 cp ./source/scss $(ASSETS_BKT) --recursive --exclude "*" --include "*.scss"
|
||||
aws s3 cp ./install.sh $(ASSETS_BKT)
|
||||
|
||||
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
|
||||
|
||||
# build Statping using a travis ci trigger
|
||||
travis-build: travis_s3_creds upload_to_s3
|
||||
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/hunterlong%2Fstatping/requests
|
||||
curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST $(DOCKER)
|
||||
|
||||
sign-all:
|
||||
gpg --default-key $SIGN_KEY --detach-sign --armor statpinger
|
||||
|
||||
valid-sign:
|
||||
gpg --verify statping.asc
|
||||
|
||||
# install xgo and pull the xgo docker image
|
||||
xgo-install: clean
|
||||
go get github.com/crazy-max/xgo
|
||||
docker pull crazy-max/xgo:${GOVERSION}
|
||||
|
||||
|
||||
.PHONY: all build build-all build-alpine test-all test test-api docker frontend up down print_details lite
|
||||
.SILENT: travis_s3_creds
|
||||
|
|
|
@ -255,8 +255,8 @@ func SaveConfig(d *types.DbConfig) error {
|
|||
if d.ApiKey == "" || d.ApiSecret == "" {
|
||||
apiKey := utils.Getenv("API_KEY", utils.NewSHA1Hash(16))
|
||||
apiSecret := utils.Getenv("API_SECRET", utils.NewSHA1Hash(16))
|
||||
CoreApp.config.ApiKey = apiKey.(string)
|
||||
CoreApp.config.ApiSecret = apiSecret.(string)
|
||||
d.ApiKey = apiKey.(string)
|
||||
d.ApiSecret = apiSecret.(string)
|
||||
}
|
||||
if d.DbConn == "sqlite3" {
|
||||
d.DbConn = "sqlite"
|
||||
|
|
|
@ -561,6 +561,8 @@ func InsertLargeSampleData() error {
|
|||
|
||||
var dayAgo = time.Now().UTC().Add((-24 * 90) * time.Hour)
|
||||
|
||||
CoreApp.services, _ = SelectAllServices(false)
|
||||
|
||||
insertHitRecords(dayAgo, 5450)
|
||||
|
||||
insertFailureRecords(dayAgo, 730)
|
||||
|
|
Loading…
Reference in New Issue