add API v2
This commit is contained in:
parent
f809c3a8ff
commit
2df0189a90
71 changed files with 2740 additions and 315 deletions
|
@ -18,6 +18,7 @@ $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);
|
||||
|
@ -29,14 +30,14 @@ $result = $r1 && $r2;
|
|||
<link rel="stylesheet" type="text/css" href="css/setup/config-check.css">
|
||||
</head>
|
||||
<style>
|
||||
/*
|
||||
This is here because we're using the config-check css for
|
||||
/*
|
||||
This is here because we're using the config-check css for
|
||||
both this page and the system status page
|
||||
*/
|
||||
html {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
padding: 2em;
|
||||
min-width: 600px;
|
||||
|
@ -156,7 +157,7 @@ $result = $r1 && $r2;
|
|||
?>">
|
||||
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
|
||||
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-pypo and airtime-uploads.
|
||||
<?php
|
||||
}
|
||||
|
@ -243,6 +244,26 @@ $result = $r1 && $r2;
|
|||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="<?=$api ? 'success' : 'danger';?>">
|
||||
<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/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
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
$liquidsoap = $externalServices["liquidsoap"];
|
||||
$analyzer = $externalServices["analyzer"];
|
||||
$celery = $externalServices['celery'];
|
||||
$api = $externalServices['api'];
|
||||
|
||||
$r1 = array_reduce($phpDependencies, "booleanReduce", true);
|
||||
$r2 = array_reduce($externalServices, "booleanReduce", true);
|
||||
|
@ -170,6 +171,26 @@
|
|||
?>
|
||||
</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
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tr id="partitions" class="even">
|
||||
<th colspan="5"><?php echo _("Disk Space") ?></th>
|
||||
|
|
|
@ -7,10 +7,11 @@
|
|||
<p>
|
||||
Looks like you're almost done! As a final step, please run the following commands from the terminal:
|
||||
</p>
|
||||
<pre style="text-align: left">sudo systemctl start libretime-playout
|
||||
<pre style="text-align: left">sudo systemctl start libretime-analyzer
|
||||
sudo systemctl start libretime-api
|
||||
sudo systemctl start libretime-celery
|
||||
sudo systemctl start libretime-liquidsoap
|
||||
sudo systemctl start libretime-analyzer
|
||||
sudo systemctl start libretime-celery</pre>
|
||||
sudo systemctl start libretime-playout</pre
|
||||
<p>
|
||||
Click "Done!" to bring up the Libretime configuration checklist; if your configuration is all green,
|
||||
you're ready to get started with your personal Libretime station!
|
||||
|
|
|
@ -56,6 +56,7 @@ function checkExternalServices() {
|
|||
"liquidsoap" => checkLiquidsoapService(),
|
||||
"rabbitmq" => checkRMQConnection(),
|
||||
"celery" => checkCeleryService(),
|
||||
"api" => checkApiService(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -158,3 +159,16 @@ function checkCeleryService() {
|
|||
}
|
||||
return $status == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if libretime-api is currently running
|
||||
*
|
||||
* @return boolean true if libretime-api is running
|
||||
*/
|
||||
function checkApiService() {
|
||||
exec("pgrep -f -u www-data uwsgi", $out, $status);
|
||||
if (array_key_exists(0, $out) && $status == 0) {
|
||||
return 1;
|
||||
}
|
||||
return $status == 0;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* Wrapper class for validating and installing the Airtime database during the installation process
|
||||
*/
|
||||
class DatabaseSetup extends Setup {
|
||||
|
||||
|
||||
// airtime.conf section header
|
||||
protected static $_section = "[database]";
|
||||
|
||||
|
@ -80,6 +80,7 @@ class DatabaseSetup extends Setup {
|
|||
$this->checkSchemaExists();
|
||||
$this->createDatabaseTables();
|
||||
$this->updateIcecastPassword();
|
||||
$this->updateDjangoTables();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -190,7 +191,7 @@ class DatabaseSetup extends Setup {
|
|||
$statement = self::$dbh->prepare("UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's1_pass'");
|
||||
$statement->bindValue(':icecastpass', $icecast_pass, PDO::PARAM_STR);
|
||||
try {
|
||||
$statement->execute();
|
||||
$statement->execute();
|
||||
}
|
||||
catch (PDOException $ex) {
|
||||
print "Error!: " . $ex->getMessage() . "<br />";
|
||||
|
@ -198,7 +199,7 @@ class DatabaseSetup extends Setup {
|
|||
$statement = self::$dbh->prepare("UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's1_admin_pass'");
|
||||
$statement->bindValue(':icecastpass', $icecast_pass, PDO::PARAM_STR);
|
||||
try {
|
||||
$statement->execute();
|
||||
$statement->execute();
|
||||
}
|
||||
catch (PDOException $ex) {
|
||||
print "Error!: " . $ex->getMessage() . "<br />";
|
||||
|
@ -206,7 +207,7 @@ class DatabaseSetup extends Setup {
|
|||
$statement = self::$dbh->prepare("UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's2_pass'");
|
||||
$statement->bindValue(':icecastpass', $icecast_pass, PDO::PARAM_STR);
|
||||
try {
|
||||
$statement->execute();
|
||||
$statement->execute();
|
||||
}
|
||||
catch (PDOException $ex) {
|
||||
print "Error!: " . $ex->getMessage() . "<br />";
|
||||
|
@ -214,7 +215,7 @@ class DatabaseSetup extends Setup {
|
|||
$statement = self::$dbh->prepare("UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's2_admin_pass'");
|
||||
$statement->bindValue(':icecastpass', $icecast_pass, PDO::PARAM_STR);
|
||||
try {
|
||||
$statement->execute();
|
||||
$statement->execute();
|
||||
}
|
||||
catch (PDOException $ex) {
|
||||
print "Error!: " . $ex->getMessage() . "<br />";
|
||||
|
@ -223,7 +224,7 @@ class DatabaseSetup extends Setup {
|
|||
$statement = self::$dbh->prepare("UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's3_pass'");
|
||||
$statement->bindValue(':icecastpass', $icecast_pass, PDO::PARAM_STR);
|
||||
try {
|
||||
$statement->execute();
|
||||
$statement->execute();
|
||||
}
|
||||
catch (PDOException $ex) {
|
||||
print "Error!: " . $ex->getMessage() . "<br />";
|
||||
|
@ -231,7 +232,7 @@ class DatabaseSetup extends Setup {
|
|||
$statement = self::$dbh->prepare("UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's3_admin_pass'");
|
||||
$statement->bindValue(':icecastpass', $icecast_pass, PDO::PARAM_STR);
|
||||
try {
|
||||
$statement->execute();
|
||||
$statement->execute();
|
||||
}
|
||||
catch (PDOException $ex) {
|
||||
print "Error!: " . $ex->getMessage() . "<br />";
|
||||
|
@ -239,7 +240,7 @@ class DatabaseSetup extends Setup {
|
|||
$statement = self::$dbh->prepare("UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's1_admin_pass'");
|
||||
$statement->bindValue(':icecastpass', $icecast_pass, PDO::PARAM_STR);
|
||||
try {
|
||||
$statement->execute();
|
||||
$statement->execute();
|
||||
}
|
||||
catch (PDOException $ex) {
|
||||
print "Error!: " . $ex->getMessage() . "<br />";
|
||||
|
@ -247,11 +248,17 @@ class DatabaseSetup extends Setup {
|
|||
$statement = self::$dbh->prepare("INSERT INTO cc_pref (keystr, valstr) VALUES ('default_icecast_password', :icecastpass )");
|
||||
$statement->bindValue(':icecastpass', $icecast_pass, PDO::PARAM_STR);
|
||||
try {
|
||||
$statement->execute();
|
||||
$statement->execute();
|
||||
}
|
||||
catch (PDOException $ex) {
|
||||
print "Error!: " . $ex->getMessage() . "<br />";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the Django related tables for the API
|
||||
*/
|
||||
private function updateDjangoTables() {
|
||||
shell_exec('LIBRETIME_CONF_FILE=/etc/airtime/airtime.conf.temp libretime-api migrate');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue