👌 IMPROVE: Doctor CLI: Harmonize negative check result descriptions (closes #724)
This commit is contained in:
parent
1ddc246e0f
commit
4b021dba7a
1 changed files with 18 additions and 18 deletions
|
@ -21,41 +21,41 @@ $cli
|
||||||
Console::log("\n".'👩⚕️ Running '.APP_NAME.' Doctor for version '.App::getEnv('_APP_VERSION', 'UNKNOWN').' ...'."\n");
|
Console::log("\n".'👩⚕️ Running '.APP_NAME.' Doctor for version '.App::getEnv('_APP_VERSION', 'UNKNOWN').' ...'."\n");
|
||||||
|
|
||||||
Console::log('Checking for production best practices...');
|
Console::log('Checking for production best practices...');
|
||||||
|
|
||||||
$domain = new Domain(App::getEnv('_APP_DOMAIN'));
|
$domain = new Domain(App::getEnv('_APP_DOMAIN'));
|
||||||
|
|
||||||
if(!$domain->isKnown() || $domain->isTest()) {
|
if(!$domain->isKnown() || $domain->isTest()) {
|
||||||
Console::log('🔴 Hostname has a public suffix ('.$domain->get().')');
|
Console::log('🔴 Hostname has no public suffix ('.$domain->get().')');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Console::log('🟢 Hostname has a public suffix ('.$domain->get().')');
|
Console::log('🟢 Hostname has a public suffix ('.$domain->get().')');
|
||||||
}
|
}
|
||||||
|
|
||||||
$domain = new Domain(App::getEnv('_APP_DOMAIN_TARGET'));
|
$domain = new Domain(App::getEnv('_APP_DOMAIN_TARGET'));
|
||||||
|
|
||||||
if(!$domain->isKnown() || $domain->isTest()) {
|
if(!$domain->isKnown() || $domain->isTest()) {
|
||||||
Console::log('🔴 CNAME target has a public suffix ('.$domain->get().')');
|
Console::log('🔴 CNAME target has no public suffix ('.$domain->get().')');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Console::log('🟢 CNAME target has a public suffix ('.$domain->get().')');
|
Console::log('🟢 CNAME target has a public suffix ('.$domain->get().')');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(App::getEnv('_APP_OPENSSL_KEY_V1') === 'your-secret-key' || empty(App::getEnv('_APP_OPENSSL_KEY_V1'))) {
|
if(App::getEnv('_APP_OPENSSL_KEY_V1') === 'your-secret-key' || empty(App::getEnv('_APP_OPENSSL_KEY_V1'))) {
|
||||||
Console::log('🔴 Using a unique secret key for encryption');
|
Console::log('🔴 Not using a unique secret key for encryption');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Console::log('🟢 Using a unique secret key for encryption');
|
Console::log('🟢 Using a unique secret key for encryption');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(App::getEnv('_APP_ENV', 'development') !== 'production') {
|
if(App::getEnv('_APP_ENV', 'development') !== 'production') {
|
||||||
Console::log('🔴 App enviornment is set for production');
|
Console::log('🔴 App environment is set for development');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Console::log('🟢 App enviornment is set for production');
|
Console::log('🟢 App environment is set for production');
|
||||||
}
|
}
|
||||||
|
|
||||||
if('enabled' !== App::getEnv('_APP_OPTIONS_ABUSE', 'disabled')) {
|
if('enabled' !== App::getEnv('_APP_OPTIONS_ABUSE', 'disabled')) {
|
||||||
Console::log('🔴 Abuse protection is enabled');
|
Console::log('🔴 Abuse protection is disabled');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Console::log('🟢 Abuse protection is enabled');
|
Console::log('🟢 Abuse protection is enabled');
|
||||||
|
@ -74,7 +74,7 @@ $cli
|
||||||
else {
|
else {
|
||||||
Console::log('🟢 Console access limits are enabled');
|
Console::log('🟢 Console access limits are enabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
if('enabled' !== App::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled')) {
|
if('enabled' !== App::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled')) {
|
||||||
Console::log('🔴 HTTPS force option is disabled');
|
Console::log('🔴 HTTPS force option is disabled');
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ $cli
|
||||||
$mail->Subject = 'Test SMTP Connection';
|
$mail->Subject = 'Test SMTP Connection';
|
||||||
$mail->Body = 'Hello World';
|
$mail->Body = 'Hello World';
|
||||||
$mail->AltBody = 'Hello World';
|
$mail->AltBody = 'Hello World';
|
||||||
|
|
||||||
$mail->send();
|
$mail->send();
|
||||||
Console::success('SMTP................connected 👍');
|
Console::success('SMTP................connected 👍');
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
|
@ -143,7 +143,7 @@ $cli
|
||||||
$host = App::getEnv('_APP_STATSD_HOST', 'telegraf');
|
$host = App::getEnv('_APP_STATSD_HOST', 'telegraf');
|
||||||
$port = App::getEnv('_APP_STATSD_PORT', 8125);
|
$port = App::getEnv('_APP_STATSD_PORT', 8125);
|
||||||
|
|
||||||
if($fp = @\fsockopen('udp://'.$host, $port, $errCode, $errStr, 2)){
|
if($fp = @\fsockopen('udp://'.$host, $port, $errCode, $errStr, 2)){
|
||||||
Console::success('StatsD..............connected 👍');
|
Console::success('StatsD..............connected 👍');
|
||||||
\fclose($fp);
|
\fclose($fp);
|
||||||
} else {
|
} else {
|
||||||
|
@ -153,7 +153,7 @@ $cli
|
||||||
$host = App::getEnv('_APP_INFLUXDB_HOST', '');
|
$host = App::getEnv('_APP_INFLUXDB_HOST', '');
|
||||||
$port = App::getEnv('_APP_INFLUXDB_PORT', '');
|
$port = App::getEnv('_APP_INFLUXDB_PORT', '');
|
||||||
|
|
||||||
if($fp = @\fsockopen($host, $port, $errCode, $errStr, 2)){
|
if($fp = @\fsockopen($host, $port, $errCode, $errStr, 2)){
|
||||||
Console::success('InfluxDB............connected 👍');
|
Console::success('InfluxDB............connected 👍');
|
||||||
\fclose($fp);
|
\fclose($fp);
|
||||||
} else {
|
} else {
|
||||||
|
@ -179,7 +179,7 @@ $cli
|
||||||
else {
|
else {
|
||||||
Console::error('🔴 '.$key.' Volume is unreadable');
|
Console::error('🔴 '.$key.' Volume is unreadable');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\is_writable($device->getRoot())) {
|
if (\is_writable($device->getRoot())) {
|
||||||
Console::success('🟢 '.$key.' Volume is writeable');
|
Console::success('🟢 '.$key.' Volume is writeable');
|
||||||
}
|
}
|
||||||
|
@ -203,9 +203,9 @@ $cli
|
||||||
|
|
||||||
$percentage = (($device->getPartitionTotalSpace() - $device->getPartitionFreeSpace())
|
$percentage = (($device->getPartitionTotalSpace() - $device->getPartitionFreeSpace())
|
||||||
/ $device->getPartitionTotalSpace()) * 100;
|
/ $device->getPartitionTotalSpace()) * 100;
|
||||||
|
|
||||||
$message = $key.' Volume has '.Storage::human($device->getPartitionFreeSpace()) . ' free space ('.\round($percentage, 2).'% used)';
|
$message = $key.' Volume has '.Storage::human($device->getPartitionFreeSpace()) . ' free space ('.\round($percentage, 2).'% used)';
|
||||||
|
|
||||||
if ($percentage < 80) {
|
if ($percentage < 80) {
|
||||||
Console::success('🟢 ' . $message);
|
Console::success('🟢 ' . $message);
|
||||||
}
|
}
|
||||||
|
@ -213,12 +213,12 @@ $cli
|
||||||
Console::error('🔴 ' . $message);
|
Console::error('🔴 ' . $message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(App::isProduction()) {
|
if(App::isProduction()) {
|
||||||
Console::log('');
|
Console::log('');
|
||||||
$version = \json_decode(@\file_get_contents(App::getEnv('_APP_HOME', 'http://localhost').'/v1/health/version'), true);
|
$version = \json_decode(@\file_get_contents(App::getEnv('_APP_HOME', 'http://localhost').'/v1/health/version'), true);
|
||||||
|
|
||||||
if ($version && isset($version['version'])) {
|
if ($version && isset($version['version'])) {
|
||||||
if(\version_compare($version['version'], App::getEnv('_APP_VERSION', 'UNKNOWN')) === 0) {
|
if(\version_compare($version['version'], App::getEnv('_APP_VERSION', 'UNKNOWN')) === 0) {
|
||||||
Console::info('You are running the latest version of '.APP_NAME.'! 🥳');
|
Console::info('You are running the latest version of '.APP_NAME.'! 🥳');
|
||||||
|
|
Loading…
Reference in a new issue