mirror of https://github.com/statping/statping
parent
b4ee5ae514
commit
473419fefb
|
@ -0,0 +1,33 @@
|
|||
###########################
|
||||
## Database Information #
|
||||
###########################
|
||||
DB_CONNECTION=postgres
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_USER=root
|
||||
DB_PASS=password123
|
||||
DB_DATABASE=root
|
||||
|
||||
###########################
|
||||
## STATUP PAGE SETTINGS #
|
||||
###########################
|
||||
NAME=Demo
|
||||
DESCRIPTION=This is an awesome page
|
||||
DOMAIN=https://domain.com
|
||||
ADMIN_USER=admin
|
||||
ADMIN_PASS=admin
|
||||
ADMIN_EMAIL=info@admin.com
|
||||
USE_CDN=true
|
||||
|
||||
###########################
|
||||
## System Values ##
|
||||
###########################
|
||||
IS_DOCKER=true
|
||||
IS_AWS=true
|
||||
SASS=/usr/local/bin/sass
|
||||
BASH_ENV=/bin/bash
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ services:
|
|||
|
||||
env:
|
||||
global:
|
||||
- VERSION=0.27
|
||||
- VERSION=0.27.1
|
||||
- DB_HOST=localhost
|
||||
- DB_USER=travis
|
||||
- DB_PASS=
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
APP="statup"
|
||||
REPO="hunterlong/statup"
|
||||
SASS=1.7.1
|
||||
|
||||
# COMPILE BOOTSTRAP
|
||||
rm -rf bootstrap
|
||||
git clone https://github.com/twbs/bootstrap.git
|
||||
cd bootstrap
|
||||
npm install
|
||||
|
@ -16,7 +16,7 @@ cd ../
|
|||
rm -rf bootstrap
|
||||
|
||||
# RENDERING CSS
|
||||
gem install sass
|
||||
#gem install sass
|
||||
sass html/scss/base.scss html/css/base.css
|
||||
|
||||
# MIGRATION SQL FILE FOR CURRENT VERSION
|
||||
|
|
|
@ -15,6 +15,7 @@ RUN wget https://assets.statup.io/sass && \
|
|||
chmod +x sass && \
|
||||
mv sass /usr/local/bin/sass
|
||||
|
||||
ENV SASS=/usr/local/bin/sass
|
||||
ENV CMD_FILE=/usr/bin/cmd
|
||||
RUN printf "#!/usr/bin/env sh\n\$1\n" > $CMD_FILE && \
|
||||
chmod +x $CMD_FILE
|
||||
|
|
|
@ -30,9 +30,11 @@ func MakePublicFolder(folder string) {
|
|||
}
|
||||
|
||||
func CompileSASS() {
|
||||
cmdBin := os.Getenv("CMD_FILE")
|
||||
cmdBin := os.Getenv("SASS")
|
||||
shell := os.Getenv("BASH_ENV")
|
||||
fmt.Println("Compiling SASS into /css/base.css...")
|
||||
testCmd := exec.Command(cmdBin, "sass assets/scss/base.scss assets/css/base.css")
|
||||
command := fmt.Sprintf("%v %v %v", cmdBin, "assets/scss/base.scss", "assets/css/base.css")
|
||||
testCmd := exec.Command(shell, command)
|
||||
_, err := testCmd.Output()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
|
34
cli.go
34
cli.go
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/joho/godotenv"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
@ -29,6 +30,39 @@ func CatchCLI(args []string) {
|
|||
HelpEcho()
|
||||
case "update":
|
||||
fmt.Println("Sorry updating isn't available yet!")
|
||||
case "run":
|
||||
fmt.Println("Running 1 time and saving to database...")
|
||||
|
||||
var err error
|
||||
configs, err = LoadConfig()
|
||||
if err != nil {
|
||||
fmt.Println("config.yml file not found")
|
||||
os.Exit(1)
|
||||
}
|
||||
err = DbConnection(configs.Connection)
|
||||
if err != nil {
|
||||
throw(err)
|
||||
}
|
||||
core, err = SelectCore()
|
||||
if err != nil {
|
||||
fmt.Println("Core database was not found, Statup is not setup yet.")
|
||||
}
|
||||
services, _ = SelectAllServices()
|
||||
for _, s := range services {
|
||||
out := s.Check()
|
||||
fmt.Printf(" Service %v | URL: %v | Latency: %0.0fms | Online: %v\n", out.Name, out.Domain, (out.Latency * 1000), out.Online)
|
||||
}
|
||||
fmt.Println("Check is complete.")
|
||||
case "env":
|
||||
fmt.Println("Statup Environment Variables")
|
||||
envs, err := godotenv.Read(".env")
|
||||
if err != nil {
|
||||
fmt.Println("No .env file found in current directory.")
|
||||
os.Exit(1)
|
||||
}
|
||||
for k, e := range envs {
|
||||
fmt.Printf("%v=%v\n", k, e)
|
||||
}
|
||||
default:
|
||||
fmt.Println("Statup does not have the command you entered.")
|
||||
os.Exit(1)
|
||||
|
|
22
errors.go
22
errors.go
|
@ -1,22 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (f *Failure) ParseError() string {
|
||||
err := strings.Contains(f.Issue, "operation timed out")
|
||||
if err {
|
||||
return fmt.Sprintf("HTTP Request Timed Out")
|
||||
}
|
||||
err = strings.Contains(f.Issue, "x509: certificate is valid")
|
||||
if err {
|
||||
return fmt.Sprintf("SSL Certificate invalid")
|
||||
}
|
||||
err = strings.Contains(f.Issue, "no such host")
|
||||
if err {
|
||||
return fmt.Sprintf("Domain is offline or not found")
|
||||
}
|
||||
return f.Issue
|
||||
}
|
|
@ -1,235 +1,221 @@
|
|||
/*
|
||||
Main Design
|
||||
=================
|
||||
- Background
|
||||
- Boxes
|
||||
- Font Colors
|
||||
- div widths
|
||||
*/
|
||||
/*
|
||||
Card Design
|
||||
================
|
||||
*/
|
||||
HTML, BODY {
|
||||
background-color: #fcfcfc;
|
||||
background-color: #fcfcfc;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
max-width: 860px;
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
max-width: 860px;
|
||||
}
|
||||
|
||||
.online_list .badge {
|
||||
margin-top: 0.2rem;
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
margin-bottom: 30px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.btn-sm {
|
||||
line-height: 1.3;
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.3;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.view_service_btn {
|
||||
position: absolute;
|
||||
bottom: -40px;
|
||||
right: 40px;
|
||||
position: absolute;
|
||||
bottom: -40px;
|
||||
right: 40px;
|
||||
}
|
||||
|
||||
.service_lower_info {
|
||||
position: absolute;
|
||||
bottom: -40px;
|
||||
left: 40px;
|
||||
color: #d1ffca;
|
||||
font-size: 0.85rem;
|
||||
position: absolute;
|
||||
bottom: -40px;
|
||||
left: 40px;
|
||||
color: #d1ffca;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.lg_number {
|
||||
font-size: 26pt;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
color: #474747;
|
||||
font-size: 26pt;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
color: #474747;
|
||||
}
|
||||
|
||||
.stats_area {
|
||||
text-align: center;
|
||||
color: #a5a5a5;
|
||||
text-align: center;
|
||||
color: #a5a5a5;
|
||||
}
|
||||
|
||||
.lower_canvas {
|
||||
height: 55px;
|
||||
width: 100%;
|
||||
background-color: #48d338;
|
||||
padding: 17px 10px;
|
||||
height: 55px;
|
||||
width: 100%;
|
||||
background-color: #48d338;
|
||||
padding: 17px 10px;
|
||||
}
|
||||
|
||||
.lower_canvas SPAN {
|
||||
font-size: 1rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-decoration: none;
|
||||
margin-top: 20px;
|
||||
text-decoration: none;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.footer A {
|
||||
color: #aaaaaa;
|
||||
text-decoration: none;
|
||||
color: #aaaaaa;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.footer A:HOVER {
|
||||
color: #6d6d6d;
|
||||
color: #6d6d6d;
|
||||
}
|
||||
|
||||
.online_badge {
|
||||
color: #fff;
|
||||
background-color: #35b317;
|
||||
color: #fff;
|
||||
background-color: #35b317;
|
||||
}
|
||||
|
||||
.offline_badge {
|
||||
color: #fff;
|
||||
background-color: #c51919;
|
||||
color: #fff;
|
||||
background-color: #c51919;
|
||||
}
|
||||
|
||||
.progress {
|
||||
margin-top: -20px;
|
||||
margin-left: -20px;
|
||||
margin-bottom: 15px;
|
||||
width: calc(100% + 40px);
|
||||
height: 3px;
|
||||
border-radius: 0;
|
||||
margin-top: -20px;
|
||||
margin-left: -20px;
|
||||
margin-bottom: 15px;
|
||||
width: calc(100% + 40px);
|
||||
height: 3px;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: #fff;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.card-body {
|
||||
overflow: hidden;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.card-body H4 A {
|
||||
color: #239e07;
|
||||
text-decoration: none;
|
||||
color: #239e07;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.chart-container {
|
||||
position: relative;
|
||||
height: 170px;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
height: 170px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.CodeMirror {
|
||||
/* Bootstrap Settings */
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
font: inherit;
|
||||
overflow: auto;
|
||||
font-family: inherit;
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
color: #555;
|
||||
background-color: #fff;
|
||||
background-image: none;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
||||
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
|
||||
/* Code Mirror Settings */
|
||||
font-family: monospace;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
height: 60vh;
|
||||
/* Bootstrap Settings */
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
font: inherit;
|
||||
overflow: auto;
|
||||
font-family: inherit;
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
color: #555;
|
||||
background-color: #fff;
|
||||
background-image: none;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
||||
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
|
||||
/* Code Mirror Settings */
|
||||
font-family: monospace;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
height: 60vh;
|
||||
}
|
||||
|
||||
.CodeMirror-focused {
|
||||
/* Bootstrap Settings */
|
||||
border-color: #66afe9;
|
||||
outline: 0;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
||||
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
|
||||
/* Bootstrap Settings */
|
||||
border-color: #66afe9;
|
||||
outline: 0;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
||||
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.sm-container {
|
||||
margin-top: 40px !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
.sm-container {
|
||||
margin-top: 40px !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.list-group-item H5 {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.list-group-item H5 {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 0 !important;
|
||||
}
|
||||
.container {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
margin-left: 0px;
|
||||
margin-top: 0px;
|
||||
width: 100%;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.navbar {
|
||||
margin-left: 0px;
|
||||
margin-top: 0px;
|
||||
width: 100%;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.card-body {
|
||||
font-size: 6pt;
|
||||
padding: 5px 5px;
|
||||
}
|
||||
.card-body {
|
||||
font-size: 6pt;
|
||||
padding: 5px 5px;
|
||||
}
|
||||
|
||||
.lg_number {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
.lg_number {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.stats_area {
|
||||
margin-top: 35px !important;
|
||||
margin-bottom: 35px !important;
|
||||
}
|
||||
.stats_area {
|
||||
margin-top: 35px !important;
|
||||
margin-bottom: 35px !important;
|
||||
}
|
||||
|
||||
.stats_area .col-4 {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
.stats_area .col-4 {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.lower_canvas SPAN {
|
||||
font-size: 0.9rem;
|
||||
float: left;
|
||||
}
|
||||
.lower_canvas SPAN {
|
||||
font-size: 0.9rem;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.btn-sm {
|
||||
line-height: 0.9rem;
|
||||
font-size: 0.65rem;
|
||||
}
|
||||
.btn-sm {
|
||||
line-height: 0.9rem;
|
||||
font-size: 0.65rem;
|
||||
}
|
||||
|
||||
.full-col-12 {
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
.full-col-12 {
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
.card {
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.card {
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.list-group-item {
|
||||
border-top: 1px solid #e4e4e4;
|
||||
border: 0px;
|
||||
}
|
||||
.list-group-item {
|
||||
border-top: 1px solid #e4e4e4;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.list-group-item:first-child {
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
.list-group-item:first-child {
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
|
||||
.list-group-item:last-child {
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=base.css.map */
|
||||
.list-group-item:last-child {
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
@import 'variables';
|
||||
@import '_variables';
|
||||
|
||||
|
||||
HTML,BODY {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
Main Design
|
||||
=================
|
||||
- Background
|
||||
- Boxes
|
||||
- Font Colors
|
||||
- div widths
|
||||
*/
|
||||
|
||||
|
||||
$background-color: #fcfcfc;
|
||||
$max-width: 860px;
|
||||
$online-color: #47d337;
|
||||
$offline-color: #dd3545;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Card Design
|
||||
================
|
||||
*/
|
||||
|
||||
|
||||
$card-background: #fff;
|
||||
$card-stats-color: #474747;
|
||||
$card-stats-size: 26pt;
|
||||
|
||||
|
8
main.go
8
main.go
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/go-yaml/yaml"
|
||||
"github.com/gorilla/sessions"
|
||||
"github.com/hunterlong/statup/plugin"
|
||||
"github.com/joho/godotenv"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
@ -92,6 +93,13 @@ func DownloadFile(filepath string, url string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
fmt.Println("Error loading .env file")
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
if len(os.Args) >= 2 {
|
||||
CatchCLI(os.Args)
|
||||
|
|
Binary file not shown.
|
@ -95,11 +95,6 @@ func (s *Service) Online24() float32 {
|
|||
return s.Online24Hours
|
||||
}
|
||||
|
||||
type GraphJson struct {
|
||||
X string `json:"x"`
|
||||
Y float64 `json:"y"`
|
||||
}
|
||||
|
||||
type DateScan struct {
|
||||
CreatedAt time.Time `json:"x"`
|
||||
Value int64 `json:"y"`
|
||||
|
|
|
@ -6,9 +6,24 @@ import (
|
|||
"html/template"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var httpFunctions template.FuncMap
|
||||
func (f *Failure) ParseError() string {
|
||||
err := strings.Contains(f.Issue, "operation timed out")
|
||||
if err {
|
||||
return fmt.Sprintf("HTTP Request Timed Out")
|
||||
}
|
||||
err = strings.Contains(f.Issue, "x509: certificate is valid")
|
||||
if err {
|
||||
return fmt.Sprintf("SSL Certificate invalid")
|
||||
}
|
||||
err = strings.Contains(f.Issue, "no such host")
|
||||
if err {
|
||||
return fmt.Sprintf("Domain is offline or not found")
|
||||
}
|
||||
return f.Issue
|
||||
}
|
||||
|
||||
func ExportIndexHTML() string {
|
||||
core.OfflineAssets = true
|
Loading…
Reference in New Issue