mirror of https://github.com/statping/statping
building
parent
0666ce247a
commit
087403a0d9
|
@ -28,3 +28,10 @@ You can automatically start a Statup server with automatic SSL encryption using
|
|||
DOMAIN=mydomain.com EMAIL=info@mydomain.com \
|
||||
docker-compose -f docker-compose-ssl.yml up -d
|
||||
```
|
||||
|
||||
## Systemd
|
||||
```$xslt
|
||||
/etc/systemd/system/statup.service
|
||||
|
||||
|
||||
```
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
cd /home/ubuntu
|
||||
curl -o /home/ubuntu/startup.sh -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statup/master/servers/startup.sh
|
||||
chmod +x /home/ubuntu/startup.sh
|
||||
./startup.sh
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
LETSENCRYPT_HOST="status.balancebadge.io"
|
||||
LETSENCRYPT_EMAIL="info@socialeck.com"
|
||||
|
||||
rm -f docker-compose.yml
|
||||
curl -o docker-compose.yml -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statu$
|
||||
sudo service docker start
|
||||
sudo docker system prune -af
|
||||
sudo LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL docker-compose pull
|
||||
sudo LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL docker-compose up -d
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
cd /home/ubuntu
|
||||
rm -f docker-compose.yml
|
||||
curl -o docker-compose.yml -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statup/master/servers/docker-compose.yml
|
||||
sudo service docker start
|
||||
sudo docker system prune -af
|
||||
sudo docker-compose pull
|
||||
sudo docker-compose up -d
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=Statup Docker Startup
|
||||
After=network.target
|
||||
After=systemd-user-sessions.service
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/home/ubuntu/startup.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
software-properties-common -y
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
sudo add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
sudo apt-get update
|
||||
sudo apt-get install docker-ce -y
|
||||
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
sudo docker-compose --version
|
||||
sudo systemctl enable docker
|
||||
mkdir statup
|
||||
cd statup
|
||||
wget https://raw.githubusercontent.com/hunterlong/statup/master/servers/docker-compose.yml
|
||||
sudo service docker start
|
||||
sudo docker-compose up -d
|
|
@ -102,17 +102,15 @@ type GraphJson struct {
|
|||
Y float64 `json:"y"`
|
||||
}
|
||||
|
||||
|
||||
type DateScan struct {
|
||||
CreatedAt time.Time `json:"x"`
|
||||
Value int64 `json:"y"`
|
||||
Value int64 `json:"y"`
|
||||
}
|
||||
|
||||
|
||||
func (s *Service) GraphData() string {
|
||||
var d []DateScan
|
||||
|
||||
since := time.Now().Add(time.Hour * -12 + time.Minute * 0 + time.Second * 0)
|
||||
since := time.Now().Add(time.Hour*-12 + time.Minute*0 + time.Second*0)
|
||||
|
||||
sql := fmt.Sprintf("SELECT date_trunc('minute', created_at), AVG(latency)*1000 AS value FROM hits WHERE service=%v AND created_at > '%v' GROUP BY 1 ORDER BY date_trunc ASC;", s.Id, since.Format(time.RFC3339))
|
||||
|
||||
|
@ -136,7 +134,6 @@ func (s *Service) GraphData() string {
|
|||
|
||||
}
|
||||
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -154,7 +151,6 @@ func (s *Service) GraphData() string {
|
|||
return string(data)
|
||||
}
|
||||
|
||||
|
||||
//func (s *Service) GraphData() string {
|
||||
// var d []GraphJson
|
||||
// hits, _ := s.LimitedHits()
|
||||
|
|
Loading…
Reference in New Issue