mirror of https://github.com/statping/statping
parent
ce360c64d9
commit
393b433467
2
Makefile
2
Makefile
|
@ -303,7 +303,7 @@ dockerhub:
|
|||
|
||||
docker-build-dev:
|
||||
docker build --build-arg VERSION=${VERSION} -t statping/statping:latest --no-cache -f Dockerfile .
|
||||
docker tag statping/statping:dev statping/statping:dev-v${VERSION}
|
||||
docker tag hunterlong/statping:dev hunterlong/statping:dev-v${VERSION}
|
||||
|
||||
post-release: frontend-build upload_to_s3 publish-homebrew dockerhub
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ const tokenKey = "statping_auth";
|
|||
class Api {
|
||||
constructor() {
|
||||
this.version = "0.90.70";
|
||||
this.commit = "8c89b7ed4b45885063afaba445249bdf51bb1982";
|
||||
this.commit = "ce360c64d9f4ea48519eeed77529bd17ba51a7a7";
|
||||
}
|
||||
|
||||
async oauth() {
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
<a @click.prevent='tab="Notifiers"' class="d-block mb-1 text-link" href="#">Notifiers</a>
|
||||
|
||||
<a @click.prevent='tab="Issues and Solutions"' class="d-block mb-1 text-link" href="#">Issues and Solutions</a>
|
||||
|
||||
<a @click.prevent='tab="Bulk Import Services"' class="d-block mb-1 text-link" href="#">Bulk Import Services</a>
|
||||
|
||||
<a @click.prevent='tab="Environment Variables"' class="d-block mb-1 text-link" href="#">Environment Variables</a>
|
||||
|
@ -326,6 +328,44 @@ func AttachNotifiers() error {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12" v-if='tab === "Issues and Solutions"'>
|
||||
<h1 class="h1 mt-5 mb-5 text-muted">Issues and Solutions</h1>
|
||||
<span class="spacer"></span>
|
||||
<div v-pre>
|
||||
<p>If you have issues with your Statping instance, this page will help you solve them. Before doing anything, I recommend updating to the latest version of Statping.</p>
|
||||
|
||||
<h2>Update to Latest Version</h2>
|
||||
|
||||
<p>Updating Statping is very simple, you can choose one of the options below:
|
||||
- Run command: <code>statping update</code> (you may need to run sudo depending on your server)
|
||||
- or Run command: <code>curl -o- -L https://statping.com/install.sh | bash</code>
|
||||
- or download tar.gz file from <a href="https://github.com/statping/statping/releases/latest" target="_blank">Latest Releases</a> and extract for <code>statping</code>.</p>
|
||||
|
||||
<h2>Blank/White Page</h2>
|
||||
|
||||
<p>If your Statping instance is only showing a blank white page, this means there’s an issue with CSS or JS assets.
|
||||
- Update to the latest version of Statping
|
||||
- Delete the <code>assets</code> folder if you have one
|
||||
- Restart Statping instance</p>
|
||||
|
||||
<h2>Database Migration Errors</h2>
|
||||
|
||||
<p>If you notice a database error during migration, you can reset your Statping instance while keeping previous data so you won’t have to re-input.
|
||||
- In your Statping directory (contains config.yml) run command: <code>statping export</code>. This will export all elements into a timestamped JSON file. This file will not include previous hits or failures.
|
||||
- Delete <code>assets</code> folder if you have one.
|
||||
- Delete and Recreate MySQL, Postgres database, or delete <code>statping.db</code>.
|
||||
- Import previous data by running: <code>statping import backup.json</code> (replace backup.json with your exported filename)</p>
|
||||
|
||||
<h2>Deleting Old Records</h2>
|
||||
|
||||
<ul>
|
||||
<li><code>DELETE FROM hits WHERE created_at < '2020-02-21 00:00:00';</code> // Delete hits older than</li>
|
||||
<li><code>DELETE FROM failures WHERE created_at < '2020-02-21 00:00:00';</code> // Delete failures older than</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12" v-if='tab === "Bulk Import Services"'>
|
||||
<h1 class="h1 mt-5 mb-5 text-muted">Bulk Import Services</h1>
|
||||
<span class="spacer"></span>
|
||||
|
@ -422,10 +462,12 @@ services:
|
|||
<li><code>DB_PASS</code> - Database password</li>
|
||||
<li><code>DB_PORT</code> - Database port (5432, 3306, …)</li>
|
||||
<li><code>DB_DATABASE</code> - Database connection’s database name</li>
|
||||
<li><code>DB_DSN</code> - Database DSN string (<a href="https://www.php.net/manual/en/ref.pdo-pgsql.connection.php" target="_blank">postgres</a>, <a href="https://github.com/go-sql-driver/mysql#dsn-data-source-name" target="_blank">mysql</a>, <a href="https://www.sqlite.org/inmemorydb.html" target="_blank">sqlite</a>)</li>
|
||||
<li><code>READ_ONLY</code> - Run in a read only mode, this will not create, update, or delete records (false)</li>
|
||||
<li><code>POSTGRES_SSLMODE</code> - Enable <a href="https://www.postgresql.org/docs/9.1/libpq-ssl.html" target="_blank">Postgres SSL Mode</a> ‘ssl_mode=VALUE’ (enable/disable/verify-full/verify-ca)</li>
|
||||
<li><code>MAX_OPEN_CONN</code> - Set <a href="https://golang.org/pkg/database/sql/#DB.SetMaxOpenConns" target="_blank">Maximum Open Connections</a> for database server (default: 25)</li>
|
||||
<li><code>MAX_IDLE_CONN</code> - Set <a href="https://golang.org/pkg/database/sql/#DB.SetMaxIdleConns" target="_blank">Maximum Idle Connections</a> for database server (default: 25)</li>
|
||||
<li><code>MAX_LIFE_CONN</code> - Set <a href="https://golang.org/pkg/database/sql/#DB.SetConnMaxLifetime" target="_blank">Maximum Life Connections</a> for database server (default: 25)</li>
|
||||
<li><code>MAX_LIFE_CONN</code> - Set <a href="https://golang.org/pkg/database/sql/#DB.SetConnMaxLifetime" target="_blank">Maximum Life Connections</a> for database server (default: 5 minutes)</li>
|
||||
<li><code>PREFIX</code> - Add a prefix string to each Prometheus metric (default is empty)</li>
|
||||
</ul>
|
||||
|
||||
|
@ -454,7 +496,7 @@ services:
|
|||
|
||||
<li><p><code>LOGS_MAX_SIZE</code> - Maximum size for log files (defaults to 16 MB)</p></li>
|
||||
|
||||
<li><p><code>LANGUAGE</code> - Language to use (en, fr, ru, more to come…)</p>
|
||||
<li><p><code>LANGUAGE</code> - Language to use (en, fr, it, ru, zh, de, ko, ja)</p>
|
||||
|
||||
<h3>Assets</h3></li>
|
||||
|
||||
|
@ -463,6 +505,10 @@ services:
|
|||
<li><p><code>USE_ASSETS</code> - Automatically use assets from ‘assets folder’ (true/false)</p></li>
|
||||
</ul>
|
||||
|
||||
<blockquote>
|
||||
<p>If you have issues with Statping not loading frontend files, delete the assets folder and reboot.</p>
|
||||
</blockquote>
|
||||
|
||||
<h3>Automatic Fills</h3>
|
||||
|
||||
<ul>
|
||||
|
@ -2275,7 +2321,7 @@ OluFxewsEO0QNDrfFb+0gnjYlnGqOFcZjUMXbDdY5oLSPtXohynuTK1qyQ==
|
|||
</div>
|
||||
|
||||
<div class="text-center small text-dim" v-pre>
|
||||
Automatically generated from Statping's Wiki on 2020-09-15 19:09:14.703237 +0000 UTC
|
||||
Automatically generated from Statping's Wiki on 2020-10-13 00:26:29.680492 +0000 UTC
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -3,6 +3,7 @@ package notifiers
|
|||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
|
||||
"github.com/go-mail/mail"
|
||||
"github.com/statping/emails"
|
||||
"github.com/statping/statping/types/core"
|
||||
|
@ -90,8 +91,9 @@ type emailOutgoing struct {
|
|||
|
||||
// OnFailure will trigger failing service
|
||||
func (e *emailer) OnFailure(s services.Service, f failures.Failure) (string, error) {
|
||||
subscriber := e.Var2.String
|
||||
subject := fmt.Sprintf("Service %s is Offline", s.Name)
|
||||
tmpl := renderEmail(s, f, emails.Failure)
|
||||
tmpl := renderEmail(s, subscriber, f, emails.Failure)
|
||||
email := &emailOutgoing{
|
||||
To: e.Var2.String,
|
||||
Subject: subject,
|
||||
|
@ -103,8 +105,9 @@ func (e *emailer) OnFailure(s services.Service, f failures.Failure) (string, err
|
|||
|
||||
// OnSuccess will trigger successful service
|
||||
func (e *emailer) OnSuccess(s services.Service) (string, error) {
|
||||
subscriber := e.Var2.String
|
||||
subject := fmt.Sprintf("Service %s is Back Online", s.Name)
|
||||
tmpl := renderEmail(s, failures.Failure{}, emails.Success)
|
||||
tmpl := renderEmail(s, subscriber, failures.Failure{}, emails.Success)
|
||||
email := &emailOutgoing{
|
||||
To: e.Var2.String,
|
||||
Subject: subject,
|
||||
|
@ -114,11 +117,12 @@ func (e *emailer) OnSuccess(s services.Service) (string, error) {
|
|||
return tmpl, e.dialSend(email)
|
||||
}
|
||||
|
||||
func renderEmail(s services.Service, f failures.Failure, emailData string) string {
|
||||
func renderEmail(s services.Service, subscriber string, f failures.Failure, emailData string) string {
|
||||
data := replacer{
|
||||
Core: *core.App,
|
||||
Service: s,
|
||||
Failure: f,
|
||||
Email: subscriber,
|
||||
Custom: nil,
|
||||
}
|
||||
output, err := emails.Parse(emailData, data)
|
||||
|
@ -131,12 +135,13 @@ func renderEmail(s services.Service, f failures.Failure, emailData string) strin
|
|||
|
||||
// OnTest triggers when this notifier has been saved
|
||||
func (e *emailer) OnTest() (string, error) {
|
||||
subscriber := e.Var2.String
|
||||
service := services.Example(true)
|
||||
subject := fmt.Sprintf("Service %v is Back Online", service.Name)
|
||||
email := &emailOutgoing{
|
||||
To: e.Var2.String,
|
||||
Subject: subject,
|
||||
Template: renderEmail(service, failures.Example(), emailFailure),
|
||||
Template: renderEmail(service, subscriber, failures.Example(), emailFailure),
|
||||
From: e.Var1.String,
|
||||
}
|
||||
return subject, e.dialSend(email)
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -111,7 +111,7 @@ const emailFailureMJML = `<mjml>
|
|||
<mj-column>
|
||||
<mj-text font-color="#d50d0d" align="center" font-size="20px" color="#626262">Offline for {{.Service.Downtime.Human}}</mj-text>
|
||||
|
||||
<mj-button border-radius="4px" background-color="#cb121c" href="{{.Core .Domain}}/service/{{.Service .Id}}">View Dashboard</mj-button>
|
||||
<mj-button border-radius="4px" background-color="#cb121c" href="{{.Core.Domain}}/service/{{.Service.Id}}">View Dashboard</mj-button>
|
||||
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
|
@ -203,7 +203,7 @@ const emailSuccessMJML = `<mjml>
|
|||
<mj-column>
|
||||
<mj-text font-color="#d50d0d" align="center" font-size="20px" color="#626262">Offline for {{.Service.Downtime.Human}}</mj-text>
|
||||
|
||||
<mj-button border-radius="4px" background-color="#4caf50" href="{{.Core .Domain}}/service/{{.Service .Id}}">View Dashboard</mj-button>
|
||||
<mj-button border-radius="4px" background-color="#4caf50" href="{{.Core.Domain}}/service/{{.Service.Id}}">View Dashboard</mj-button>
|
||||
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
|
|
|
@ -2,12 +2,13 @@ package notifiers
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"html/template"
|
||||
"time"
|
||||
|
||||
"github.com/statping/statping/types/core"
|
||||
"github.com/statping/statping/types/failures"
|
||||
"github.com/statping/statping/types/services"
|
||||
"github.com/statping/statping/utils"
|
||||
"html/template"
|
||||
"time"
|
||||
)
|
||||
|
||||
//go:generate go run generate.go
|
||||
|
@ -18,6 +19,7 @@ type replacer struct {
|
|||
Core core.Core
|
||||
Service services.Service
|
||||
Failure failures.Failure
|
||||
Email string
|
||||
Custom map[string]string
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue