From de6cf2407f4b88245828a885e88d9820c2fc792b Mon Sep 17 00:00:00 2001 From: hunterlong Date: Tue, 10 Mar 2020 01:49:57 -0700 Subject: [PATCH] building --- Dockerfile | 6 +- Dockerfile.base | 39 ++++----- database/routines.go | 4 +- frontend/src/assets/scss/base.scss | 24 ++++-- frontend/src/assets/scss/mobile.scss | 8 +- frontend/src/components/Index/Group.vue | 2 +- .../src/components/Service/ServiceBlock.vue | 2 +- .../src/components/Service/ServiceChart.vue | 29 ++++--- .../src/components/Service/ServiceInfo.vue | 80 ++++++++++++++----- .../components/Service/ServiceSparkLine.vue | 37 +++++++-- frontend/src/components/Service/StatsGen.vue | 70 ++++++++++++++++ frontend/src/forms/Login.vue | 2 +- frontend/src/pages/Index.vue | 2 +- types/core/database.go | 11 ++- types/failures/samples.go | 14 ++++ types/services/database.go | 1 + 16 files changed, 251 insertions(+), 80 deletions(-) create mode 100644 frontend/src/components/Service/StatsGen.vue diff --git a/Dockerfile b/Dockerfile index 91fc2b73..b0fdd05d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,10 @@ RUN npm install yarn -g WORKDIR /statping COPY ./frontend/package.json . COPY ./frontend/yarn.lock . -RUN yarn install +RUN yarn install --pure-lockfile --network-timeout 1000000 COPY ./frontend . -RUN yarn build && rm -rf node_modules - +RUN yarn build && rm -rf node_modules && yarn cache clean +# Compiles webpacked Vue production build for frontend at /statping/dist # Statping Golang BACKEND building from source # Creates "/go/bin/statping" and "/usr/local/bin/sass" for copying diff --git a/Dockerfile.base b/Dockerfile.base index 48c96cfc..5d4974c6 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -1,36 +1,31 @@ -FROM golang:1.14-alpine +FROM node:10.17.0 AS frontend +RUN npm install yarn -g +WORKDIR /statping +COPY ./frontend/package.json . +COPY ./frontend/yarn.lock . +RUN yarn install --pure-lockfile --network-timeout 1000000 +COPY ./frontend . +RUN yarn build && rm -rf node_modules && yarn cache clean + + +# Statping Golang BACKEND building from source +# Creates "/go/bin/statping" and "/usr/local/bin/sass" for copying +FROM golang:1.14-alpine AS backend LABEL maintainer="Hunter Long (https://github.com/hunterlong)" ARG VERSION -RUN apk add --update --no-cache libstdc++ gcc g++ make git ca-certificates linux-headers wget curl jq libsass nodejs nodejs-npm -RUN npm install -g yarn - +RUN apk add --update --no-cache libstdc++ gcc g++ make git ca-certificates linux-headers wget curl jq RUN curl -L -s https://assets.statping.com/sass -o /usr/local/bin/sass && \ chmod +x /usr/local/bin/sass - WORKDIR /go/src/github.com/statping/statping - ADD go.mod go.sum ./ - RUN go mod download - ENV GO111MODULE on - RUN go get github.com/stretchr/testify/assert && \ go get github.com/stretchr/testify/require && \ go get github.com/GeertJohan/go.rice/rice && \ go get github.com/cortesi/modd/cmd/modd && \ go get github.com/crazy-max/xgo - -ADD frontend/package.json frontend/yarn.lock ./frontend/ - -RUN cd frontend && yarn install --pure-lockfile --network-timeout 1000000 && \ - yarn cache clean - -COPY . ./ - -RUN make clean -RUN make compile -RUN make build +COPY . . +COPY --from=frontend /statping/dist/ ./source/dist/ +RUN make clean generate embed build RUN chmod a+x statping && mv statping /go/bin/statping - -WORKDIR /app diff --git a/database/routines.go b/database/routines.go index 872c41cb..0dc30e7c 100644 --- a/database/routines.go +++ b/database/routines.go @@ -58,8 +58,8 @@ func databaseMaintence(dur time.Duration) { // DeleteAllSince will delete a specific table's records based on a time. func DeleteAllSince(table string, date time.Time) { - sql := fmt.Sprintf("DELETE FROM %v WHERE created_at < '%v';", table, database.FormatTime(date)) - q := database.Exec(sql) + sql := fmt.Sprintf("DELETE FROM %s WHERE created_at < '%s';", table, database.FormatTime(date)) + q := database.Exec(sql).Debug() if q.Error() != nil { log.Warnln(q.Error()) } diff --git a/frontend/src/assets/scss/base.scss b/frontend/src/assets/scss/base.scss index 8ad831fc..54372307 100644 --- a/frontend/src/assets/scss/base.scss +++ b/frontend/src/assets/scss/base.scss @@ -5,14 +5,18 @@ HTML,BODY { background-color: $background-color; } +.index-chart { + height: 35vh; +} .chartmarker { - background-color: white; padding: 5px; + width: 240px; + text-align: right; } .chartmarker SPAN { - font-size: 11pt; + font-size: 9pt; display: block; color: #8b8b8b; } @@ -153,9 +157,17 @@ HTML,BODY { font-size: 9pt; } - .font-3 { - font-size: 11pt; - } +.font-3 { + font-size: 11pt; +} + +.font-4 { + font-size: 14pt; +} + +.font-5 { + font-size: 20pt; +} .badge { color: white; @@ -222,7 +234,7 @@ HTML,BODY { .chart-container { position: relative; - height: 24.1vh; + height: 18.6vh; width: 100%; overflow: hidden; } diff --git a/frontend/src/assets/scss/mobile.scss b/frontend/src/assets/scss/mobile.scss index a7e33821..9c7587b4 100644 --- a/frontend/src/assets/scss/mobile.scss +++ b/frontend/src/assets/scss/mobile.scss @@ -6,8 +6,8 @@ background-color: $sm-background-color; } - .index_container { - padding-top: 4.5vh !important; + .index-chart { + height: 33vh; } .sm-container { @@ -60,7 +60,7 @@ .btn-sm { line-height: 1.4rem; - font-size: 1rem; + font-size: 0.83rem; } .full-col-12 { @@ -73,6 +73,8 @@ border-radius: $sm-border-radius; padding: $sm-padding; background-color: $sm-service-background; + box-shadow: 0px 3px 10px 2px; + color: #b5b5b5; } .card-body { diff --git a/frontend/src/components/Index/Group.vue b/frontend/src/components/Index/Group.vue index 4d0ea786..50bfbdd6 100644 --- a/frontend/src/components/Index/Group.vue +++ b/frontend/src/components/Index/Group.vue @@ -1,6 +1,6 @@