include netgo tag during golang build process

pull/604/head
hunterlong 2020-05-25 22:11:32 -07:00
parent 96be7f96da
commit 5d66e34e56
17 changed files with 43 additions and 22 deletions

View File

@ -1,3 +1,6 @@
# 0.90.44 (05-25-2020)
- Modified Makefile to include "netgo" tag during golang build
# 0.90.43 (05-21-2020)
- Fixed service TLS checkbox form for edit and create
- Modified ICMP ping's to use system's "ping" command (doesn't need root access)

View File

@ -162,13 +162,13 @@ build-win:
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-windows-386/statping.exe ./cmd
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 "darwin" ./cmd
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-linux:
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 "linux" ./cmd
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-amd64/statping --tags "netgo linux" ./cmd
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 "linux" ./cmd
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-386/statping --tags "netgo linux" ./cmd
build-linux-arm:
CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc-6 CXX=arm-linux-gnueabihf-g++-6 GO111MODULE="on" GOOS=linux GOARCH=arm GOARM=7 \

View File

@ -114,8 +114,9 @@ func start() {
}
if utils.Params.GetBool("SAMPLE_DATA") {
log.Infoln("Adding Sample Data")
if err := configs.TriggerSamples(); err != nil {
exit(errors.Wrap(err, "error creating database"))
exit(errors.Wrap(err, "error adding sample data"))
}
} else {
if err := core.Samples(); err != nil {

View File

@ -6,6 +6,7 @@ import (
)
func Samples() error {
log.Infoln("Inserting Sample Checkins...")
checkin1 := &Checkin{
Name: "Demo Checkin 1",
ServiceId: 1,
@ -31,6 +32,7 @@ func Samples() error {
}
func SamplesChkHits() error {
log.Infoln("Inserting Sample Checkins Hits...")
checkTime := utils.Now().Add(-3 * time.Minute)
for i := int64(1); i <= 2; i++ {

View File

@ -28,9 +28,8 @@ type Sampler interface {
func TriggerSamples() error {
return createSamples(
core.Samples,
//users.Samples,
messages.Samples,
services.Samples,
messages.Samples,
checkins.Samples,
checkins.SamplesChkHits,
failures.Samples,

View File

@ -9,10 +9,11 @@ import (
)
var (
log = utils.Log
log = utils.Log.WithField("type", "failure")
)
func Samples() error {
log.Infoln("Inserting Sample Service Failures...")
createdAt := utils.Now().Add(-3 * types.Day)
for i := int64(1); i <= 4; i++ {

View File

@ -3,10 +3,14 @@ package groups
import (
"github.com/statping/statping/database"
"github.com/statping/statping/types/errors"
"github.com/statping/statping/utils"
"sort"
)
var db database.Database
var (
db database.Database
log = utils.Log.WithField("type", "group")
)
func SetDB(database database.Database) {
db = database.Model(&Group{})

View File

@ -5,6 +5,7 @@ import (
)
func Samples() error {
log.Infoln("Inserting Sample Groups...")
group1 := &Group{
Name: "Main Services",
Public: null.NewNullBool(true),

View File

@ -14,6 +14,7 @@ import (
var SampleHits = 99900.
func Samples() error {
log.Infoln("Inserting Sample Service Hits...")
for i := int64(1); i <= 5; i++ {
records := createHitsAt(i)
if err := gormbulk.BulkInsert(db.GormDB(), records, db.ChunkSize()); err != nil {

View File

@ -1,10 +1,14 @@
package incidents
import "github.com/statping/statping/database"
import (
"github.com/statping/statping/database"
"github.com/statping/statping/utils"
)
var (
db database.Database
dbUpdate database.Database
log = utils.Log.WithField("type", "service")
)
func SetDB(database database.Database) {

View File

@ -6,6 +6,7 @@ import (
)
func Samples() error {
log.Infoln("Inserting Sample Incidents...")
incident1 := &Incident{
Title: "Github Issues",
Description: "There are new features for Statping, if you have any issues please visit the Github Repo.",

View File

@ -3,9 +3,13 @@ package messages
import (
"github.com/statping/statping/database"
"github.com/statping/statping/types/errors"
"github.com/statping/statping/utils"
)
var db database.Database
var (
db database.Database
log = utils.Log.WithField("type", "message")
)
func SetDB(database database.Database) {
db = database.Model(&Message{})

View File

@ -5,6 +5,7 @@ import (
)
func Samples() error {
log.Infoln("Inserting Sample Messages...")
m1 := &Message{
Title: "Routine Downtime",
Description: "This is an example a upcoming message for a service!",

View File

@ -7,6 +7,7 @@ import (
)
func Samples() error {
log.Infoln("Inserting Sample Services...")
createdOn := utils.Now().Add(((-24 * 30) * 3) * time.Hour)
s1 := &Service{
Name: "Google",

View File

@ -5,6 +5,7 @@ import (
)
func Samples() error {
log.Infoln("Inserting Sample Users...")
u2 := &User{
Username: "testadmin",
Password: "password123",

View File

@ -7,15 +7,16 @@ import (
)
var (
Params *viper.Viper
Params *viper.Viper
configLog = Log.WithField("type", "configs")
)
func InitCLI() {
Params = viper.New()
Params.AutomaticEnv()
setDefaults()
Directory = Params.GetString("STATPING_DIR")
//Params.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
setDefaults()
Params.SetConfigName("config")
Params.SetConfigType("yml")
Params.AddConfigPath(Directory)
@ -30,16 +31,12 @@ func InitCLI() {
}
func setDefaults() {
if Directory == "" {
defaultDir, err := os.Getwd()
if err != nil {
defaultDir = "."
}
Params.SetDefault("STATPING_DIR", defaultDir)
Directory = defaultDir
defaultDir, err := os.Getwd()
if err != nil {
configLog.Errorln(err)
defaultDir = "."
}
Directory = Params.GetString("STATPING_DIR")
Params.SetDefault("STATPING_DIR", Directory)
Params.SetDefault("STATPING_DIR", defaultDir)
Params.SetDefault("GO_ENV", "")
Params.SetDefault("DB_CONN", "")
Params.SetDefault("DISABLE_LOGS", false)

View File

@ -1 +1 @@
0.90.43
0.90.44