mirror of https://github.com/statping/statping
parent
615577a00b
commit
5cd3e90b43
|
@ -137,7 +137,7 @@ jobs:
|
||||||
# parallel: false
|
# parallel: false
|
||||||
|
|
||||||
- name: Go Tests
|
- name: Go Tests
|
||||||
run: SASS=`which sass` go test -v -covermode=count -coverprofile=coverage.out -p=1 ./...
|
run: go test -v -covermode=count -coverprofile=coverage.out -p=1 ./...
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ env.VERSION }}
|
VERSION: ${{ env.VERSION }}
|
||||||
DB_CONN: sqlite3
|
DB_CONN: sqlite3
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
# 0.90.29 (04-19-2020)
|
||||||
|
- Added HTTP Redirects for services
|
||||||
|
- Removed use of SASS environment variable, now finds path or sends error
|
||||||
|
- Modified Makefile to create new snapcraft versions
|
||||||
|
- Fixed issue when logs are not initiated yet. Issue #502
|
||||||
|
- Fixed issue when SQLite (statping.db) is not found Issue #499
|
||||||
|
|
||||||
# 0.90.28 (04-16-2020)
|
# 0.90.28 (04-16-2020)
|
||||||
- Fixed postgres timestamp grouping
|
- Fixed postgres timestamp grouping
|
||||||
- Added postman (newman) API testing
|
- Added postman (newman) API testing
|
||||||
|
|
21
Makefile
21
Makefile
|
@ -39,8 +39,7 @@ release: test-deps
|
||||||
make build-all
|
make build-all
|
||||||
|
|
||||||
test-ci: clean compile test-deps
|
test-ci: clean compile test-deps
|
||||||
DB_CONN=sqlite SASS=`which sass` \
|
DB_CONN=sqlite go test -v -covermode=count -coverprofile=coverage.out -p=1 ./...
|
||||||
go test -v -covermode=count -coverprofile=coverage.out -p=1 ./...
|
|
||||||
goveralls -coverprofile=coverage.out -service=travis-ci -repotoken ${COVERALLS}
|
goveralls -coverprofile=coverage.out -service=travis-ci -repotoken ${COVERALLS}
|
||||||
|
|
||||||
cypress: clean
|
cypress: clean
|
||||||
|
@ -153,7 +152,7 @@ generate:
|
||||||
cd source && go generate
|
cd source && go generate
|
||||||
|
|
||||||
build-bin:
|
build-bin:
|
||||||
mkdir build
|
mkdir build || true
|
||||||
export PWD=`pwd`
|
export PWD=`pwd`
|
||||||
@for arch in $(ARCHS);\
|
@for arch in $(ARCHS);\
|
||||||
do \
|
do \
|
||||||
|
@ -202,7 +201,7 @@ clean:
|
||||||
find . -name "*.out" -type f -delete
|
find . -name "*.out" -type f -delete
|
||||||
find . -name "*.cpu" -type f -delete
|
find . -name "*.cpu" -type f -delete
|
||||||
find . -name "*.mem" -type f -delete
|
find . -name "*.mem" -type f -delete
|
||||||
rm -rf {build,releases,tmp,source/build}
|
rm -rf {build,releases,tmp,source/build,snap}
|
||||||
|
|
||||||
print_details:
|
print_details:
|
||||||
@echo \==== Statping Development Instance ====
|
@echo \==== Statping Development Instance ====
|
||||||
|
@ -278,19 +277,21 @@ sentry-release:
|
||||||
sentry-cli releases finalize v${VERSION}
|
sentry-cli releases finalize v${VERSION}
|
||||||
|
|
||||||
snapcraft: clean compile build-bin
|
snapcraft: clean compile build-bin
|
||||||
|
mkdir snap
|
||||||
|
mv snapcraft.yaml snap/
|
||||||
PWD=$(shell pwd)
|
PWD=$(shell pwd)
|
||||||
snapcraft clean statping -s pull
|
snapcraft clean statping
|
||||||
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"
|
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 -s pull
|
snapcraft clean statping
|
||||||
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"
|
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 -s pull
|
snapcraft clean statping
|
||||||
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"
|
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 -s pull
|
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=armhf"
|
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"
|
||||||
snapcraft push statping_${VERSION}_amd64.snap --release stable
|
snapcraft push statping_${VERSION}_amd64.snap --release stable
|
||||||
snapcraft push statping_${VERSION}_arm64.snap --release stable
|
snapcraft push statping_${VERSION}_arm64.snap --release stable
|
||||||
snapcraft push statping_${VERSION}_i386.snap --release stable
|
snapcraft push statping_${VERSION}_i386.snap --release stable
|
||||||
snapcraft push statping_${VERSION}_armhf.snap --release stable
|
snapcraft push statping_${VERSION}_arm.snap --release stable
|
||||||
|
|
||||||
postman: clean
|
postman: clean
|
||||||
API_SECRET=demosecret123 statping --port=8080 > /dev/null &
|
API_SECRET=demosecret123 statping --port=8080 > /dev/null &
|
||||||
|
|
|
@ -323,7 +323,6 @@ func HelpEcho() {
|
||||||
fmt.Println(" DOMAIN - Set a URL for the Statping status page")
|
fmt.Println(" DOMAIN - Set a URL for the Statping status page")
|
||||||
fmt.Println(" ADMIN_USER - Username for administrator account (default: admin)")
|
fmt.Println(" ADMIN_USER - Username for administrator account (default: admin)")
|
||||||
fmt.Println(" ADMIN_PASS - Password for administrator account (default: admin)")
|
fmt.Println(" ADMIN_PASS - Password for administrator account (default: admin)")
|
||||||
fmt.Println(" SASS - Set the absolute path to the sass binary location")
|
|
||||||
fmt.Println(" USE_ASSETS - Automatically use assets from 'assets folder' (true/false)")
|
fmt.Println(" USE_ASSETS - Automatically use assets from 'assets folder' (true/false)")
|
||||||
fmt.Println(" HTTP_PROXY - Use a HTTP Proxy for HTTP Requests")
|
fmt.Println(" HTTP_PROXY - Use a HTTP Proxy for HTTP Requests")
|
||||||
fmt.Println(" AUTH_USERNAME - HTTP Basic Authentication username")
|
fmt.Println(" AUTH_USERNAME - HTTP Basic Authentication username")
|
||||||
|
|
|
@ -135,6 +135,16 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="service.type.match(/^(http)$/)" class="form-group row">
|
||||||
|
<label class="col-sm-4 col-form-label">Follow HTTP Redirects</label>
|
||||||
|
<div class="col-8 mt-1">
|
||||||
|
<span @click="service.redirect = !!service.redirect" class="switch float-left">
|
||||||
|
<input v-model="service.redirect" type="checkbox" name="redirect-option" class="switch" id="switch-redirect" v-bind:checked="service.redirect">
|
||||||
|
<label for="switch-redirect">Follow HTTP Redirects if server attempts</label>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-if="service.type.match(/^(http)$/)" class="form-group row">
|
<div v-if="service.type.match(/^(http)$/)" class="form-group row">
|
||||||
<label class="col-sm-4 col-form-label">Verify SSL</label>
|
<label class="col-sm-4 col-form-label">Verify SSL</label>
|
||||||
<div class="col-8 mt-1">
|
<div class="col-8 mt-1">
|
||||||
|
@ -220,6 +230,7 @@
|
||||||
permalink: "",
|
permalink: "",
|
||||||
order: 1,
|
order: 1,
|
||||||
verify_ssl: true,
|
verify_ssl: true,
|
||||||
|
redirect: true,
|
||||||
allow_notifications: true,
|
allow_notifications: true,
|
||||||
notify_all_changes: true,
|
notify_all_changes: true,
|
||||||
notify_after: 2,
|
notify_after: 2,
|
||||||
|
|
|
@ -43,13 +43,10 @@ func scssRendered(name string) string {
|
||||||
|
|
||||||
// CompileSASS will attempt to compile the SASS files into CSS
|
// CompileSASS will attempt to compile the SASS files into CSS
|
||||||
func CompileSASS(files ...string) error {
|
func CompileSASS(files ...string) error {
|
||||||
sassBin := utils.Params.GetString("SASS")
|
sassBin, err := exec.LookPath("sass")
|
||||||
|
|
||||||
path, err := exec.LookPath("sass")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
sassBin = path
|
|
||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
scssFile := fmt.Sprintf("%v/assets/%v", utils.Params.GetString("STATPING_DIR"), file)
|
scssFile := fmt.Sprintf("%v/assets/%v", utils.Params.GetString("STATPING_DIR"), file)
|
||||||
|
|
|
@ -10,12 +10,11 @@ func (d *DbConfig) ConnectionString() string {
|
||||||
postgresSSL := utils.Params.GetString("POSTGRES_SSLMODE")
|
postgresSSL := utils.Params.GetString("POSTGRES_SSLMODE")
|
||||||
|
|
||||||
switch d.DbConn {
|
switch d.DbConn {
|
||||||
case "sqlite", "sqlite3", "memory":
|
case "memory", ":memory:":
|
||||||
if d.DbConn == "memory" {
|
|
||||||
conn = "sqlite3"
|
conn = "sqlite3"
|
||||||
d.DbConn = ":memory:"
|
d.DbConn = ":memory:"
|
||||||
return d.DbConn
|
return d.DbConn
|
||||||
} else {
|
case "sqlite", "sqlite3":
|
||||||
conn, err := findDbFile(d)
|
conn, err := findDbFile(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorln(err)
|
log.Errorln(err)
|
||||||
|
@ -24,7 +23,6 @@ func (d *DbConfig) ConnectionString() string {
|
||||||
log.Infof("SQL database file at: %s", d.SqlFile)
|
log.Infof("SQL database file at: %s", d.SqlFile)
|
||||||
d.DbConn = "sqlite3"
|
d.DbConn = "sqlite3"
|
||||||
return d.SqlFile
|
return d.SqlFile
|
||||||
}
|
|
||||||
case "mysql":
|
case "mysql":
|
||||||
host := fmt.Sprintf("%v:%v", d.DbHost, d.DbPort)
|
host := fmt.Sprintf("%v:%v", d.DbHost, d.DbPort)
|
||||||
conn = fmt.Sprintf("%v:%v@tcp(%v)/%v?charset=utf8&parseTime=True&loc=UTC&time_zone=%%27UTC%%27", d.DbUser, d.DbPass, host, d.DbData)
|
conn = fmt.Sprintf("%v:%v@tcp(%v)/%v?charset=utf8&parseTime=True&loc=UTC&time_zone=%%27UTC%%27", d.DbUser, d.DbPass, host, d.DbData)
|
||||||
|
|
|
@ -38,7 +38,8 @@ func findDbFile(configs *DbConfig) (string, error) {
|
||||||
if configs == nil {
|
if configs == nil {
|
||||||
file, err := findSQLin(utils.Directory)
|
file, err := findSQLin(utils.Directory)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
log.Errorln(err)
|
||||||
|
return location, nil
|
||||||
}
|
}
|
||||||
location = file
|
location = file
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,6 +234,10 @@ func CheckHttp(s *Service, record bool) *Service {
|
||||||
headers = nil
|
headers = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.Redirect.Bool {
|
||||||
|
headers = append(headers, "Redirect=true")
|
||||||
|
}
|
||||||
|
|
||||||
if s.PostData.String != "" {
|
if s.PostData.String != "" {
|
||||||
data = bytes.NewBuffer([]byte(s.PostData.String))
|
data = bytes.NewBuffer([]byte(s.PostData.String))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,6 +21,7 @@ func Samples() error {
|
||||||
Public: null.NewNullBool(true),
|
Public: null.NewNullBool(true),
|
||||||
Permalink: null.NewNullString("google"),
|
Permalink: null.NewNullString("google"),
|
||||||
VerifySSL: null.NewNullBool(true),
|
VerifySSL: null.NewNullBool(true),
|
||||||
|
Redirect: null.NewNullBool(true),
|
||||||
NotifyAfter: 3,
|
NotifyAfter: 3,
|
||||||
CreatedAt: createdOn,
|
CreatedAt: createdOn,
|
||||||
}
|
}
|
||||||
|
@ -79,6 +80,7 @@ func Samples() error {
|
||||||
Order: 4,
|
Order: 4,
|
||||||
Public: null.NewNullBool(true),
|
Public: null.NewNullBool(true),
|
||||||
VerifySSL: null.NewNullBool(true),
|
VerifySSL: null.NewNullBool(true),
|
||||||
|
Redirect: null.NewNullBool(true),
|
||||||
GroupId: 2,
|
GroupId: 2,
|
||||||
NotifyAfter: 3,
|
NotifyAfter: 3,
|
||||||
CreatedAt: createdOn,
|
CreatedAt: createdOn,
|
||||||
|
@ -111,6 +113,7 @@ func Samples() error {
|
||||||
Timeout: 120,
|
Timeout: 120,
|
||||||
Order: 6,
|
Order: 6,
|
||||||
Public: null.NewNullBool(false),
|
Public: null.NewNullBool(false),
|
||||||
|
Redirect: null.NewNullBool(true),
|
||||||
GroupId: 3,
|
GroupId: 3,
|
||||||
CreatedAt: createdOn,
|
CreatedAt: createdOn,
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ type Service struct {
|
||||||
GroupId int `gorm:"default:0;column:group_id" json:"group_id"`
|
GroupId int `gorm:"default:0;column:group_id" json:"group_id"`
|
||||||
Headers null.NullString `gorm:"column:headers" json:"headers" scope:"user,admin"`
|
Headers null.NullString `gorm:"column:headers" json:"headers" scope:"user,admin"`
|
||||||
Permalink null.NullString `gorm:"column:permalink" json:"permalink"`
|
Permalink null.NullString `gorm:"column:permalink" json:"permalink"`
|
||||||
|
Redirect null.NullBool `gorm:"default:false;column:redirect" json:"redirect" scope:"user,admin"`
|
||||||
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
|
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
|
||||||
Online bool `gorm:"-" json:"online"`
|
Online bool `gorm:"-" json:"online"`
|
||||||
|
|
|
@ -53,7 +53,6 @@ func setDefaults() {
|
||||||
Params.SetDefault("USE_CDN", false)
|
Params.SetDefault("USE_CDN", false)
|
||||||
Params.SetDefault("ALLOW_REPORTS", false)
|
Params.SetDefault("ALLOW_REPORTS", false)
|
||||||
Params.SetDefault("POSTGRES_SSLMODE", "disable")
|
Params.SetDefault("POSTGRES_SSLMODE", "disable")
|
||||||
Params.SetDefault("SASS", "sass")
|
|
||||||
Params.SetDefault("REMOVE_AFTER", 2160*time.Hour)
|
Params.SetDefault("REMOVE_AFTER", 2160*time.Hour)
|
||||||
Params.SetDefault("CLEANUP_INTERVAL", 1*time.Hour)
|
Params.SetDefault("CLEANUP_INTERVAL", 1*time.Hour)
|
||||||
|
|
||||||
|
|
|
@ -250,6 +250,13 @@ func HttpRequest(url, method string, content interface{}, headers []string, body
|
||||||
Timeout: timeout,
|
Timeout: timeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.Header.Get("Redirect") != "true" {
|
||||||
|
client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
|
||||||
|
return http.ErrUseLastResponse
|
||||||
|
}
|
||||||
|
req.Header.Del("Redirect")
|
||||||
|
}
|
||||||
|
|
||||||
if resp, err = client.Do(req); err != nil {
|
if resp, err = client.Do(req); err != nil {
|
||||||
httpMetric.Errors++
|
httpMetric.Errors++
|
||||||
return nil, resp, err
|
return nil, resp, err
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.90.28
|
0.90.29
|
||||||
|
|
Loading…
Reference in New Issue