feat(legacy): disable services check when missing systemctl (#2160)

This commit is contained in:
Jonas L 2022-09-19 11:56:56 +02:00 committed by GitHub
parent 74539f75d8
commit 1edcbc0657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 224 additions and 204 deletions

View File

@ -45,6 +45,11 @@ function checkDatabaseDependencies()
&& in_array('pgsql', $extensions);
}
function with_systemd()
{
return !empty(shell_exec('which systemctl'));
}
/**
* Check that all external services are configured correctly and return an associative
* array with the results.
@ -53,15 +58,20 @@ function checkDatabaseDependencies()
*/
function checkExternalServices()
{
return [
$result = [
'database' => checkDatabaseConfiguration(),
'analyzer' => checkAnalyzerService(),
'pypo' => checkPlayoutService(),
'liquidsoap' => checkLiquidsoapService(),
'rabbitmq' => checkRMQConnection(),
'celery' => checkCeleryService(),
'api' => checkApiService(),
];
if (with_systemd()) {
$result['analyzer'] = checkAnalyzerService();
$result['pypo'] = checkPlayoutService();
$result['liquidsoap'] = checkLiquidsoapService();
$result['celery'] = checkCeleryService();
$result['api'] = checkApiService();
}
return $result;
}
/**

View File

@ -15,12 +15,15 @@ $postgres = $phpDependencies['postgres'];
$database = $externalServices['database'];
$rabbitmq = $externalServices['rabbitmq'];
$systemd = with_systemd();
$pypo = $externalServices['pypo'];
$liquidsoap = $externalServices['liquidsoap'];
$analyzer = $externalServices['analyzer'];
$celery = $externalServices['celery'];
$api = $externalServices['api'];
if ($systemd) {
$pypo = $externalServices['pypo'];
$liquidsoap = $externalServices['liquidsoap'];
$analyzer = $externalServices['analyzer'];
$celery = $externalServices['celery'];
$api = $externalServices['api'];
}
$r1 = array_reduce($phpDependencies, 'booleanReduce', true);
$r2 = array_reduce($externalServices, 'booleanReduce', true);
@ -155,101 +158,103 @@ $result = $r1 && $r2;
</td>
<?php } ?>
</tr>
<tr class="<?php echo $analyzer ? 'success' : 'danger'; ?>">
<td class="component">
Media Analyzer
</td>
<td class="description">
<?php echo _('LibreTime media analyzer service'); ?>
</td>
<?php if ($analyzer) { ?>
<td class="solution check"></td>
<?php } else { ?>
<td class="solution">
<?php echo _('Check that the libretime-analyzer service is installed correctly in '); ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-analyzer</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-analyzer</code>
<?php if ($systemd) { ?>
<tr class="<?php echo $analyzer ? 'success' : 'danger'; ?>">
<td class="component">
Media Analyzer
</td>
<?php } ?>
</tr>
<tr class="<?php echo $pypo ? 'success' : 'danger'; ?>">
<td class="component">
Pypo
</td>
<td class="description">
<?php echo _('LibreTime playout service'); ?>
</td>
<?php if ($pypo) { ?>
<td class="solution check"></td>
<?php } else { ?>
<td class="solution">
<?php echo _('Check that the libretime-playout service is installed correctly in '); ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-playout</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-playout</code>
<td class="description">
<?php echo _('LibreTime media analyzer service'); ?>
</td>
<?php } ?>
</tr>
<tr class="<?php echo $liquidsoap ? 'success' : 'danger'; ?>">
<td class="component">
Liquidsoap
</td>
<td class="description">
<?php echo _('LibreTime liquidsoap service'); ?>
</td>
<?php if ($liquidsoap) { ?>
<td class="solution check"></td>
<?php } else { ?>
<td class="solution">
<?php echo _('Check that the libretime-liquidsoap service is installed correctly in '); ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-liquidsoap</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-liquidsoap</code>
</td>
<?php } ?>
</tr>
<tr class="<?php echo $celery ? 'success' : 'danger'; ?>">
<td class="component">
Celery
</td>
<td class="description">
<?php echo _('LibreTime Celery Task service'); ?>
</td>
<?php if ($analyzer) { ?>
<td class="solution check"></td>
<?php } else { ?>
<td class="solution">
<?php echo _('Check that the libretime-analyzer service is installed correctly in '); ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-analyzer</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-analyzer</code>
</td>
<?php } ?>
</tr>
<?php if ($celery) { ?>
<td class="solution check"></td>
<?php } else { ?>
<td class="solution">
<?php echo _('Check that the libretime-worker service is installed correctly in '); ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-worker</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-worker</code>
<tr class="<?php echo $pypo ? 'success' : 'danger'; ?>">
<td class="component">
Pypo
</td>
<td class="description">
<?php echo _('LibreTime playout service'); ?>
</td>
<?php if ($pypo) { ?>
<td class="solution check"></td>
<?php } else { ?>
<td class="solution">
<?php echo _('Check that the libretime-playout service is installed correctly in '); ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-playout</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-playout</code>
</td>
<?php } ?>
</tr>
<tr class="<?php echo $liquidsoap ? 'success' : 'danger'; ?>">
<td class="component">
Liquidsoap
</td>
<td class="description">
<?php echo _('LibreTime liquidsoap service'); ?>
</td>
<?php } ?>
</tr>
<tr class="<?php echo $api ? 'success' : 'danger'; ?>">
<td class="component">
API
</td>
<td class="description">
<?php echo _('LibreTime API service'); ?>
</td>
<?php if ($api) { ?>
<td class="solution check"></td>
<?php } else { ?>
<td class="solution">
<?php echo _('Check that the libretime-api service is installed correctly in '); ?><code>/etc/init.d/</code>,
<?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-api</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-api</code>
<?php if ($liquidsoap) { ?>
<td class="solution check"></td>
<?php } else { ?>
<td class="solution">
<?php echo _('Check that the libretime-liquidsoap service is installed correctly in '); ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-liquidsoap</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-liquidsoap</code>
</td>
<?php } ?>
</tr>
<tr class="<?php echo $celery ? 'success' : 'danger'; ?>">
<td class="component">
Celery
</td>
<?php } ?>
</tr>
<td class="description">
<?php echo _('LibreTime Celery Task service'); ?>
</td>
<?php if ($celery) { ?>
<td class="solution check"></td>
<?php } else { ?>
<td class="solution">
<?php echo _('Check that the libretime-worker service is installed correctly in '); ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-worker</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-worker</code>
</td>
<?php } ?>
</tr>
<tr class="<?php echo $api ? 'success' : 'danger'; ?>">
<td class="component">
API
</td>
<td class="description">
<?php echo _('LibreTime API service'); ?>
</td>
<?php if ($api) { ?>
<td class="solution check"></td>
<?php } else { ?>
<td class="solution">
<?php echo _('Check that the libretime-api service is installed correctly in '); ?><code>/etc/init.d/</code>,
<?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-api</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-api</code>
</td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</div>

View File

@ -10,11 +10,14 @@ $postgres = $phpDependencies["postgres"];
$database = $externalServices["database"];
$rabbitmq = $externalServices["rabbitmq"];
$pypo = $externalServices["pypo"];
$liquidsoap = $externalServices["liquidsoap"];
$analyzer = $externalServices["analyzer"];
$celery = $externalServices['celery'];
$api = $externalServices['api'];
$systemd = with_systemd();
if ($systemd) {
$pypo = $externalServices['pypo'];
$liquidsoap = $externalServices['liquidsoap'];
$analyzer = $externalServices['analyzer'];
$celery = $externalServices['celery'];
$api = $externalServices['api'];
}
$r1 = array_reduce($phpDependencies, "booleanReduce", true);
$r2 = array_reduce($externalServices, "booleanReduce", true);
@ -94,111 +97,113 @@ $result = $r1 && $r2;
?>
</td>
</tr>
<tr>
<td class="component">
Media Analyzer
</td>
<td class="description">
<?php echo _("LibreTime media analyzer service") ?>
</td>
<td class="solution <?php if ($analyzer) {
echo 'check'; ?>">
<?php if ($systemd) { ?>
<tr>
<td class="component">
Media Analyzer
</td>
<td class="description">
<?php echo _("LibreTime media analyzer service") ?>
</td>
<td class="solution <?php if ($analyzer) {
echo 'check'; ?>">
<?php
} else {
?>">
<?php echo _("Check that the libretime-analyzer service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br /><code>systemctl status libretime-analyzer</code><br />
<?php echo _("If not, try ") ?><br /><code>sudo systemctl restart libretime-analyzer</code>
<?php
} else {
?>">
<?php echo _("Check that the libretime-analyzer service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br /><code>systemctl status libretime-analyzer</code><br />
<?php echo _("If not, try ") ?><br /><code>sudo systemctl restart libretime-analyzer</code>
<?php
}
?>
</td>
</tr>
<tr>
<td class="component">
Pypo
</td>
<td class="description">
<?php echo _("LibreTime playout service") ?>
</td>
<td class="solution <?php if ($pypo) {
echo 'check'; ?>">
}
?>
</td>
</tr>
<tr>
<td class="component">
Pypo
</td>
<td class="description">
<?php echo _("LibreTime playout service") ?>
</td>
<td class="solution <?php if ($pypo) {
echo 'check'; ?>">
<?php
} else {
?>">
<?php echo _("Check that the libretime-playout service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br /><code>systemctl status libretime-playout</code><br />
<?php echo _("If not, try ") ?><br /><code>sudo systemctl restart libretime-playout</code>
<?php
} else {
?>">
<?php echo _("Check that the libretime-playout service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br /><code>systemctl status libretime-playout</code><br />
<?php echo _("If not, try ") ?><br /><code>sudo systemctl restart libretime-playout</code>
<?php
}
?>
</td>
</tr>
<tr>
<td class="component">
Liquidsoap
</td>
<td class="description">
<?php echo _("LibreTime liquidsoap service") ?>
</td>
<td class="solution <?php if ($liquidsoap) {
echo 'check'; ?>">
}
?>
</td>
</tr>
<tr>
<td class="component">
Liquidsoap
</td>
<td class="description">
<?php echo _("LibreTime liquidsoap service") ?>
</td>
<td class="solution <?php if ($liquidsoap) {
echo 'check'; ?>">
<?php
} else {
?>">
<?php echo _("Check that the libretime-liquidsoap service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br /><code>systemctl status libretime-liquidsoap</code><br />
<?php echo _("If not, try ") ?><br /><code>sudo systemctl restart libretime-liquidsoap</code>
<?php
} else {
?>">
<?php echo _("Check that the libretime-liquidsoap service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br /><code>systemctl status libretime-liquidsoap</code><br />
<?php echo _("If not, try ") ?><br /><code>sudo systemctl restart libretime-liquidsoap</code>
<?php
}
?>
</td>
</tr>
<tr>
<td class="component">
Celery
</td>
<td class="description">
<?php echo _("LibreTime Celery Task service") ?>
</td>
<td class="solution <?php if ($celery) {
echo 'check'; ?>">
}
?>
</td>
</tr>
<tr>
<td class="component">
Celery
</td>
<td class="description">
<?php echo _("LibreTime Celery Task service") ?>
</td>
<td class="solution <?php if ($celery) {
echo 'check'; ?>">
<?php
} else {
?>">
<?php echo _("Check that the libretime-worker service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br /><code>systemctl status libretime-worker</code><br />
<?php echo _("If not, try ") ?><br /><code>sudo systemctl restart libretime-worker</code>
<?php
} else {
?>">
<?php echo _("Check that the libretime-worker service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br /><code>systemctl status libretime-worker</code><br />
<?php echo _("If not, try ") ?><br /><code>sudo systemctl restart libretime-worker</code>
<?php
}
?>
</td>
</tr>
<tr>
<td class="component">
API
</td>
<td class="description">
<?php echo _("LibreTime API service") ?>
</td>
<td class="solution <?php if ($api) {
echo 'check'; ?>">
}
?>
</td>
</tr>
<tr>
<td class="component">
API
</td>
<td class="description">
<?php echo _("LibreTime API service") ?>
</td>
<td class="solution <?php if ($api) {
echo 'check'; ?>">
<?php
} else {
?>">
<?php echo _("Check that the libretime-api service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br /><code>systemctl status libretime-api</code><br />
<?php echo _("If not, try ") ?><br /><code>sudo systemctl restart libretime-api</code>
<?php
} else {
?>">
<?php echo _("Check that the libretime-api service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br /><code>systemctl status libretime-api</code><br />
<?php echo _("If not, try ") ?><br /><code>sudo systemctl restart libretime-api</code>
<?php
}
?>
</td>
</tr>
}
?>
</td>
</tr>
<?php } ?>
</tbody>
<tr id="partitions" class="even">
<th colspan="5"><?php echo _("Disk Space") ?></th>