diff --git a/.gitignore b/.gitignore index 6ca9f5fb..269b064f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ rice-box.go config.yml statup.db -plugins/*.so \ No newline at end of file +plugins/*.so +data \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b4af1429..2a8238a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,17 @@ -FROM alpine +FROM golang:alpine -#RUN apk add --no-cache libc6-compat +RUN apk update && apk add git g++ -ENV VERSION="v0.14" -RUN wget -q https://github.com/hunterlong/statup/releases/download/$VERSION/statup-linux-static -RUN chmod +x statup-linux-static && mv statup-linux-static /usr/local/bin/statup +WORKDIR $GOPATH/src/github.com/hunterlong/statup/ + +COPY . $GOPATH/src/github.com/hunterlong/statup/ +RUN go get github.com/GeertJohan/go.rice/rice +RUN go get -d -v +RUN rice embed-go +RUN go install +WORKDIR /app +VOLUME /app EXPOSE 8080 -VOLUME /app - ENTRYPOINT statup \ No newline at end of file diff --git a/core.go b/core.go index 82bed73b..2501c966 100644 --- a/core.go +++ b/core.go @@ -17,6 +17,13 @@ type Core struct { PluginFields []PluginSelect } +func (c *Core) Update() (*Core, error) { + res := dbSession.Collection("core").Find().Limit(1) + res.Update(c) + core = c + return c, nil +} + func SelectCore() (*Core, error) { var core Core err := dbSession.Collection("core").Find().One(&core) diff --git a/failures.go b/failures.go index 7df32f61..77979561 100644 --- a/failures.go +++ b/failures.go @@ -34,6 +34,13 @@ func (s *Service) SelectAllFailures() ([]*Failure, error) { return fails, err } +func (s *Service) LimitedFailures() ([]*Failure, error) { + var fails []*Failure + col := dbSession.Collection("failures").Find("session", s.Id).Limit(10) + err := col.All(&fails) + return fails, err +} + func CountFailures() (uint64, error) { col := dbSession.Collection("failures").Find() amount, err := col.Count() diff --git a/html/tmpl/plugins.html b/html/tmpl/plugins.html index bd66087a..5753e2fd 100644 --- a/html/tmpl/plugins.html +++ b/html/tmpl/plugins.html @@ -33,6 +33,23 @@