mirror of https://github.com/statping/statping
v2 b
parent
81bcdb2f98
commit
ae95aa1745
|
@ -18,7 +18,7 @@ services:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- VERSION=0.27.81
|
- VERSION=0.27.82
|
||||||
- DB_HOST=localhost
|
- DB_HOST=localhost
|
||||||
- DB_USER=travis
|
- DB_USER=travis
|
||||||
- DB_PASS=
|
- DB_PASS=
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
ENV VERSION=v0.27.81
|
ENV VERSION=v0.27.82
|
||||||
|
|
||||||
RUN apk --no-cache add libstdc++ ca-certificates
|
RUN apk --no-cache add libstdc++ ca-certificates
|
||||||
RUN wget -q https://github.com/hunterlong/statup/releases/download/$VERSION/statup-linux-alpine.tar.gz && \
|
RUN wget -q https://github.com/hunterlong/statup/releases/download/$VERSION/statup-linux-alpine.tar.gz && \
|
||||||
|
|
|
@ -98,7 +98,10 @@ func CreateAllAssets() {
|
||||||
CopyToPublic(JsBox, "js", "setup.js")
|
CopyToPublic(JsBox, "js", "setup.js")
|
||||||
utils.Log(1, "Compiling CSS from SCSS style...")
|
utils.Log(1, "Compiling CSS from SCSS style...")
|
||||||
err := CompileSASS()
|
err := CompileSASS()
|
||||||
if err == nil {
|
if err != nil {
|
||||||
utils.Log(1, "Statup assets have been inserted")
|
CopyToPublic(CssBox, "css", "base.css")
|
||||||
|
utils.Log(2, "Default 'base.css' was insert because SASS did not work.")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
utils.Log(1, "Statup assets have been inserted")
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hunterlong/statup/core"
|
"github.com/hunterlong/statup/core"
|
||||||
|
"github.com/hunterlong/statup/utils"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,3 +16,13 @@ Host: ` + core.CoreApp.Domain)
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(robots))
|
w.Write([]byte(robots))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FavIconHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
data, err := core.TmplBox.String("favicon.ico")
|
||||||
|
if err != nil {
|
||||||
|
utils.Log(2, err)
|
||||||
|
}
|
||||||
|
w.Header().Set("Content-Type", "image/x-icon")
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
w.Write([]byte(data))
|
||||||
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ func Router() *mux.Router {
|
||||||
r.PathPrefix("/js/").Handler(http.StripPrefix("/js/", http.FileServer(core.JsBox.HTTPBox())))
|
r.PathPrefix("/js/").Handler(http.StripPrefix("/js/", http.FileServer(core.JsBox.HTTPBox())))
|
||||||
}
|
}
|
||||||
r.Handle("/robots.txt", http.HandlerFunc(RobotsTxtHandler)).Methods("GET")
|
r.Handle("/robots.txt", http.HandlerFunc(RobotsTxtHandler)).Methods("GET")
|
||||||
|
r.Handle("/favicon.ico", http.HandlerFunc(FavIconHandler)).Methods("GET")
|
||||||
r.Handle("/setup", http.HandlerFunc(SetupHandler)).Methods("GET")
|
r.Handle("/setup", http.HandlerFunc(SetupHandler)).Methods("GET")
|
||||||
r.Handle("/setup", http.HandlerFunc(ProcessSetupHandler)).Methods("POST")
|
r.Handle("/setup", http.HandlerFunc(ProcessSetupHandler)).Methods("POST")
|
||||||
r.Handle("/dashboard", http.HandlerFunc(DashboardHandler)).Methods("GET")
|
r.Handle("/dashboard", http.HandlerFunc(DashboardHandler)).Methods("GET")
|
||||||
|
|
|
@ -279,6 +279,7 @@ func TestServiceHandler(t *testing.T) {
|
||||||
|
|
||||||
func TestPrometheusHandler(t *testing.T) {
|
func TestPrometheusHandler(t *testing.T) {
|
||||||
req, err := http.NewRequest("GET", "/metrics", nil)
|
req, err := http.NewRequest("GET", "/metrics", nil)
|
||||||
|
req.Header.Set("Authorization", core.CoreApp.ApiSecret)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
rr := httptest.NewRecorder()
|
rr := httptest.NewRecorder()
|
||||||
route.ServeHTTP(rr, req)
|
route.ServeHTTP(rr, req)
|
||||||
|
@ -286,6 +287,14 @@ func TestPrometheusHandler(t *testing.T) {
|
||||||
assert.True(t, strings.Contains(rr.Body.String(), "statup_total_services 6"))
|
assert.True(t, strings.Contains(rr.Body.String(), "statup_total_services 6"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestFailingPrometheusHandler(t *testing.T) {
|
||||||
|
req, err := http.NewRequest("GET", "/metrics", nil)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
rr := httptest.NewRecorder()
|
||||||
|
route.ServeHTTP(rr, req)
|
||||||
|
assert.Equal(t, 55, rr.Result().StatusCode)
|
||||||
|
}
|
||||||
|
|
||||||
func TestLoginHandler(t *testing.T) {
|
func TestLoginHandler(t *testing.T) {
|
||||||
form := url.Values{}
|
form := url.Values{}
|
||||||
form.Add("username", "admin")
|
form.Add("username", "admin")
|
||||||
|
|
|
@ -11,6 +11,14 @@ HTML,BODY {
|
||||||
max-width: $max-width;
|
max-width: $max-width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
H1 {
|
||||||
|
color: $title-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
H5 {
|
||||||
|
color: $description-color;
|
||||||
|
}
|
||||||
|
|
||||||
.online_list .badge {
|
.online_list .badge {
|
||||||
margin-top: 0.2rem;
|
margin-top: 0.2rem;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +75,7 @@ HTML,BODY {
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer A {
|
.footer A {
|
||||||
color: #aaaaaa;
|
color: $footer-text-color;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +103,8 @@ HTML,BODY {
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
background-color: $card-background;
|
background-color: $service-background;
|
||||||
|
border: $service-border;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-body {
|
.card-body {
|
||||||
|
@ -103,7 +112,7 @@ HTML,BODY {
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-body H4 A {
|
.card-body H4 A {
|
||||||
color: #239e07;
|
color: $service-title;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,6 +128,15 @@ HTML,BODY {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.btn-success {
|
||||||
|
background-color: $success-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger {
|
||||||
|
background-color: $danger-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.CodeMirror {
|
.CodeMirror {
|
||||||
/* Bootstrap Settings */
|
/* Bootstrap Settings */
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -198,6 +216,7 @@ HTML,BODY {
|
||||||
.lower_canvas SPAN {
|
.lower_canvas SPAN {
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
float: left;
|
float: left;
|
||||||
|
color: $service-description-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-sm {
|
.btn-sm {
|
||||||
|
|
|
@ -1,8 +1,17 @@
|
||||||
$background-color: #fcfcfc;
|
$background-color: #fcfcfc;
|
||||||
$max-width: 860px;
|
$max-width: 860px;
|
||||||
$online-color: #47d337;
|
|
||||||
$offline-color: #dd3545;
|
|
||||||
|
|
||||||
$card-background: #fff;
|
$title-color: #000;
|
||||||
$card-stats-color: #474747;
|
$description-color: #000;
|
||||||
$card-stats-size: 26pt;
|
|
||||||
|
$service-background: #bababa;
|
||||||
|
$service-border: 1px solid rgba(0,0,0,.125);
|
||||||
|
$service-title: #bababa;
|
||||||
|
$success-color: #47d337;
|
||||||
|
$danger-color: #dd3545;
|
||||||
|
|
||||||
|
$footer-text-color: #000;
|
||||||
|
|
||||||
|
$service-stats-color: #47d337;
|
||||||
|
$service-description-color: #47d337;
|
||||||
|
$service-stats-size: 12pt;
|
|
@ -48,7 +48,7 @@
|
||||||
<h5 class="mb-1">{{.Name}}</h5>
|
<h5 class="mb-1">{{.Name}}</h5>
|
||||||
<small>{{if .Online}} <span class="badge badge-success">ONLINE</span> {{else}} <span class="badge badge-danger">OFFLINE</span> {{end}}</small>
|
<small>{{if .Online}} <span class="badge badge-success">ONLINE</span> {{else}} <span class="badge badge-danger">OFFLINE</span> {{end}}</small>
|
||||||
</div>
|
</div>
|
||||||
<p class="mb-1">Created {{.CreatedAt}}</p>
|
<p class="mb-1">{{.SmallText}}</p>
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1.0, user-scalable=0">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1.0, user-scalable=0">
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
|
||||||
{{if .Core.OfflineAssets}}
|
{{if .Core.OfflineAssets}}
|
||||||
<link rel="stylesheet" href="https://assets.statup.io/bootstrap.min.css">
|
<link rel="stylesheet" href="https://assets.statup.io/bootstrap.min.css">
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
|
Loading…
Reference in New Issue