Updated configuration checklist to include running services

This commit is contained in:
Duncan Sommerville 2014-12-19 11:44:23 -05:00
parent 6bc3a1cfba
commit 32f40f3dc8
4 changed files with 135 additions and 16 deletions

View File

@ -8,17 +8,20 @@
*/ */
$phpDependencies = checkPhpDependencies(); $phpDependencies = checkPhpDependencies();
$externalServices = checkExternalServices();
$zend = $phpDependencies["zend"]; $zend = $phpDependencies["zend"];
$postgres = $phpDependencies["postgres"]; $postgres = $phpDependencies["postgres"];
$database = checkDatabaseConfiguration();
function booleanReduce($a, $b) { $database = $externalServices["database"];
return $a && $b; $rabbitmq = $externalServices["rabbitmq"];
}
$r = array_reduce($phpDependencies, "booleanReduce", true); $pypo = $externalServices["pypo"];
$result = $r && $database; $liquidsoap = $externalServices["liquidsoap"];
$mediamonitor = $externalServices["media-monitor"];
$r1 = array_reduce($phpDependencies, "booleanReduce", true);
$r2 = array_reduce($externalServices, "booleanReduce", true);
$result = $r1 && $r2;
?> ?>
<html> <html>
<head> <head>
@ -115,22 +118,107 @@ $result = $r && $database;
?> ?>
</td> </td>
</tr> </tr>
<tr class="<?=$rabbitmq ? 'success' : 'danger';?>">
<td class="component">
RabbitMQ
</td>
<td class="description">
RabbitMQ configuration for Airtime
</td>
<td class="solution <?php if ($rabbitmq) {echo 'check';?>">
<?php
} else {
?>">
Make sure RabbitMQ is installed correctly, and that your settings in /etc/airtime/airtime.conf
are correct. Try using <code>sudo rabbitmqctl list_users</code> and <code>sudo rabbitmqctl list_vhosts</code>
to see if the airtime user (or your custom RabbitMQ user) exists, then checking that
<code>sudo rabbitmqctl list_exchanges</code> contains entries for airtime-media-monitor, airtime-pypo,
and airtime-uploads.
<?php
}
?>
</td>
</tr>
<tr class="<?=$mediamonitor ? 'success' : 'danger';?>">
<td class="component">
Media Monitor
</td>
<td class="description">
Airtime media-monitor service
</td>
<td class="solution <?php if ($mediamonitor) {echo 'check';?>">
<?php
} else {
?>">
Check that the airtime-media-monitor service is installed correctly in <code>/etc/init</code>
and <code>/etc/init.d</code>, and ensure that it's running with
<br/><code>sudo initctl list | grep airtime-media-monitor</code>. If not, try
<br/><code>sudo -u www-data service airtime-media-monitor restart</code>.
(Replace www-data with your web user if necessary)
<?php
}
?>
</td>
</tr>
<tr class="<?=$pypo ? 'success' : 'danger';?>">
<td class="component">
Pypo
</td>
<td class="description">
Airtime playout service
</td>
<td class="solution <?php if ($pypo) {echo 'check';?>">
<?php
} else {
?>">
Check that the airtime-playout service is installed correctly in <code>/etc/init</code>
and <code>/etc/init.d</code>, and ensure that it's running with
<br/><code>sudo initctl list | grep airtime-playout</code>. If not, try
<br/><code>sudo -u www-data service airtime-playout restart</code>.
(Replace www-data with your web user if necessary)
<?php
}
?>
</td>
</tr>
<tr class="<?=$liquidsoap ? 'success' : 'danger';?>">
<td class="component">
Liquidsoap
</td>
<td class="description">
Airtime liquidsoap service
</td>
<td class="solution <?php if ($liquidsoap) {echo 'check';?>">
<?php
} else {
?>">
Check that the airtime-liquidsoap service is installed correctly in <code>/etc/init</code>
and <code>/etc/init.d</code>, and ensure that it's running with
<br/><code>sudo initctl list | grep airtime-liquidsoap</code>. If not, try
<br/><code>sudo -u www-data service airtime-liquidsoap restart</code>.
(Replace www-data with your web user if necessary)
<?php
}
?>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<?php <?php
if (!$result) { if (!$result) {
?> ?>
<br/>
<p> <p>
Looks like something went wrong! If you've tried everything we've recommended in the table above, come Looks like something went wrong! If you've tried everything we've recommended in the table above and are
<a href="https://forum.sourcefabric.org/">visit our forums</a> still experiencing issues, come <a href="https://forum.sourcefabric.org/">visit our forums</a>
or <a href="http://www.sourcefabric.org/en/airtime/manuals/">check out the manual</a>. or <a href="http://www.sourcefabric.org/en/airtime/manuals/">check out the manual</a>.
</p> </p>
<?php <?php
} else { } else {
?> ?>
<p> <p>
Your Airtime station is up and running! Get started by logging in with the default username and password: 'admin'/'admin' Your Airtime station is up and running! Get started by logging in with the default username and password: admin/admin
</p> </p>
<button onclick="location = location.pathname;">Log in to Airtime!</button> <button onclick="location = location.pathname;">Log in to Airtime!</button>
<?php <?php

View File

@ -3,6 +3,10 @@
define("RMQ_INI_SECTION", "rabbitmq"); define("RMQ_INI_SECTION", "rabbitmq");
require_once dirname(dirname( __DIR__)) . '/library/php-amqplib/amqp.inc'; require_once dirname(dirname( __DIR__)) . '/library/php-amqplib/amqp.inc';
function booleanReduce($a, $b) {
return $a && $b;
}
/** /**
* Check to see if Airtime is properly configured. * Check to see if Airtime is properly configured.
* *
@ -10,9 +14,9 @@ require_once dirname(dirname( __DIR__)) . '/library/php-amqplib/amqp.inc';
* properly configured and running * properly configured and running
*/ */
function checkConfiguration() { function checkConfiguration() {
return checkPhpDependencies() $r1 = array_reduce(checkPhpDependencies(), "booleanReduce", true);
&& checkDatabaseConfiguration() $r2 = array_reduce(checkExternalServices(), "booleanReduce", true);
&& checkRMQConnection(); return $r1 && $r2;
} }
/** /**
@ -50,6 +54,22 @@ function checkDatabaseDependencies() {
&& in_array('pgsql', $extensions)); && in_array('pgsql', $extensions));
} }
/**
* Check that all external services are configured correctly and return an associative
* array with the results
*
* @return array associative array of external service check results
*/
function checkExternalServices() {
return array(
"database" => checkDatabaseConfiguration(),
"media-monitor" => checkMediaMonitorService(),
"pypo" => checkPlayoutService(),
"liquidsoap" => checkLiquidsoapService(),
"rabbitmq" => checkRMQConnection()
);
}
/** /**
* Check the database configuration by fetching a connection from Propel * Check the database configuration by fetching a connection from Propel
* *
@ -84,8 +104,6 @@ function checkRMQConnection() {
// Check for airtime.conf in /etc/airtime/ first, then check in the build directory, // Check for airtime.conf in /etc/airtime/ first, then check in the build directory,
if (file_exists(AIRTIME_CONFIG_STOR . AIRTIME_CONFIG)) { if (file_exists(AIRTIME_CONFIG_STOR . AIRTIME_CONFIG)) {
$ini = parse_ini_file(AIRTIME_CONFIG_STOR . AIRTIME_CONFIG, true); $ini = parse_ini_file(AIRTIME_CONFIG_STOR . AIRTIME_CONFIG, true);
} else if (file_exists(BUILD_PATH . AIRTIME_CONFIG)) {
$ini = parse_ini_file(BUILD_PATH . AIRTIME_CONFIG, true);
} else { } else {
$ini = parse_ini_file(BUILD_PATH . "airtime.example.conf", true); $ini = parse_ini_file(BUILD_PATH . "airtime.example.conf", true);
} }
@ -96,4 +114,19 @@ function checkRMQConnection() {
$ini[RMQ_INI_SECTION]["password"], $ini[RMQ_INI_SECTION]["password"],
$ini[RMQ_INI_SECTION]["vhost"]); $ini[RMQ_INI_SECTION]["vhost"]);
return isset($conn); return isset($conn);
}
function checkMediaMonitorService() {
exec("initctl list | grep airtime-media-monitor", $out, $status);
return $status == 0;
}
function checkPlayoutService() {
exec("initctl list | grep airtime-playout", $out, $status);
return $status == 0;
}
function checkLiquidsoapService() {
exec("initctl list | grep airtime-liquidsoap", $out, $status);
return $status == 0;
} }

View File

@ -59,6 +59,5 @@ liquidsoap-plugin-voaacenc
liquidsoap-plugin-vorbis liquidsoap-plugin-vorbis
sourcefabric-keyring sourcefabric-keyring
liquidsoap
silan silan
libopus0 libopus0

View File

@ -41,6 +41,5 @@ libzend-framework-php
coreutils coreutils
liquidsoap
silan silan
libopus0 libopus0