feat: remove php web installer
This commit is contained in:
parent
eb8e7b3415
commit
0d16960887
15 changed files with 7 additions and 1063 deletions
174
legacy/application/check.php
Normal file
174
legacy/application/check.php
Normal file
|
@ -0,0 +1,174 @@
|
|||
<?php
|
||||
|
||||
function booleanReduce($a, $b)
|
||||
{
|
||||
return $a && $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if Airtime is properly configured.
|
||||
*
|
||||
* @return bool true if all Airtime dependencies and services are
|
||||
* properly configured and running
|
||||
*/
|
||||
function checkConfiguration()
|
||||
{
|
||||
$r1 = array_reduce(checkPhpDependencies(), 'booleanReduce', true);
|
||||
$r2 = array_reduce(checkExternalServices(), 'booleanReduce', true);
|
||||
|
||||
return $r1 && $r2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for Airtime's PHP dependencies and return an associative
|
||||
* array with the results.
|
||||
*
|
||||
* @return array associative array of dependency check results
|
||||
*/
|
||||
function checkPhpDependencies()
|
||||
{
|
||||
return [
|
||||
'postgres' => checkDatabaseDependencies(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the PHP dependencies for the database exist.
|
||||
*
|
||||
* @return bool true if the database dependencies exist
|
||||
*/
|
||||
function checkDatabaseDependencies()
|
||||
{
|
||||
global $extensions;
|
||||
// Check the PHP extension list for the Postgres db extensions
|
||||
return in_array('pdo_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 [
|
||||
'database' => checkDatabaseConfiguration(),
|
||||
'analyzer' => checkAnalyzerService(),
|
||||
'pypo' => checkPlayoutService(),
|
||||
'liquidsoap' => checkLiquidsoapService(),
|
||||
'rabbitmq' => checkRMQConnection(),
|
||||
'celery' => checkCeleryService(),
|
||||
'api' => checkApiService(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the database configuration by fetching a connection from Propel.
|
||||
*
|
||||
* @return bool true if a connection is made to the database
|
||||
*/
|
||||
function checkDatabaseConfiguration()
|
||||
{
|
||||
configureDatabase();
|
||||
|
||||
try {
|
||||
// Try to establish a database connection. If something goes
|
||||
// wrong, the database is improperly configured
|
||||
Propel::getConnection();
|
||||
Propel::close();
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize Propel to configure the Airtime database.
|
||||
*/
|
||||
function configureDatabase()
|
||||
{
|
||||
Propel::init(PROPEL_CONFIG_FILEPATH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that we can connect to RabbitMQ.
|
||||
*
|
||||
* @return true if the RabbitMQ connection can be established
|
||||
*/
|
||||
function checkRMQConnection()
|
||||
{
|
||||
$config = Config::getConfig();
|
||||
|
||||
$conn = new \PhpAmqpLib\Connection\AMQPStreamConnection(
|
||||
$config['rabbitmq']['host'],
|
||||
$config['rabbitmq']['port'],
|
||||
$config['rabbitmq']['user'],
|
||||
$config['rabbitmq']['password'],
|
||||
$config['rabbitmq']['vhost']
|
||||
);
|
||||
|
||||
return isset($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if airtime-analyzer is currently running.
|
||||
*
|
||||
* @return bool true if airtime-analyzer is running
|
||||
*/
|
||||
function checkAnalyzerService()
|
||||
{
|
||||
exec('systemctl is-active libretime-analyzer --quiet', $out, $status);
|
||||
|
||||
return $status == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if libretime-playout is currently running.
|
||||
*
|
||||
* @return bool true if libretime-playout is running
|
||||
*/
|
||||
function checkPlayoutService()
|
||||
{
|
||||
exec('systemctl is-active libretime-playout --quiet', $out, $status);
|
||||
|
||||
return $status == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if libretime-liquidsoap is currently running.
|
||||
*
|
||||
* @return bool true if libretime-liquidsoap is running
|
||||
*/
|
||||
function checkLiquidsoapService()
|
||||
{
|
||||
exec('systemctl is-active libretime-liquidsoap --quiet', $out, $status);
|
||||
|
||||
return $status == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if libretime-celery is currently running.
|
||||
*
|
||||
* @return bool true if libretime-celery is running
|
||||
*/
|
||||
function checkCeleryService()
|
||||
{
|
||||
exec('systemctl is-active libretime-celery --quiet', $out, $status);
|
||||
|
||||
return $status == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if libretime-api is currently running.
|
||||
*
|
||||
* @return bool true if libretime-api is running
|
||||
*/
|
||||
function checkApiService()
|
||||
{
|
||||
exec('systemctl status libretime-api --quiet', $out, $status);
|
||||
|
||||
return $status == 0;
|
||||
}
|
|
@ -4,7 +4,6 @@
|
|||
define('ROOT_PATH', dirname(__DIR__, 2));
|
||||
define('LIB_PATH', ROOT_PATH . '/library');
|
||||
define('BUILD_PATH', ROOT_PATH . '/build');
|
||||
define('SETUP_PATH', BUILD_PATH . '/airtime-setup');
|
||||
define('APPLICATION_PATH', ROOT_PATH . '/application');
|
||||
define('CONFIG_PATH', APPLICATION_PATH . '/configs');
|
||||
define('VENDOR_PATH', ROOT_PATH . '/vendor');
|
||||
|
@ -24,10 +23,6 @@ define('LIBRETIME_CONFIG_DIR', getenv('LIBRETIME_CONFIG_DIR') ?: '/etc/libretime
|
|||
define('LIBRETIME_CONF_DIR', LIBRETIME_CONFIG_DIR); // Deprecated
|
||||
define('LIBRETIME_CONFIG_FILEPATH', getenv('LIBRETIME_CONFIG_FILEPATH') ?: LIBRETIME_CONFIG_DIR . '/config.yml');
|
||||
|
||||
// Installer
|
||||
define('INSTALLER_CONFIG_FILEPATH', LIBRETIME_CONFIG_DIR . '/airtime.temp.conf');
|
||||
define('INSTALLER_DEFAULT_STORAGE_PATH', '/srv/airtime/stor');
|
||||
|
||||
// Legacy constants
|
||||
define('PRODUCT_NAME', 'LibreTime');
|
||||
define('PRODUCT_SITE_URL', 'http://libretime.org');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue