mirror of https://github.com/statping/statping
upgrades
parent
20ca133eb5
commit
13f584e20b
|
@ -17,7 +17,8 @@ services:
|
|||
- mongodb
|
||||
|
||||
env:
|
||||
- VERSION=0.18
|
||||
global:
|
||||
- VERSION=0.18
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
|
|
14
build.sh
14
build.sh
|
@ -1,17 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
mkdir build
|
||||
|
||||
APP="statup"
|
||||
|
||||
printf "\nUPDATE core SET version='$VERSION';" >> sql/upgrade.sql
|
||||
|
||||
rice embed-go
|
||||
|
||||
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
|
||||
docker build -f Dockerfile -t hunterlong/statup:$VERSION .
|
||||
docker tag hunterlong/statup:$VERSION hunterlong/statup:latest
|
||||
docker tag hunterlong/statup:$VERSION hunterlong/statup:$VERSION
|
||||
docker push hunterlong/statup
|
||||
|
||||
mkdir build
|
||||
xgo -go 1.10.x --targets=darwin/amd64 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
|
||||
xgo -go 1.10.x --targets=darwin/386 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
|
||||
|
||||
xgo -go 1.10.x --targets=linux/amd64 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
|
||||
xgo -go 1.10.x --targets=linux/386 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
|
||||
|
||||
xgo -go 1.10.x --targets=windows/amd64 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
|
||||
|
||||
cd build
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/hunterlong/statup/types"
|
||||
"time"
|
||||
)
|
||||
|
||||
func LoadDefaultCommunications() {
|
||||
emailer := SelectCommunication(1)
|
||||
fmt.Println(emailer)
|
||||
LoadMailer(emailer)
|
||||
go EmailerQueue()
|
||||
if emailer.Enabled {
|
||||
LoadMailer(emailer)
|
||||
go EmailerQueue()
|
||||
}
|
||||
}
|
||||
|
||||
func LoadComms() {
|
||||
|
|
1
main.go
1
main.go
|
@ -147,6 +147,7 @@ func mainProcess() {
|
|||
if err != nil {
|
||||
throw(err)
|
||||
}
|
||||
RunDatabaseUpgrades()
|
||||
core, err = SelectCore()
|
||||
if err != nil {
|
||||
fmt.Println("Core database was not found, Statup is not setup yet.")
|
||||
|
|
14
setup.go
14
setup.go
|
@ -10,6 +10,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"upper.io/db.v3"
|
||||
)
|
||||
|
||||
type DbConfig struct {
|
||||
|
@ -28,6 +29,19 @@ type DbConfig struct {
|
|||
Error error `yaml:"-"`
|
||||
}
|
||||
|
||||
func RunDatabaseUpgrades() {
|
||||
fmt.Println("Upgrading Tables...")
|
||||
upgrade, _ := sqlBox.String("upgrade.sql")
|
||||
requests := strings.Split(upgrade, ";")
|
||||
for _, request := range requests {
|
||||
_, err := dbSession.Exec(db.Raw(request + ";"))
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
fmt.Println("Database Upgraded")
|
||||
}
|
||||
|
||||
func ProcessSetupHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if core != nil {
|
||||
http.Redirect(w, r, "/", http.StatusSeeOther)
|
||||
|
|
Loading…
Reference in New Issue