Commit 920a7c4e authored by dmorley's avatar dmorley

Merge branch 'develop' into allservices

# Conflicts:
#	db/migrations/2.3.0-2.4.0.sql
parents 2dcc68fa 46c5f3f3
...@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic ...@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
- Config syntax has changed to array style (#155) - Config syntax has changed to array style (#155)
- Added `pghost` config to set database port - Added `pghost` config to set database port
- Added `CONTRIBUTING.md` - Added `CONTRIBUTING.md`
- Podmin can choose at what fail score to send the notice out
- Podmin email shares details on why pod is failing - Podmin email shares details on why pod is failing
- Only retrieve location data for remote servers / IPs - Only retrieve location data for remote servers / IPs
### Changed ### Changed
......
...@@ -8,7 +8,7 @@ Environmental items you need (debian based system assumed): ...@@ -8,7 +8,7 @@ Environmental items you need (debian based system assumed):
OS Dependencies: OS Dependencies:
``` ```
php7.2 php7.2-curl php7.2-pgsql php-geoip php7.2-cli php7.2-common php7.2-bcmath php7.2-json php7.2-readline php7.2-mbstring php7.2-xml php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer php7.2 php7.2-curl php7.2-pgsql php7.2-bcmath php-geoip php7.2-cli php7.2-common php7.2-bcmath php7.2-json php7.2-readline php7.2-mbstring php7.2-xml php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer
``` ```
Yarn is a separate install: https://yarnpkg.com Yarn is a separate install: https://yarnpkg.com
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
"ext-dom": "*", "ext-dom": "*",
"ext-json": "*", "ext-json": "*",
"ext-libxml": "*", "ext-libxml": "*",
"ext-bcmath": "*",
"gabordemooij/redbean": "^5.1", "gabordemooij/redbean": "^5.1",
"nesbot/carbon": "^1.33", "nesbot/carbon": "^1.33",
"commerceguys/enum": "^1.0", "commerceguys/enum": "^1.0",
......
{ {
"_readme": [ "_readme": [
"This file locks the dependencies of your project to a known state", "This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "9ac3659b3b8b6f4a29e9a44e0dfd105f", "content-hash": "fda17d0424e9e1c45facb411a5473f27",
"packages": [ "packages": [
{ {
"name": "commerceguys/enum", "name": "commerceguys/enum",
...@@ -864,7 +864,8 @@ ...@@ -864,7 +864,8 @@
"ext-curl": "*", "ext-curl": "*",
"ext-dom": "*", "ext-dom": "*",
"ext-json": "*", "ext-json": "*",
"ext-libxml": "*" "ext-libxml": "*",
"ext-bcmath": "*"
}, },
"platform-dev": [], "platform-dev": [],
"platform-overrides": { "platform-overrides": {
......
...@@ -16,6 +16,7 @@ require_once __DIR__ . '/../boot.php'; ...@@ -16,6 +16,7 @@ require_once __DIR__ . '/../boot.php';
$_email = $_GET['email'] ?? ''; $_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? ''; $_podmin_statement = $_GET['podmin_statement'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? 0; $_podmin_notify = $_GET['podmin_notify'] ?? 0;
$_podmin_notify_level = $_GET['podmin_notify_level'] ?? 50;
$_domain = strtolower($_domain); $_domain = strtolower($_domain);
if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) { if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) {
...@@ -58,20 +59,22 @@ foreach ($pods as $pod) { ...@@ -58,20 +59,22 @@ foreach ($pods as $pod) {
} }
echo <<<EOF echo <<<EOF
<script> <script>
window.onload = function() { window.onload = function() {
$("#weight").ionRangeSlider(); $("#weight").ionRangeSlider();
$("#podmin_notify_level").ionRangeSlider();
} }
</script> </script>
<form action="/"> <form action="/">
<input type="hidden" name="edit"> <input type="hidden" name="edit">
<input type="hidden" name="domain" value="{$_domain}"> <input type="hidden" name="domain" value="{$_domain}">
<input type="hidden" name="token" value="{$uuid}"> <input type="hidden" name="token" value="{$uuid}">
<label>Email <input type="text" size="20" name="email"></label><br> <label>Email <input type="text" size="20" name="email"></label><br>
<label>Podmin Statement (You can include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="100" rows="7" name="podmin_statement"></textarea></label><br> <label>Podmin Statement (You can include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="100" rows="7" name="podmin_statement"></textarea></label><br>
<label>Weight <input type="text" data-min="0" data-step="1" data-max="10" name="weight" id="weight"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br> <label>Weight <input type="text" data-min="0" data-step="1" data-max="10" name="weight" id="weight"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br>
<label>Notify when your score falls to <input type="text" data-min="1" data-step="1" data-max="99" data-from="50" name="podmin_notify_level" id="podmin_notify_level"></label><br>
<input type="submit" name="action" value="save"> <input type="submit" name="action" value="save">
</form> </form>
EOF; EOF;
$stop = true; $stop = true;
...@@ -106,6 +109,7 @@ if (!$stop) { ...@@ -106,6 +109,7 @@ if (!$stop) {
$p['email'] = $_email; $p['email'] = $_email;
$p['podmin_statement'] = $_podmin_statement; $p['podmin_statement'] = $_podmin_statement;
$p['podmin_notify'] = $_podmin_notify; $p['podmin_notify'] = $_podmin_notify;
$p['podmin_notify_level'] = $_podmin_notify_level;
$p['publickey'] = $publickey; $p['publickey'] = $publickey;
R::store($p); R::store($p);
......
...@@ -21,6 +21,7 @@ $_weight = $_GET['weight'] ?? 10; ...@@ -21,6 +21,7 @@ $_weight = $_GET['weight'] ?? 10;
$_email = $_GET['email'] ?? ''; $_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? ''; $_podmin_statement = $_GET['podmin_statement'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? 0; $_podmin_notify = $_GET['podmin_notify'] ?? 0;
$_podmin_notify_level = $_GET['podmin_notify_level'] ?? 50;
require_once __DIR__ . '/../boot.php'; require_once __DIR__ . '/../boot.php';
...@@ -76,6 +77,8 @@ if ('save' === $_action) { ...@@ -76,6 +77,8 @@ if ('save' === $_action) {
$pod['weight'] = $_weight; $pod['weight'] = $_weight;
$pod['podmin_statement'] = $_podmin_statement; $pod['podmin_statement'] = $_podmin_statement;
$pod['podmin_notify'] = $_podmin_notify; $pod['podmin_notify'] = $_podmin_notify;
$pod['podmin_notify_level'] = $_podmin_notify_level;
R::store($pod); R::store($pod);
} catch (\RedBeanPHP\RedException $e) { } catch (\RedBeanPHP\RedException $e) {
...@@ -97,6 +100,7 @@ if ('save' === $_action) { ...@@ -97,6 +100,7 @@ if ('save' === $_action) {
<script> <script>
window.onload = function() { window.onload = function() {
$("#weight").ionRangeSlider(); $("#weight").ionRangeSlider();
$("#podmin_notify_level").ionRangeSlider();
} }
</script> </script>
Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($pod['tokenexpire']))->diffForHumans(null, true); ?><br> Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($pod['tokenexpire']))->diffForHumans(null, true); ?><br>
...@@ -108,6 +112,8 @@ Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($po ...@@ -108,6 +112,8 @@ Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($po
<label>Podmin Statement (You can use HTML to include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="150" rows="10" name="podmin_statement"><?php echo $pod['podmin_statement']; ?></textarea></label><br> <label>Podmin Statement (You can use HTML to include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="150" rows="10" name="podmin_statement"><?php echo $pod['podmin_statement']; ?></textarea></label><br>
<label>Weight <input type="text" data-min="0" data-step="1" data-max="10" name="weight" id="weight" data-from="<?php echo $pod['weight']; ?>"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br> <label>Weight <input type="text" data-min="0" data-step="1" data-max="10" name="weight" id="weight" data-from="<?php echo $pod['weight']; ?>"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br>
<label>Notify if pod falls off the list? <input type="checkbox" name="podmin_notify" <?php echo $pod['podmin_notify'] ? 'checked' : ''; ?> ></label><br> <label>Notify if pod falls off the list? <input type="checkbox" name="podmin_notify" <?php echo $pod['podmin_notify'] ? 'checked' : ''; ?> ></label><br>
<label>Notify when your score falls to <input type="text" data-min="1" data-step="1" data-max="99" name="podmin_notify_level" id="podmin_notify_level" data-from="<?php echo $pod['podmin_notify_level']; ?>"></label><br>
<input type="submit" name="action" value="save"> <input type="submit" name="action" value="save">
</form> </form>
<br> <br>
......
...@@ -5,7 +5,6 @@ ALTER TABLE pods RENAME COLUMN pingdomurl TO stats_apikey; ...@@ -5,7 +5,6 @@ ALTER TABLE pods RENAME COLUMN pingdomurl TO stats_apikey;
ALTER TABLE pods RENAME COLUMN xmpp TO service_xmpp; ALTER TABLE pods RENAME COLUMN xmpp TO service_xmpp;
ALTER TABLE pods RENAME COLUMN uptimelast7 TO uptime_alltime; ALTER TABLE pods RENAME COLUMN uptimelast7 TO uptime_alltime;
ALTER TABLE pods RENAME COLUMN responsetimelast7 TO latency; ALTER TABLE pods RENAME COLUMN responsetimelast7 TO latency;
ALTER TABLE pods RENAME COLUMN dateUpdated TO date_updated; ALTER TABLE pods RENAME COLUMN dateUpdated TO date_updated;
ALTER TABLE pods RENAME COLUMN dateLaststats TO date_laststats; ALTER TABLE pods RENAME COLUMN dateLaststats TO date_laststats;
ALTER TABLE pods RENAME COLUMN dateCreated TO date_created; ALTER TABLE pods RENAME COLUMN dateCreated TO date_created;
......
ALTER TABLE pods ADD services text; ALTER TABLE pods ADD services text;
ALTER TABLE pods DROP COLUMN service_facebook, DROP COLUMN service_wordpress, DROP COLUMN service_tumblr, DROP COLUMN service_twitter; ALTER TABLE pods DROP COLUMN service_facebook, DROP COLUMN service_wordpress, DROP COLUMN service_tumblr, DROP COLUMN service_twitter;
ALTER TABLE pods ADD podmin_notify_level int DEFAULT 50;
...@@ -40,7 +40,7 @@ try { ...@@ -40,7 +40,7 @@ try {
$reader = new Reader(c('geoip2db')); $reader = new Reader(c('geoip2db'));
$sql = ' $sql = '
SELECT domain, score, date_created, weight, podmin_notify, email, masterversion, shortversion, status, detectedlanguage SELECT domain, score, date_created, weight, podmin_notify, podmin_notify_level, email, masterversion, shortversion, status, detectedlanguage
FROM pods FROM pods
'; ';
...@@ -70,6 +70,7 @@ foreach ($pods as $pod) { ...@@ -70,6 +70,7 @@ foreach ($pods as $pod) {
$weight = $pod['weight']; $weight = $pod['weight'];
$email = $pod['email']; $email = $pod['email'];
$notify = $pod['podmin_notify']; $notify = $pod['podmin_notify'];
$notify_level = $pod['podmin_notify_level'];
$masterv = $pod['masterversion']; $masterv = $pod['masterversion'];
$shortv = $pod['shortversion']; $shortv = $pod['shortversion'];
$dbstatus = $pod['status']; $dbstatus = $pod['status'];
...@@ -341,7 +342,7 @@ foreach ($pods as $pod) { ...@@ -341,7 +342,7 @@ foreach ($pods as $pod) {
debug('Uptime', $uptime); debug('Uptime', $uptime);
if ($score == 49 && $notify && !$develop && $dbscore == 50) { if ($score == ($notify_level - 1) && $notify && !$develop && $dbscore == $notify_level) {
$to = $email; $to = $email;
$headers = ['From: ' . c('adminemail'), 'Bcc: ' . c('adminemail')]; $headers = ['From: ' . c('adminemail'), 'Bcc: ' . c('adminemail')];
$subject = 'Monitoring notice from poduptime'; $subject = 'Monitoring notice from poduptime';
......
...@@ -37,6 +37,7 @@ CREATE TABLE pods ( ...@@ -37,6 +37,7 @@ CREATE TABLE pods (
tokenexpire timestamp, tokenexpire timestamp,
podmin_statement text, podmin_statement text,
podmin_notify boolean, podmin_notify boolean,
podmin_notify_level int DEFAULT 50,
sslexpire timestamp, sslexpire timestamp,
dnssec boolean, dnssec boolean,
comment_counts int, comment_counts int,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment