statping/core/sample.go

676 lines
16 KiB
Go
Raw Normal View History

2018-12-04 05:57:11 +00:00
// Statping
// Copyright (C) 2018. Hunter Long and the project contributors
// Written by Hunter Long <info@socialeck.com> and the project contributors
//
2018-12-04 04:17:29 +00:00
// https://github.com/hunterlong/statping
//
// The licenses for most software and other practical works are designed
// to take away your freedom to share and change the works. By contrast,
// the GNU General Public License is intended to guarantee your freedom to
// share and change all versions of a program--to make sure it remains free
// software for all its users.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package core
import (
"fmt"
2019-12-30 00:40:20 +00:00
"github.com/hunterlong/statping/core/notifier"
2020-02-25 07:41:28 +00:00
"github.com/hunterlong/statping/database"
2018-12-04 04:17:29 +00:00
"github.com/hunterlong/statping/types"
"github.com/hunterlong/statping/utils"
2020-01-04 02:03:59 +00:00
"sync"
"time"
)
var (
sampleStart = time.Now().Add((-24 * 7) * time.Hour).UTC()
2019-03-05 20:13:25 +00:00
SampleHits = 9900.
)
2018-12-04 05:57:11 +00:00
// InsertSampleData will create the example/dummy services for a brand new Statping installation
func InsertSampleData() error {
log.Infoln("Inserting Sample Data...")
2019-01-03 19:13:48 +00:00
insertSampleGroups()
createdOn := time.Now().Add(((-24 * 30) * 3) * time.Hour).UTC()
2020-02-25 07:41:28 +00:00
s1 := &types.Service{
Name: "Google",
Domain: "https://google.com",
ExpectedStatus: 200,
Interval: 10,
Type: "http",
Method: "GET",
Timeout: 10,
Order: 1,
2019-01-03 19:13:48 +00:00
GroupId: 1,
2019-02-06 18:51:30 +00:00
Permalink: types.NewNullString("google"),
VerifySSL: types.NewNullBool(true),
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
s2 := &types.Service{
2018-12-04 05:57:11 +00:00
Name: "Statping Github",
2018-12-04 04:17:29 +00:00
Domain: "https://github.com/hunterlong/statping",
ExpectedStatus: 200,
Interval: 30,
Type: "http",
Method: "GET",
Timeout: 20,
Order: 2,
2019-02-06 18:51:30 +00:00
Permalink: types.NewNullString("statping_github"),
VerifySSL: types.NewNullBool(true),
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
s3 := &types.Service{
Name: "JSON Users Test",
Domain: "https://jsonplaceholder.typicode.com/users",
ExpectedStatus: 200,
Interval: 60,
Type: "http",
Method: "GET",
Timeout: 30,
Order: 3,
2019-01-03 19:13:48 +00:00
Public: types.NewNullBool(true),
VerifySSL: types.NewNullBool(true),
2019-01-03 19:13:48 +00:00
GroupId: 2,
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
s4 := &types.Service{
Name: "JSON API Tester",
Domain: "https://jsonplaceholder.typicode.com/posts",
ExpectedStatus: 201,
2019-01-09 04:20:43 +00:00
Expected: types.NewNullString(`(title)": "((\\"|[statping])*)"`),
Interval: 30,
Type: "http",
Method: "POST",
2019-01-09 04:20:43 +00:00
PostData: types.NewNullString(`{ "title": "statping", "body": "bar", "userId": 19999 }`),
Timeout: 30,
Order: 4,
2019-01-03 19:13:48 +00:00
Public: types.NewNullBool(true),
VerifySSL: types.NewNullBool(true),
2019-01-03 19:13:48 +00:00
GroupId: 2,
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
s5 := &types.Service{
2019-01-29 12:02:13 +00:00
Name: "Google DNS",
Domain: "8.8.8.8",
Interval: 20,
Type: "tcp",
Port: 53,
Timeout: 120,
Order: 5,
Public: types.NewNullBool(true),
GroupId: 1,
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
2020-02-25 07:41:28 +00:00
database.Create(s1)
database.Create(s2)
database.Create(s3)
database.Create(s4)
database.Create(s5)
2018-11-07 05:18:42 +00:00
insertMessages()
2019-06-24 22:21:38 +00:00
insertSampleIncidents()
log.Infoln("Sample data has finished importing")
2018-10-07 06:39:57 +00:00
return nil
}
2019-06-24 22:21:38 +00:00
func insertSampleIncidents() error {
2020-02-25 07:41:28 +00:00
incident1 := &types.Incident{
2019-06-24 22:21:38 +00:00
Title: "Github Downtime",
Description: "This is an example of a incident for a service.",
ServiceId: 2,
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(incident1); err != nil {
return err
}
2019-06-24 22:21:38 +00:00
2020-02-25 07:41:28 +00:00
incidentUpdate1 := &types.IncidentUpdate{
2019-06-24 22:21:38 +00:00
IncidentId: incident1.Id,
Message: "Github's page for Statping seems to be sending a 501 error.",
Type: "Investigating",
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(incidentUpdate1); err != nil {
return err
}
2019-06-24 22:21:38 +00:00
2020-02-25 07:41:28 +00:00
incidentUpdate2 := &types.IncidentUpdate{
2019-06-24 22:21:38 +00:00
IncidentId: incident1.Id,
Message: "Problem is continuing and we are looking at the issues.",
Type: "Update",
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(incidentUpdate2); err != nil {
return err
}
2019-06-24 22:21:38 +00:00
2020-02-25 07:41:28 +00:00
incidentUpdate3 := &types.IncidentUpdate{
2019-06-24 22:21:38 +00:00
IncidentId: incident1.Id,
Message: "Github is now back online and everything is working.",
Type: "Resolved",
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(incidentUpdate3); err != nil {
return err
}
2019-06-24 22:21:38 +00:00
2020-02-25 07:41:28 +00:00
return nil
2019-06-24 22:21:38 +00:00
}
2018-12-31 21:36:58 +00:00
func insertSampleGroups() error {
2020-02-25 07:41:28 +00:00
group1 := &types.Group{
2019-01-03 21:09:11 +00:00
Name: "Main Services",
Public: types.NewNullBool(true),
2019-02-20 02:11:40 +00:00
Order: 2,
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(group1); err != nil {
return err
}
group2 := &types.Group{
2019-01-03 21:09:11 +00:00
Name: "Linked Services",
Public: types.NewNullBool(false),
2019-02-20 02:11:40 +00:00
Order: 1,
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(group2); err != nil {
return err
}
group3 := &types.Group{
2019-02-20 02:11:40 +00:00
Name: "Empty Group",
Public: types.NewNullBool(false),
Order: 3,
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(group3); err != nil {
return err
}
return nil
2018-12-31 21:36:58 +00:00
}
2018-10-07 22:38:56 +00:00
// insertSampleCheckins will create 2 checkins with 60 successful hits per Checkin
2018-10-07 06:39:57 +00:00
func insertSampleCheckins() error {
s1 := SelectService(1)
2020-02-25 07:41:28 +00:00
checkin1 := &types.Checkin{
2020-02-25 13:18:29 +00:00
ServiceId: s1.Model().Id,
2018-10-04 08:18:55 +00:00
Interval: 300,
GracePeriod: 300,
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(checkin1); err != nil {
return err
}
2018-10-04 08:18:55 +00:00
2018-10-07 06:39:57 +00:00
s2 := SelectService(1)
2020-02-25 07:41:28 +00:00
checkin2 := &types.Checkin{
2020-02-25 13:18:29 +00:00
ServiceId: s2.Model().Id,
2018-10-04 08:18:55 +00:00
Interval: 900,
GracePeriod: 300,
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(checkin2); err != nil {
return err
}
2018-10-04 08:18:55 +00:00
2020-01-04 02:03:59 +00:00
checkTime := time.Now().UTC().Add(-24 * time.Hour)
2018-10-04 08:18:55 +00:00
for i := 0; i <= 60; i++ {
2020-02-25 07:41:28 +00:00
checkHit := &types.CheckinHit{
2018-10-04 08:18:55 +00:00
Checkin: checkin1.Id,
From: "192.168.0.1",
CreatedAt: checkTime.UTC(),
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(checkHit); err != nil {
return err
}
2018-10-04 08:18:55 +00:00
checkTime = checkTime.Add(10 * time.Minute)
}
return nil
}
2018-09-15 05:07:17 +00:00
// InsertSampleHits will create a couple new hits for the sample services
func InsertSampleHits() error {
2020-02-19 04:07:22 +00:00
tx := Database(&Hit{}).Begin()
2020-01-04 02:03:59 +00:00
sg := new(sync.WaitGroup)
2018-09-15 05:07:17 +00:00
for i := int64(1); i <= 5; i++ {
2020-01-04 02:03:59 +00:00
sg.Add(1)
2018-09-15 05:07:17 +00:00
service := SelectService(i)
seed := time.Now().UnixNano()
2020-02-25 13:18:29 +00:00
log.Infoln(fmt.Sprintf("Adding %v sample hit records to service %v", SampleHits, service.Model().Name))
createdAt := sampleStart
p := utils.NewPerlin(2., 2., 10, seed)
2020-01-04 02:03:59 +00:00
go func() {
defer sg.Done()
for hi := 0.; hi <= float64(SampleHits); hi++ {
latency := p.Noise1D(hi / 500)
createdAt = createdAt.Add(60 * time.Second)
hit := &types.Hit{
2020-02-25 13:18:29 +00:00
Service: service.Model().Id,
2020-01-04 02:03:59 +00:00
CreatedAt: createdAt,
Latency: latency,
}
tx = tx.Create(&hit)
2018-09-15 05:07:17 +00:00
}
2020-01-04 02:03:59 +00:00
}()
2018-09-15 05:07:17 +00:00
}
2020-01-04 02:03:59 +00:00
sg.Wait()
2020-01-26 21:01:43 +00:00
err := tx.Commit().Error()
2020-01-04 02:03:59 +00:00
if err != nil {
log.Errorln(err)
}
return err
2018-09-15 05:07:17 +00:00
}
// insertSampleCore will create a new Core for the seed
2018-09-25 07:03:49 +00:00
func insertSampleCore() error {
core := &types.Core{
2018-12-04 05:57:11 +00:00
Name: "Statping Sample Data",
Description: "This data is only used to testing",
ApiKey: "sample",
ApiSecret: "samplesecret",
Domain: "http://localhost:8080",
Version: "test",
2020-01-04 02:03:59 +00:00
CreatedAt: time.Now().UTC(),
UseCdn: types.NewNullBool(false),
}
2020-02-25 07:41:28 +00:00
_, err := database.Create(core)
return err
}
// insertSampleUsers will create 2 admin users for a seed database
2018-11-25 10:18:21 +00:00
func insertSampleUsers() error {
2020-02-25 07:41:28 +00:00
u2 := &types.User{
Username: "testadmin",
Password: "password123",
Email: "info@betatude.com",
Admin: types.NewNullBool(true),
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(u2); err != nil {
return err
}
2020-02-25 07:41:28 +00:00
u3 := &types.User{
Username: "testadmin2",
Password: "password123",
Email: "info@adminhere.com",
Admin: types.NewNullBool(true),
2020-02-25 07:41:28 +00:00
}
2020-02-25 07:41:28 +00:00
if _, err := database.Create(u3); err != nil {
return err
}
return nil
}
2018-11-25 10:18:21 +00:00
func insertMessages() error {
2020-02-25 07:41:28 +00:00
m1 := &types.Message{
2018-11-07 05:18:42 +00:00
Title: "Routine Downtime",
Description: "This is an example a upcoming message for a service!",
ServiceId: 1,
2020-01-04 02:03:59 +00:00
StartOn: time.Now().UTC().Add(15 * time.Minute),
EndOn: time.Now().UTC().Add(2 * time.Hour),
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(m1); err != nil {
2018-11-25 10:18:21 +00:00
return err
}
2020-02-25 07:41:28 +00:00
m2 := &types.Message{
2018-11-07 05:18:42 +00:00
Title: "Server Reboot",
Description: "This is another example a upcoming message for a service!",
ServiceId: 3,
2020-02-04 03:49:17 +00:00
StartOn: time.Now().UTC().Add(15 * time.Minute),
EndOn: time.Now().UTC().Add(2 * time.Hour),
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(m2); err != nil {
2018-11-25 10:18:21 +00:00
return err
}
return nil
2018-11-07 05:18:42 +00:00
}
2018-12-04 05:57:11 +00:00
// InsertLargeSampleData will create the example/dummy services for testing the Statping server
func InsertLargeSampleData() error {
2018-11-25 10:18:21 +00:00
if err := insertSampleCore(); err != nil {
return err
}
if err := InsertSampleData(); err != nil {
return err
}
if err := insertSampleUsers(); err != nil {
return err
}
if err := insertSampleCheckins(); err != nil {
return err
}
if err := insertMessages(); err != nil {
return err
}
2020-01-04 02:03:59 +00:00
createdOn := time.Now().UTC().Add((-24 * 90) * time.Hour)
2020-02-25 07:41:28 +00:00
s6 := &types.Service{
Name: "JSON Lint",
Domain: "https://jsonlint.com",
ExpectedStatus: 200,
Interval: 15,
Type: "http",
Method: "GET",
Timeout: 10,
Order: 6,
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(s6); err != nil {
return err
}
2020-02-25 07:41:28 +00:00
s7 := &types.Service{
Name: "Demo Page",
2018-12-04 05:57:11 +00:00
Domain: "https://demo.statping.com",
ExpectedStatus: 200,
Interval: 30,
Type: "http",
Method: "GET",
Timeout: 15,
Order: 7,
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
2020-02-25 07:41:28 +00:00
if _, err := database.Create(s7); err != nil {
return err
}
s8 := &types.Service{
Name: "Golang",
Domain: "https://golang.org",
ExpectedStatus: 200,
Interval: 15,
Type: "http",
Method: "GET",
Timeout: 10,
Order: 8,
2020-02-25 07:41:28 +00:00
}
2020-02-25 07:41:28 +00:00
if _, err := database.Create(s8); err != nil {
return err
}
s9 := &types.Service{
Name: "Santa Monica",
Domain: "https://www.santamonica.com",
ExpectedStatus: 200,
Interval: 15,
Type: "http",
Method: "GET",
Timeout: 10,
Order: 9,
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
2020-02-25 07:41:28 +00:00
if _, err := database.Create(s9); err != nil {
return err
}
s10 := &types.Service{
Name: "Oeschs Die Dritten",
Domain: "https://www.oeschs-die-dritten.ch/en/",
ExpectedStatus: 200,
Interval: 15,
Type: "http",
Method: "GET",
Timeout: 10,
Order: 10,
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
2020-02-25 07:41:28 +00:00
if _, err := database.Create(s10); err != nil {
return err
}
s11 := &types.Service{
Name: "XS Project - Bochka, Bass, Kolbaser",
Domain: "https://www.youtube.com/watch?v=VLW1ieY4Izw",
ExpectedStatus: 200,
Interval: 60,
Type: "http",
Method: "GET",
Timeout: 20,
Order: 11,
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
2020-02-25 07:41:28 +00:00
if _, err := database.Create(s11); err != nil {
return err
}
s12 := &types.Service{
Name: "Github",
Domain: "https://github.com/hunterlong",
ExpectedStatus: 200,
Interval: 60,
Type: "http",
Method: "GET",
Timeout: 20,
Order: 12,
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(s12); err != nil {
return err
}
2020-02-25 07:41:28 +00:00
s13 := &types.Service{
Name: "Failing URL",
Domain: "http://thisdomainisfakeanditsgoingtofail.com",
ExpectedStatus: 200,
Interval: 45,
Type: "http",
Method: "GET",
Timeout: 10,
Order: 13,
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(s13); err != nil {
return err
}
2020-02-25 07:41:28 +00:00
s14 := &types.Service{
Name: "Oesch's die Dritten - Die Jodelsprache",
Domain: "https://www.youtube.com/watch?v=k3GTxRt4iao",
ExpectedStatus: 200,
Interval: 60,
Type: "http",
Method: "GET",
Timeout: 12,
Order: 14,
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(s14); err != nil {
return err
}
2020-02-25 07:41:28 +00:00
s15 := &types.Service{
Name: "Gorm",
Domain: "http://gorm.io/",
ExpectedStatus: 200,
Interval: 30,
Type: "http",
Method: "GET",
Timeout: 12,
Order: 15,
2019-01-29 12:02:13 +00:00
CreatedAt: createdOn,
2020-02-25 07:41:28 +00:00
}
if _, err := database.Create(s15); err != nil {
return err
}
2020-01-04 02:03:59 +00:00
var dayAgo = time.Now().UTC().Add((-24 * 90) * time.Hour)
insertHitRecords(dayAgo, 5450)
insertFailureRecords(dayAgo, 730)
return nil
}
// insertFailureRecords will create failures for 15 services from seed
2020-01-26 21:01:43 +00:00
func insertFailureRecords(since time.Time, amount int) {
for i := int64(14); i <= 15; i++ {
service := SelectService(i)
2020-02-25 13:18:29 +00:00
log.Infoln(fmt.Sprintf("Adding %v Failure records to service %v", amount, service.Model().Name))
createdAt := since
2020-01-26 21:01:43 +00:00
for fi := 1; fi <= amount; fi++ {
createdAt = createdAt.Add(2 * time.Minute)
failure := &types.Failure{
2020-02-25 13:18:29 +00:00
Service: service.Model().Id,
Issue: "testing right here",
CreatedAt: createdAt,
}
2020-02-25 07:41:28 +00:00
database.Create(failure)
}
}
}
// insertHitRecords will create successful Hit records for 15 services
2020-01-26 21:01:43 +00:00
func insertHitRecords(since time.Time, amount int) {
for i := int64(1); i <= 15; i++ {
service := SelectService(i)
2020-02-25 13:18:29 +00:00
log.Infoln(fmt.Sprintf("Adding %v hit records to service %v", amount, service.Model().Name))
createdAt := since
p := utils.NewPerlin(2, 2, 5, time.Now().UnixNano())
2020-01-26 21:01:43 +00:00
for hi := 1; hi <= amount; hi++ {
latency := p.Noise1D(float64(hi / 10))
createdAt = createdAt.Add(1 * time.Minute)
hit := &types.Hit{
2020-02-25 13:18:29 +00:00
Service: service.Model().Id,
2020-01-04 02:03:59 +00:00
CreatedAt: createdAt.UTC(),
Latency: latency,
}
2020-02-25 07:41:28 +00:00
database.Create(hit)
}
}
}
2019-12-30 00:40:20 +00:00
// TmpRecords is used for testing Statping. It will create a SQLite database file
// with sample data and store it in the /tmp folder to be used by the tests.
2019-12-30 01:40:21 +00:00
func TmpRecords(dbFile string) error {
var sqlFile = utils.Directory + "/" + dbFile
utils.CreateDirectory(utils.Directory + "/tmp")
var tmpSqlFile = utils.Directory + "/tmp/" + types.SqliteFilename
2019-12-30 00:40:20 +00:00
SampleHits = 480
2019-12-30 01:40:21 +00:00
var err error
CoreApp = NewCore()
CoreApp.Name = "Tester"
2020-02-19 04:07:22 +00:00
CoreApp.Setup = true
2019-12-30 08:08:51 +00:00
configs := &types.DbConfig{
2019-12-30 01:40:21 +00:00
DbConn: "sqlite",
Project: "Tester",
Location: utils.Directory,
SqlFile: sqlFile,
}
log.Infoln("saving config.yml in: " + utils.Directory)
2019-12-30 08:08:51 +00:00
if configs, err = CoreApp.SaveConfig(configs); err != nil {
2019-12-30 01:40:21 +00:00
return err
}
log.Infoln("loading config.yml from: " + utils.Directory)
2019-12-30 08:08:51 +00:00
if configs, err = LoadConfigFile(utils.Directory); err != nil {
2019-12-30 01:40:21 +00:00
return err
}
log.Infoln("connecting to database")
2019-12-30 00:40:20 +00:00
exists := utils.FileExists(tmpSqlFile)
if exists {
log.Infoln(tmpSqlFile + " was found, copying the temp database to " + sqlFile)
if err := utils.DeleteFile(sqlFile); err != nil {
log.Infoln(sqlFile + " was not found")
}
if err := utils.CopyFile(tmpSqlFile, sqlFile); err != nil {
return err
}
log.Infoln("loading config.yml from: " + utils.Directory)
2019-12-30 01:40:21 +00:00
2019-12-30 08:08:51 +00:00
if err := CoreApp.Connect(false, utils.Directory); err != nil {
2019-12-30 00:40:20 +00:00
return err
}
log.Infoln("selecting the Core variable")
if _, err := SelectCore(); err != nil {
return err
}
log.Infoln("inserting notifiers into database")
if err := InsertNotifierDB(); err != nil {
return err
}
2020-02-01 03:53:00 +00:00
log.Infoln("inserting integrations into database")
if err := InsertIntegratorDB(); err != nil {
return err
}
2019-12-30 00:40:20 +00:00
log.Infoln("loading all services")
2020-02-25 07:41:28 +00:00
if _, err := SelectAllServices(false); err != nil {
2019-12-30 00:40:20 +00:00
return err
}
if err := AttachNotifiers(); err != nil {
return err
}
2020-02-01 03:53:00 +00:00
if err := AddIntegrations(); err != nil {
return err
}
2019-12-30 00:40:20 +00:00
CoreApp.Notifications = notifier.AllCommunications
return nil
}
log.Infoln(tmpSqlFile + " not found, creating a new database...")
2019-12-30 08:08:51 +00:00
if err := CoreApp.Connect(false, utils.Directory); err != nil {
2019-12-30 00:40:20 +00:00
return err
}
log.Infoln("creating database")
2019-12-30 08:08:51 +00:00
if err := CoreApp.CreateDatabase(); err != nil {
2019-12-30 00:40:20 +00:00
return err
}
log.Infoln("migrating database")
2019-12-30 08:08:51 +00:00
if err := CoreApp.MigrateDatabase(); err != nil {
2019-12-30 00:40:20 +00:00
return err
}
log.Infoln("insert large sample data into database")
if err := InsertLargeSampleData(); err != nil {
return err
}
log.Infoln("selecting the Core variable")
if CoreApp, err = SelectCore(); err != nil {
return err
}
log.Infoln("inserting notifiers into database")
if err := InsertNotifierDB(); err != nil {
return err
}
2020-02-01 03:53:00 +00:00
log.Infoln("inserting integrations into database")
if err := InsertIntegratorDB(); err != nil {
return err
}
2019-12-30 00:40:20 +00:00
log.Infoln("loading all services")
2020-02-25 07:41:28 +00:00
if _, err := SelectAllServices(false); err != nil {
2019-12-30 00:40:20 +00:00
return err
}
2019-12-30 01:52:35 +00:00
log.Infoln("copying sql database file to: " + tmpSqlFile)
if err := utils.CopyFile(sqlFile, tmpSqlFile); err != nil {
2019-12-30 00:40:20 +00:00
return err
}
return err
}