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); && 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 * Check that all external services are configured correctly and return an associative
* array with the results. * array with the results.
@ -53,15 +58,20 @@ function checkDatabaseDependencies()
*/ */
function checkExternalServices() function checkExternalServices()
{ {
return [ $result = [
'database' => checkDatabaseConfiguration(), 'database' => checkDatabaseConfiguration(),
'analyzer' => checkAnalyzerService(),
'pypo' => checkPlayoutService(),
'liquidsoap' => checkLiquidsoapService(),
'rabbitmq' => checkRMQConnection(), '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']; $database = $externalServices['database'];
$rabbitmq = $externalServices['rabbitmq']; $rabbitmq = $externalServices['rabbitmq'];
$systemd = with_systemd();
$pypo = $externalServices['pypo']; if ($systemd) {
$liquidsoap = $externalServices['liquidsoap']; $pypo = $externalServices['pypo'];
$analyzer = $externalServices['analyzer']; $liquidsoap = $externalServices['liquidsoap'];
$celery = $externalServices['celery']; $analyzer = $externalServices['analyzer'];
$api = $externalServices['api']; $celery = $externalServices['celery'];
$api = $externalServices['api'];
}
$r1 = array_reduce($phpDependencies, 'booleanReduce', true); $r1 = array_reduce($phpDependencies, 'booleanReduce', true);
$r2 = array_reduce($externalServices, 'booleanReduce', true); $r2 = array_reduce($externalServices, 'booleanReduce', true);
@ -155,101 +158,103 @@ $result = $r1 && $r2;
</td> </td>
<?php } ?> <?php } ?>
</tr> </tr>
<tr class="<?php echo $analyzer ? 'success' : 'danger'; ?>"> <?php if ($systemd) { ?>
<td class="component"> <tr class="<?php echo $analyzer ? 'success' : 'danger'; ?>">
Media Analyzer <td class="component">
</td> Media Analyzer
<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>
</td> </td>
<?php } ?> <td class="description">
</tr> <?php echo _('LibreTime media analyzer service'); ?>
<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> </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) { ?> <?php if ($analyzer) { ?>
<td class="solution check"></td> <td class="solution check"></td>
<?php } else { ?> <?php } else { ?>
<td class="solution"> <td class="solution">
<?php echo _('Check that the libretime-liquidsoap service is installed correctly in '); ?><code>/etc/systemd/system/</code>, <?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 "); ?> <?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-liquidsoap</code><br /> <br /><code>systemctl status libretime-analyzer</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-liquidsoap</code> <?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-analyzer</code>
</td> </td>
<?php } ?> <?php } ?>
</tr> </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 ($celery) { ?> <tr class="<?php echo $pypo ? 'success' : 'danger'; ?>">
<td class="solution check"></td> <td class="component">
<?php } else { ?> Pypo
<td class="solution"> </td>
<?php echo _('Check that the libretime-worker service is installed correctly in '); ?><code>/etc/systemd/system/</code>, <td class="description">
<?php echo _(" and ensure that it's running with "); ?> <?php echo _('LibreTime playout service'); ?>
<br /><code>systemctl status libretime-worker</code><br /> </td>
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-worker</code> <?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> </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) { ?> <?php if ($liquidsoap) { ?>
<td class="solution check"></td> <td class="solution check"></td>
<?php } else { ?> <?php } else { ?>
<td class="solution"> <td class="solution">
<?php echo _('Check that the libretime-api service is installed correctly in '); ?><code>/etc/init.d/</code>, <?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 "); ?> <?php echo _(" and ensure that it's running with "); ?>
<br /><code>systemctl status libretime-api</code><br /> <br /><code>systemctl status libretime-liquidsoap</code><br />
<?php echo _('If not, try '); ?><br /><code>sudo systemctl restart libretime-api</code> <?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>
<?php } ?> <td class="description">
</tr> <?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> </tbody>
</table> </table>
</div> </div>

View File

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