mirror of https://github.com/statping/statping
export groups - minor updates
parent
373c2d1d5b
commit
50e3cf2143
|
@ -13,6 +13,7 @@ vendor
|
|||
servers
|
||||
dev
|
||||
!dev/postman_environment.json
|
||||
!dev/demo-script.sh
|
||||
!build/alpine-linux-amd64
|
||||
config.yml
|
||||
statup.db
|
||||
|
|
|
@ -233,6 +233,7 @@ func HelpEcho() {
|
|||
fmt.Println(" ADMIN_USER - Username for administrator account (default: admin)")
|
||||
fmt.Println(" ADMIN_PASS - Password for administrator account (default: admin)")
|
||||
fmt.Println(" SASS - Set the absolute path to the sass binary location")
|
||||
fmt.Println(" HTTP_PROXY - Use a HTTP Proxy for HTTP Requests")
|
||||
fmt.Println(" * You can insert environment variables into a '.env' file in root directory.")
|
||||
fmt.Println("Give Statping a Star at https://github.com/hunterlong/statping")
|
||||
}
|
||||
|
|
|
@ -51,9 +51,18 @@ type ExportData struct {
|
|||
Messages []*Message `json:"messages"`
|
||||
Checkins []*Checkin `json:"checkins"`
|
||||
Users []*User `json:"users"`
|
||||
Groups []*Group `json:"groups"`
|
||||
Notifiers []types.AllNotifiers `json:"notifiers"`
|
||||
}
|
||||
|
||||
// ExportSettings will export a JSON file containing all of the settings below:
|
||||
// - Core
|
||||
// - Notifiers
|
||||
// - Checkins
|
||||
// - Users
|
||||
// - Services
|
||||
// - Groups
|
||||
// - Messages
|
||||
func ExportSettings() ([]byte, error) {
|
||||
users, err := SelectAllUsers()
|
||||
messages, err := SelectMessages()
|
||||
|
@ -66,6 +75,7 @@ func ExportSettings() ([]byte, error) {
|
|||
Checkins: AllCheckins(),
|
||||
Users: users,
|
||||
Services: CoreApp.Services,
|
||||
Groups: SelectGroups(true, true),
|
||||
Messages: messages,
|
||||
}
|
||||
export, err := json.Marshal(data)
|
||||
|
|
|
@ -66,11 +66,11 @@ func InsertSampleData() error {
|
|||
Name: "JSON API Tester",
|
||||
Domain: "https://jsonplaceholder.typicode.com/posts",
|
||||
ExpectedStatus: 201,
|
||||
Expected: types.NewNullString(`(title)": "((\\"|[statup])*)"`),
|
||||
Expected: types.NewNullString(`(title)": "((\\"|[statping])*)"`),
|
||||
Interval: 30,
|
||||
Type: "http",
|
||||
Method: "POST",
|
||||
PostData: types.NewNullString(`{ "title": "statup", "body": "bar", "userId": 19999 }`),
|
||||
PostData: types.NewNullString(`{ "title": "statping", "body": "bar", "userId": 19999 }`),
|
||||
Timeout: 30,
|
||||
Order: 4,
|
||||
Public: types.NewNullBool(true),
|
||||
|
|
|
@ -355,9 +355,8 @@ func (s *Service) index() int {
|
|||
}
|
||||
|
||||
// updateService will update a service in the []*core.Services slice
|
||||
func updateService(service *Service) {
|
||||
index := service.index()
|
||||
CoreApp.Services[index] = service
|
||||
func updateService(s *Service) {
|
||||
CoreApp.Services[s.index()] = s
|
||||
}
|
||||
|
||||
// Delete will remove a service from the database, it will also end the service checking go routine
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
FROM alpine
|
||||
MAINTAINER "Hunter Long (https://github.com/hunterlong)"
|
||||
|
||||
ENV STATPING_VERSION=0.80.35
|
||||
|
||||
RUN apk add --no-cache ca-certificates linux-headers curl
|
||||
|
||||
RUN curl -L -s https://assets.statping.com/sass -o /usr/local/bin/sass && \
|
||||
chmod +x /usr/local/bin/sass
|
||||
|
||||
RUN curl -L -s https://github.com/hunterlong/statping/releases/download/v$STATPING_VERSION/statping-linux-alpine.tar.gz | tar -xz && \
|
||||
chmod +x statping && mv statping /usr/local/bin/statping
|
||||
|
||||
ENV DB_CONN=sqlite
|
||||
ENV NAME="Statping Demo"
|
||||
ENV DESCRIPTION="An Awesome Demo of a Statping Server running on Docker"
|
||||
ENV DOMAIN=demo.statping.com
|
||||
ENV SASS=/usr/local/bin/sass
|
||||
|
||||
ENV IS_DOCKER=true
|
||||
ENV STATPING_DIR=/app
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./dev/demo-script.sh /app/
|
||||
|
||||
ENTRYPOINT ./demo-script.sh
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
COMMAND="rm -rf /app/statping.db && reboot"
|
||||
|
||||
echo "* * * * * echo $COMMAND >> /test_file 2>&1" > /etc/crontabs/root
|
||||
|
||||
statping
|
|
@ -0,0 +1,15 @@
|
|||
# Deploy Portainer demo (demo.portainer.io) in a play-with-docker playground
|
||||
#
|
||||
# - Go to http://play-with-docker.com/?stack=https://raw.githubusercontent.com/portainer/portainer-demo/master/play-with-docker/docker-stack.yml
|
||||
# - Login and/or Start.
|
||||
# - Wait until 'Your session is ready!' and 'Close' modal.
|
||||
# - Refresh (if a shell is not shown).
|
||||
# - Wait until a link with text '80' is shown. It is the link to the demo.
|
||||
# - Visit https://github.com/portainer/portainer to check default credentials.
|
||||
#
|
||||
version: '3'
|
||||
services:
|
||||
trigger:
|
||||
image: franela/dind
|
||||
command: sh -c "git clone https://github.com/portainer/portainer-demo/ && ./portainer-demo/portainer-demo.sh && tail -f /dev/null"
|
||||
volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ]
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "0ff1dcd6-54f3-44a7-9c18-cc3c8e7df357",
|
||||
"name": "Local Statup",
|
||||
"name": "Local Statping",
|
||||
"values": [
|
||||
{
|
||||
"key": "endpoint",
|
||||
|
|
|
@ -40,8 +40,10 @@ func apiIndexHandler(w http.ResponseWriter, r *http.Request) {
|
|||
sendUnauthorizedJson(w, r)
|
||||
return
|
||||
}
|
||||
coreClone := *core.CoreApp
|
||||
coreClone.Started = utils.Timezoner(core.CoreApp.Started, core.CoreApp.Timezone)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(core.CoreApp)
|
||||
json.NewEncoder(w).Encode(coreClone)
|
||||
}
|
||||
|
||||
func apiRenewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
@ -79,7 +79,7 @@ func dataJson(s *types.Service, f *types.Failure) map[string]interface{} {
|
|||
if f != nil {
|
||||
issue = f.Issue
|
||||
}
|
||||
link := fmt.Sprintf("statup://service?id=%v", serviceId)
|
||||
link := fmt.Sprintf("statping://service?id=%v", serviceId)
|
||||
out := map[string]interface{}{
|
||||
"status": online,
|
||||
"id": serviceId,
|
||||
|
|
|
@ -117,7 +117,7 @@ func (u *telegram) OnSave() error {
|
|||
|
||||
// OnTest will test the Twilio SMS messaging
|
||||
func (u *telegram) OnTest() error {
|
||||
msg := fmt.Sprintf("Testing the Twilio SMS Notifier on your Statup server")
|
||||
msg := fmt.Sprintf("Testing the Twilio SMS Notifier on your Statping server")
|
||||
return u.Send(msg)
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Copyright (C) 2018. Hunter Long and the project contributors
|
||||
// Written by Hunter Long <info@socialeck.com> and the project contributors
|
||||
//
|
||||
// https://github.com/hunterlong/statup
|
||||
// https://github.com/hunterlong/statping
|
||||
//
|
||||
// The licenses for most software and other practical works are designed
|
||||
// to take away your freedom to share and change the works. By contrast,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"info": {
|
||||
"_postman_id": "94807b85-ef65-4370-9144-b1a74e04cb0e",
|
||||
"name": "Statping",
|
||||
"description": "Statup API Requests",
|
||||
"description": "Statping API Requests",
|
||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
||||
},
|
||||
"item": [
|
||||
|
@ -10,7 +10,7 @@
|
|||
"name": "Main",
|
||||
"item": [
|
||||
{
|
||||
"name": "Statup Details",
|
||||
"name": "Statping Details",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by go generate; DO NOT EDIT.
|
||||
// This file was generated by robots at
|
||||
// 2019-01-03 22:14:02.567846 -0800 PST m=+0.846504189
|
||||
// 2019-01-04 02:40:51.133321 -0800 PST m=+0.790626621
|
||||
//
|
||||
// This contains the most recently Markdown source for the Statping Wiki.
|
||||
package source
|
||||
|
|
40
statuper
40
statuper
|
@ -10,7 +10,7 @@ US_E_2="ami-cc7a40a9"
|
|||
AMI_IMAGE=$US_W_2
|
||||
AWS_CLI=$(which aws)
|
||||
DOCKER_CLI=$(which docker)
|
||||
DOCKER_IMG="hunterlong/statup"
|
||||
DOCKER_IMG="hunterlong/statping"
|
||||
AWS_ECS="$AWS_CLI --output json"
|
||||
DOCKER_PORT=8080
|
||||
|
||||
|
@ -20,7 +20,7 @@ cat <<EOM
|
|||
A simple shell script that will help you install Statping on your local machine, AWS, or Docker.
|
||||
|
||||
Commands:
|
||||
install Install statup to your local system
|
||||
install Install statping to your local system
|
||||
aws Create a new EC2 instance running Statping
|
||||
docker Start the latest Statping Docker image
|
||||
docker-compose Create Statping with a Postgres database
|
||||
|
@ -55,7 +55,7 @@ function require() {
|
|||
|
||||
# Get the latest release from github
|
||||
get_latest_release() {
|
||||
STATUP_VERSION=$(curl --silent "https://api.github.com/repos/$DOCKER_IMG/releases/latest" | jq -r .tag_name)
|
||||
STATPING_VERSION=$(curl --silent "https://api.github.com/repos/$DOCKER_IMG/releases/latest" | jq -r .tag_name)
|
||||
}
|
||||
|
||||
# auto set AWS environment variables
|
||||
|
@ -111,12 +111,12 @@ function askSecurityName {
|
|||
read -p "Enter a name for the new Security Group: " EC2SECGROUP
|
||||
}
|
||||
|
||||
# ask user if they want to install statup to the bin folder
|
||||
# ask user if they want to install statping to the bin folder
|
||||
function askInstallGlobal {
|
||||
read -p "Do you want to move Statping to the bin folder? (y/N): " MOVEBIN
|
||||
}
|
||||
|
||||
# ask user if they want statup to start on boot
|
||||
# ask user if they want statping to start on boot
|
||||
function askInstallSystemCTL {
|
||||
read -p "Do you want to auto start Statping on boot? (y/N): " SYSTEMCTL
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ function awsCreateEC2 {
|
|||
echo "New EC2 instance created: $INSTANCE_ID with status $EC2_STATUS";
|
||||
}
|
||||
|
||||
# task to created a new EC2 instance with statup image
|
||||
# task to created a new EC2 instance with statping image
|
||||
function ec2TaskComplete {
|
||||
echo "New EC2 instance is ready! $INSTANCE_ID with status $EC2_STATUS";
|
||||
echo "Instance ID: $INSTANCE_ID with status $EC2_STATUS";
|
||||
|
@ -184,14 +184,14 @@ function awsTask {
|
|||
ec2TaskComplete
|
||||
}
|
||||
|
||||
# function to move the statup binary to the bin folder
|
||||
# function to move the statping binary to the bin folder
|
||||
function moveToBin {
|
||||
mv statup /usr/local/bin/statup
|
||||
mv statping /usr/local/bin/statping
|
||||
}
|
||||
|
||||
# function to install a systemctl service to the local system
|
||||
function installSystemCTL {
|
||||
FILE=statup.service
|
||||
FILE=statping.service
|
||||
cat > $FILE <<- EOM
|
||||
[Unit]
|
||||
Description=Statping Server
|
||||
|
@ -202,7 +202,7 @@ After=network-online.target
|
|||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
ExecStart=/usr/local/bin/statup
|
||||
ExecStart=/usr/local/bin/statping
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -210,8 +210,8 @@ EOM
|
|||
echo "Installing systemctl service file to: /etc/systemd/system/$FILE"
|
||||
mv $FILE /etc/systemd/system/$FILE
|
||||
systemctl daemon-reload
|
||||
systemctl enable statup.service
|
||||
systemctl start statup
|
||||
systemctl enable statping.service
|
||||
systemctl start statping
|
||||
echo "Statping has been installed to SystemCTL and will start on boot"
|
||||
}
|
||||
|
||||
|
@ -220,21 +220,21 @@ function downloadBin {
|
|||
getOS
|
||||
getArch
|
||||
get_latest_release
|
||||
GIT_DOWNLOAD="https://github.com/$DOCKER_IMG/releases/download/$STATUP_VERSION/statup-$OS-$ARCH.tar.gz"
|
||||
echo "Downloading Statping $STATUP_VERSION from $GIT_DOWNLOAD"
|
||||
GIT_DOWNLOAD="https://github.com/$DOCKER_IMG/releases/download/$STATPING_VERSION/statping-$OS-$ARCH.tar.gz"
|
||||
echo "Downloading Statping $STATPING_VERSION from $GIT_DOWNLOAD"
|
||||
curl -L --silent $GIT_DOWNLOAD | tar xz
|
||||
echo "Download complete"
|
||||
}
|
||||
|
||||
# install statup locally from github
|
||||
# install statping locally from github
|
||||
function localTask {
|
||||
downloadBin
|
||||
echo "Try Statping by running 'statup version'!"
|
||||
echo "Try Statping by running 'statping version'!"
|
||||
askInstallGlobal
|
||||
if [ $MOVEBIN == "y" ]; then
|
||||
moveToBin
|
||||
echo "Statping can now be ran anywhere with command 'statup'"
|
||||
echo "Install location: /usr/local/bin/statup"
|
||||
echo "Statping can now be ran anywhere with command 'statping'"
|
||||
echo "Install location: /usr/local/bin/statping"
|
||||
if [ $OS == "linux" ]; then
|
||||
askInstallSystemCTL
|
||||
if [ $SYSTEMCTL == "y" ]; then
|
||||
|
@ -245,7 +245,7 @@ function localTask {
|
|||
}
|
||||
|
||||
function uninstallTask {
|
||||
rm -f /usr/local/bin/statup
|
||||
rm -f /usr/local/bin/statping
|
||||
}
|
||||
|
||||
# start the Statping docker image
|
||||
|
@ -293,7 +293,7 @@ function getOS {
|
|||
function echoVersion {
|
||||
require jq
|
||||
get_latest_release
|
||||
echo "Statping Latest: $STATUP_VERSION"
|
||||
echo "Statping Latest: $STATPING_VERSION"
|
||||
echo "Statpinger Tool: v$VERSION"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue