Adding back scripts in /docs

This commit is contained in:
Zachary Klosko 2020-05-19 10:16:31 -04:00
parent bcf938ca7e
commit 6540a34a9b
26 changed files with 336 additions and 94 deletions

View File

@ -165,19 +165,19 @@ $result = $r1 && $r2;
</tr>
<tr class="<?=$analyzer ? 'success' : 'danger';?>">
<td class="component">
Airtime Analyzer
Media Analyzer
</td>
<td class="description">
Airtime Upload and File Analysis service
<?php echo _("LibreTime media analyzer service") ?>
</td>
<td class="solution <?php if ($analyzer) {echo 'check';?>">
<?php
} else {
?>">
Check that the airtime_analyzer service is installed correctly in <code>/etc/init.d</code>,
and ensure that it's running with
<br/><code>initctl list | grep airtime_analyzer</code><br/>
If not, try running <code>sudo service airtime_analyzer start</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 ") ?>
<br/><code>systemctl status libretime-analyzer</code><br/>
<?php echo _("If not, try ") ?><br/><code>sudo systemctl restart libretime-analyzer</code>
<?php
}
?>
@ -188,16 +188,16 @@ $result = $r1 && $r2;
Pypo
</td>
<td class="description">
Airtime playout service
<?php echo _("LibreTime 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.d</code>,
and ensure that it's running with
<br/><code>initctl list | grep airtime-playout</code><br/>
If not, try running <code>sudo service airtime-playout restart</code>
<?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
}
?>
@ -208,16 +208,16 @@ $result = $r1 && $r2;
Liquidsoap
</td>
<td class="description">
Airtime liquidsoap service
<?php echo _("LibreTime liquidsoap service") ?>
</td>
<td class="solution <?php if ($liquidsoap) {echo 'check';?>">
<td class="solution <?php if ($liquidsoap) {echo 'check';?>" >
<?php
} else {
?>">
Check that the airtime-liquidsoap service is installed correctly in <code>/etc/init.d</code>,
and ensure that it's running with
<br/><code>initctl list | grep airtime-liquidsoap</code><br/>
If not, try running <code>sudo service airtime-liquidsoap restart</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 ") ?>
<br/><code>systemctl status libretime-liquidsoap</code><br/>
<?php echo _("If not, try ") ?><br/><code>sudo systemctl restart libretime-liquidsoap</code>
<?php
}
?>
@ -228,16 +228,16 @@ $result = $r1 && $r2;
Celery
</td>
<td class="description">
Airtime Celery Task service
<?php echo _("LibreTime Celery Task service") ?>
</td>
<td class="solution <?php if ($celery) {echo 'check';?>">
<td class="solution <?php if ($celery) {echo 'check';?>" >
<?php
} else {
?>">
Check that the airtime-celery service is installed correctly in <code>/etc/init.d</code>,
and ensure that it's running with
<br/><code>initctl list | grep airtime-celery</code><br/>
If not, try running <code>sudo service airtime-celery restart</code>
<?php echo _("Check that the libretime-celery service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br/><code>systemctl status libretime-celery</code><br/>
<?php echo _("If not, try ") ?><br/><code>sudo systemctl restart libretime-celery</code>
<?php
}
?>

View File

@ -44,7 +44,7 @@
<?php
} else {
?>">
Try running <code>sudo apt-get install php5-pgsql</code>
Try running <code>sudo apt-get install php7-pgsql</code>
<?php
}
?>
@ -101,10 +101,10 @@
<?php
} else {
?>">
<?php echo _("Check that the airtime_analyzer service is installed correctly in ") ?><code>/etc/init</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 ") ?>
<br/><code>initctl list | grep airtime_analyzer</code><br/>
<?php echo _("If not, try ") ?><br/><code>sudo service airtime_analyzer start</code>
<br/><code>systemctl status libretime-analyzer</code><br/>
<?php echo _("If not, try ") ?><br/><code>sudo systemctl restart libretime-analyzer</code>
<?php
}
?>
@ -121,10 +121,10 @@
<?php
} else {
?>">
<?php echo _("Check that the airtime-playout service is installed correctly in ") ?><code>/etc/init</code>,
<?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>initctl list | grep airtime-playout</code><br/>
<?php echo _("If not, try ") ?><br/><code>sudo service airtime-playout restart</code>
<br/><code>systemctl status libretime-playout</code><br/>
<?php echo _("If not, try ") ?><br/><code>sudo systemctl restart libretime-playout</code>
<?php
}
?>
@ -141,17 +141,17 @@
<?php
} else {
?>">
<?php echo _("Check that the airtime-liquidsoap service is installed correctly in ") ?><code>/etc/init</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 ") ?>
<br/><code>initctl list | grep airtime-liquidsoap</code><br/>
<?php echo _("If not, try ") ?><br/><code>sudo service airtime-liquidsoap restart</code>
<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" align="center">
<td class="component">
Celery
</td>
<td class="description">
@ -161,10 +161,10 @@
<?php
} else {
?>">
<?php echo _("Check that the airtime-celery service is installed correctly in ") ?><code>/etc/init</code>,
<?php echo _("Check that the libretime-celery service is installed correctly in ") ?><code>/etc/systemd/system/</code>,
<?php echo _(" and ensure that it's running with ") ?>
<br/><code>initctl list | grep airtime-celery</code><br/>
<?php echo _("If not, try ") ?><br/><code>sudo service airtime-celery restart</code>
<br/><code>systemctl status libretime-celery</code><br/>
<?php echo _("If not, try ") ?><br/><code>sudo systemctl restart libretime-celery</code>
<?php
}
?>

View File

@ -2,18 +2,18 @@
?>
<form action="#" role="form" id="finishSettingsForm">
<h3 class="form-title">Manual Step: Start Airtime Services</h3>
<h3 class="form-title">Manual Step: Start Libretime Services</h3>
<span id="helpBlock" class="help-block help-message"></span>
<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 service airtime-playout start
sudo service airtime-liquidsoap start
sudo service airtime_analyzer start
sudo service airtime-celery start</pre>
<pre style="text-align: left">sudo systemctl start libretime-playout
sudo systemctl start libretime-liquidsoap
sudo systemctl start libretime-analyzer
sudo systemctl start libretime-celery</pre>
<p>
Click "Done!" to bring up the Airtime configuration checklist; if your configuration is all green,
you're ready to get started with your personal Airtime station!
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!
</p>
<p>
If you need to re-run the web installer, just remove <code>/etc/airtime/airtime.conf</code>.
@ -28,4 +28,4 @@ sudo service airtime-celery start</pre>
e.preventDefault();
window.location.assign("/?config");
});
</script>
</script>

View File

@ -19,6 +19,21 @@
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<input class="form-control" type="hidden" name="generalErr" id="generalErr" aria-describedby="helpBlock"/>
<p>The CORS URL can be setup during install if you are accessing your LibreTime instance behind a Proxy.
This is common with docker setups. If you have a reverse proxy setup enter the URL below, otherwise you
can safely ignore this. Please enter one URL per line. Include the entire URL such as http://example.com
If you are reinstalling LibreTime on an existing setup you can ignore this as well,
the settings in your existing database will be retained unless you enter new values below.
</p>
<div id="corsSlideToggle">
<span><strong>CORS URL </strong></span><span id="corsCaret" class="caret"></span><hr/>
</div>
<div id="corsFormBody">
<div class="form-group">
<label class="control-label" for="corsUrl">CORS URLs</label>
<textarea name="corsUrl" class="form-control" id="corsUrl" rows="4" cols="50"></textarea>
</div>
</div>
</div>
<div>
<input type="submit" formtarget="generalSettingsForm" class="btn btn-primary btn-next" value="Next &#10097;"/>
@ -27,6 +42,10 @@
</form>
<script>
$("#corsSlideToggle").click(function() {
$("#corsFormBody").slideToggle(500);
$("#corsCaret").toggleClass("caret-up");
});
$("#generalSettingsForm").submit(function(e) {
submitForm(e, "GeneralSetup");
});

View File

@ -16,7 +16,9 @@
<p>
In either case, we recommend that you change at least the default password provided -
you can do this by running the following line from the command line:<br/>
<code>sudo rabbitmqctl change_password &lt;username&gt; &lt;newpassword&gt;</code>
<code>sudo rabbitmqctl change_password &lt;username&gt; &lt;newpassword&gt;</code><br/>
<strong>Notice:</strong> using special characters such as ! in your rabbitmq password will cause LibreTime to fail
to load properly after setup. Please use alphanumerical characters only.
</p>
<div id="rmqSlideToggle">
<span><strong>Advanced </strong></span><span id="advCaret" class="caret"></span><hr/>

View File

@ -45,7 +45,7 @@ function checkDatabaseDependencies() {
/**
* 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() {
@ -88,7 +88,7 @@ function configureDatabase() {
/**
* Check that we can connect to RabbitMQ
*
*
* @return true if the RabbitMQ connection can be established
*/
function checkRMQConnection() {
@ -109,7 +109,7 @@ function checkRMQConnection() {
/**
* Check if airtime-analyzer is currently running
*
*
* @return boolean true if airtime-analyzer is running
*/
function checkAnalyzerService() {
@ -122,7 +122,7 @@ function checkAnalyzerService() {
/**
* Check if airtime-playout is currently running
*
*
* @return boolean true if airtime-playout is running
*/
function checkPlayoutService() {
@ -135,7 +135,7 @@ function checkPlayoutService() {
/**
* Check if airtime-liquidsoap is currently running
*
*
* @return boolean true if airtime-liquidsoap is running
*/
function checkLiquidsoapService() {
@ -148,7 +148,7 @@ function checkLiquidsoapService() {
/**
* Check if airtime-celery is currently running
*
*
* @return boolean true if airtime-celery is running
*/
function checkCeleryService() {

View File

@ -13,7 +13,7 @@
<body>
<div class="header">
<h3 class="logo">
<img src="css/images/airtime_logo_jp.png" id="airtimeLogo" /><br/>
<img src="css/images/libretime_logo_jp.png" id="LibreTimeLogo" /><br/>
<strong>Setup</strong>
</h3>
<strong>Step <span id="stepCount">1</span> of 5</strong>

View File

@ -5211,24 +5211,24 @@ msgid "LibreTime Celery Task service"
msgstr "Служба Celery Task LibreTime"
#: airtime_mvc\application\views\scripts\systemstatus\index.phtml:104
msgid "Check that the airtime_analyzer service is installed correctly in "
msgstr "Проверьте, что служба airtime_analyzer правильно установлена в "
msgid "Check that the libretime-analyzer service is installed correctly in "
msgstr "Проверьте, что служба libretime-analyzer правильно установлена в "
#: airtime_mvc\application\views\scripts\systemstatus\index.phtml:124
msgid "Check that the airtime-playout service is installed correctly in "
msgstr "Проверьте, что служба airtime-playout правильно установлена в "
msgid "Check that the libretime-playout service is installed correctly in "
msgstr "Проверьте, что служба libretime-playout правильно установлена в "
#: airtime_mvc\application\views\scripts\systemstatus\index.phtml:144
msgid "Check that the airtime-liquidsoap service is installed correctly in "
msgstr "Проверьте, что служба airtime-liquidsoap правильно установлена в "
msgid "Check that the libretime-liquidsoap service is installed correctly in "
msgstr "Проверьте, что служба libretime-liquidsoap правильно установлена в "
#: airtime_mvc\application\views\scripts\systemstatus\index.phtml:164
msgid "Check that the airtime-celery service is installed correctly in "
msgstr "Проверьте, что служба airtime-celery правильно установлена в "
msgid "Check that the libretime-celery service is installed correctly in "
msgstr "Проверьте, что служба libretime-celery правильно установлена в "
#: airtime_mvc\application\views\scripts\systemstatus\index.phtml:158
msgid " If not, try <br/><code>sudo service airtime-celery restart</code>"
msgstr " Если нет - попробуйте запустить <br/><code>sudo service airtime-celery restart</code>"
msgid " If not, try <br/><code>sudo service libretime-celery restart</code>"
msgstr " Если нет - попробуйте запустить <br/><code>sudo service libretime-celery restart</code>"
#: airtime_mvc\application\views\scripts\systemstatus\index.phtml:164
msgid " and ensure that it's running with "

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@ -87,6 +87,7 @@ function formSlide(dir) {
steps = parseInt(stepCount.html());
stepCount.html((dir == "next") ? (steps + 1) : (steps - 1));
hideRMQForm();
hideCORSForm();
}
/**
@ -112,11 +113,21 @@ function hideRMQForm() {
$("#advCaret").removeClass("caret-up");
}
/**
* Hide the RMQ form when the slider is called to avoid showing
* scrollbars on slider panels that fit vertically
*/
function hideCORSForm() {
$("#corsFormBody").slideUp(500);
$("#corsCaret").removeClass("caret-up");
}
function submitForm(e, obj) {
resetFeedback();
e.preventDefault();
var d = $(e.target).serializeArray();
addOverlay();
$(".viewport").scrollTop(0);
// Append .promise().done() rather than using a
// callback to avoid call duplication
$("#overlay, #loadingImage").fadeIn(500).promise().done(function() {

View File

@ -1,5 +1,18 @@
<?php
define("CONFIG_PATH", dirname(dirname( __DIR__)) . "/application/configs/");
require_once(dirname(dirname( __DIR__)) . "/../vendor/propel/propel1/runtime/lib/Propel.php");
require_once(CONFIG_PATH . 'conf.php');
require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/CcPref.php");
require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/CcPrefPeer.php");
require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/CcPrefQuery.php");
require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/map/CcPrefTableMap.php");
require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/om/BaseCcPref.php");
require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/om/BaseCcPrefPeer.php");
require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/om/BaseCcPrefQuery.php");
/**
* User: sourcefabric
* Date: 08/12/14
@ -9,16 +22,18 @@
* Wrapper class for validating and setting up general settings during the installation process
*/
class GeneralSetup extends Setup {
// airtime.conf section header
protected static $_section = "[general]";
// Array of key->value pairs for airtime.conf
protected static $_properties;
// Constant form field names for passing errors back to the front-end
const GENERAL_PORT = "generalPort",
GENERAL_HOST = "generalHost";
const CORS_URL = "corsUrl";
// Array of key->value pairs for airtime.conf
protected static $_properties;
static $cors_url;
// Message and error fields to return to the front-end
static $message = null;
@ -30,7 +45,10 @@ class GeneralSetup extends Setup {
"api_key" => $this->generateRandomString(),
"base_url" => $settings[self::GENERAL_HOST],
"base_port" => $settings[self::GENERAL_PORT],
"cors_url" => $settings[self::CORS_URL]
);
self::$cors_url = $settings[self::CORS_URL];
}
/**
@ -42,11 +60,43 @@ class GeneralSetup extends Setup {
if (count(self::$errors) <= 0) {
$this->writeToTemp();
}
if (strlen(self::$cors_url) == 0) {
}
else {
$this->setupCorsUrl();
}
return array(
"message" => self::$message,
"errors" => self::$errors
);
}
/**
* If the user entered a CORS Url then add it to the system preferences
* TODO Make sure we check for existing CORS URLs and display them on initial form
*/
function setupCorsUrl() {
try {
$_SERVER['AIRTIME_CONF'] = AIRTIME_CONF_TEMP_PATH;
Propel::init(CONFIG_PATH . "airtime-conf-production.php");
$con = Propel::getConnection();
} catch(Exception $e) {
self::$message = "Failed to insert Cors URL; database isn't configured properly!";
self::$errors[] = self::CORS_URL;
return;
}
$this->runCorsUrlQuery($con);
}
function runCorsUrlQuery($con) {
try {
Application_Model_Preference::SetAllowedCorsUrls(self::$cors_url);
Propel::close();
//unset($_SERVER['AIRTIME_CONF']);
} catch (Exception $e) {
self::$message = "Failed to insert " . self::$cors_url . " into cc_pref" . $e;
self::$errors[] = self::CORS_URL;
}
}
}

View File

@ -0,0 +1,117 @@
# Reverse Proxy Connections
In some deployments, the LibreTime server is deployed behind a reverse proxy,
for example in containerization use-cases such as Docker and LXC. LibreTime
makes extensive use of its API for some site functionality, which causes
[Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
to occur. By default, CORS requests are blocked by your browser and the origins
need to be added to the **Allowed CORS URLs** block in
[**General Settings**](/manual/general/). These origins should include any
domains that will be used externally to connect to your reverse proxy that you
want handled by LibreTime. These URLS can also be set during the first run configuration
that is displayed when you first install LibreTime
## Reverse Proxy Basics
A reverse proxy allows the LibreTime server to not be connected to the open internet. In
this configuration, it is rather behind another server that proxies traffic to it from
users. This provides some advantages in the containerization space, as this means that
the containers can be on their own internal network, protected from outside access.
A reverse proxy also allows SSL to be terminated in a single location for multiple sites.
This means that all your traffic to the proxy from clients is encrypted, but the reverse
proxy's traffic to the containers on the internal network is not. All the SSL certificates
live on the reverse proxy and can be renewed there instead of on the individual
containers.
## Setup
There are known bugs when using LibreTime behind a reverse proxy ([#957](https://github.com/LibreTime/libretime/issues/957)
tracks the issue and contains a temporary workaround). For SSL redirection to work, you
need two domains: one for LibreTime and one for Icecast. Here, these will be
`libretime.example.com` and `icecast.example.com`.
You will also require two VMs, servers or containers. Alternatively the reverse proxy can
be located on the server, proxying connections to containers also on the host. Setting up
a containerization environment is beyond the scope of this guide. It assumes that you have
Nginx set up on `proxy` and LibreTime will be installed on `libretime`. You will need root
access on both. `libretime` also needs to be able to be accessed from `proxy`
(`ping libretime` on `proxy`).
On `libretime`, install LibreTime as described in the [install guide](/install/). In short
this means run the following commands:
```
git clone https://github.com/LibreTime/libretime.git
cd libretime
sudo ./install -fiap
```
Once it has installed, replace `<hostname>localhost</hostname>` in
`/etc/icecast2/icecast.xml` with the following:
```
<hostname>icecast.example.com</hostname>
```
This is the hostname that people listening to your stream will connect to and what
LibreTime will use to stream out to them. You will then need to restart Icecast:
```
sudo systemctl restart icecast2
```
On `proxy`, run the following:
```
cat << EOF | sudo tee /etc/nginx/sites-available/libretime.conf
server {
listen 80;
server_name libretime.example.com;
location / {
rewrite ^ https://$server_name$request_uri? permanent;
}
}
server {
listen 443 ssl;
server_name libretime.example.com;
ssl_certificate /etc/letsencrypt/live/libretime.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/libretime.example.com/privkey.pem;
add_header Strict-Transport-Security "max-age=15552000;";
add_header X-Frame-Options "SAMEORIGIN";
client_max_body_size 512M;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://libretime/;
}
}
EOF
```
This Nginx configuration ensures that all traffic uses SSL to the reverse proxy, and
traffic is proxied to `libretime`.
Next, the SSL certificate needs to be generated and the site activated.
```
sudo apt install certbot
sudo systemctl stop nginx
sudo certbot certonly -d libretime.example.com -a standalone
sudo systemctl start nginx
```
You can now go to [https://libretime.example.com](https://libretime.example.com) and go
through the installer. On `General Settings`, you need to change the Webserver Port to
`443` and add the following CORS URLs:
```
https://libretime.example.com
http://libretime.example.com
https://localhost
http://localhost
```

8
docs/scripts/install.sh Normal file
View File

@ -0,0 +1,8 @@
#! /bin/sh
echo "Updating Apt."
apt-get update > /dev/null
echo "Ensuring Pip is installed."
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq python3-pip > /dev/null
echo "Ensuring Mkdocs is installed."
pip3 install mkdocs

10
docs/scripts/serve.sh Normal file
View File

@ -0,0 +1,10 @@
#! /bin/sh
cd /vagrant
echo "Stopping any running Mkdocs servers."
pkill mkdocs
echo "Building Mkdocs documentation."
mkdocs build --clean -q > /dev/null
echo "Launching Mkdocs server."
mkdocs serve > /dev/null 2>&1 &
echo "Visit http://localhost:8888 to see the LibreTime documentation."

67
install
View File

@ -180,14 +180,29 @@ function systemInitInstall() {
local source_base_path=""
local source_path=""
local target_path=""
local alt_path=""
local source_config_path=""
local target_config_path=""
local python_source_path="${SCRIPT_DIR-$PWD}/python_apps"
verbose "\n * Installing service $service_name ..."
if $has_systemd_init; then
# TODO: move .service files under python_apps/.../install/systemd
source_path="${SCRIPT_DIR-$PWD}/installer/systemd/${service_name}.service"
target_path="/etc/systemd/system/${service_name}.service"
case "$service_name" in
libretime-analyzer)
source_path="${python_source_path}/airtime_analyzer/install/systemd/${service_name}.service"
target_path="/etc/systemd/system/${service_name}.service"
alt_path=$(echo $target_path | sed 's/libretime-/airtime_/')
;;
libretime-celery)
source_path="${python_source_path}/airtime-celery/install/systemd/${service_name}.service"
target_path="/etc/systemd/system/${service_name}.service"
alt_path=$(echo $target_path | sed 's/libretime-/airtime-/')
;;
libretime-liquidsoap|libretime-playout)
source_path="${python_source_path}/pypo/install/systemd/${service_name}.service"
target_path="/etc/systemd/system/${service_name}.service"
alt_path=$(echo $target_path | sed 's/libretime-/airtime-/')
;;
esac
if [[ ! -e $source_path ]]; then
echo "$0:${FUNCNAME}(): ERROR: service \"$service_name\" with source path \"$source_path\" does not exist!" >&2
exit 1
@ -198,6 +213,16 @@ function systemInitInstall() {
loudCmd "systemctl disable ${service_name}.service"
loudCmd "systemctl stop ${service_name}.service"
fi
local old_style_unit_exists="f"
# Migrate old style airtime unit exist if it exists
if [[ -e $alt_path && ! -L $alt_path ]]; then
local old_service=$(echo $service_name | sed 's/libretime/airtime/' | sed 's/-analyzer/_analyzer/')
verbose "Old service $old_service already exists - migrating."
loudCmd "systemctl disable ${old_service}.service"
loudCmd "systemctl stop ${old_service}.service"
loudCmd "rm $alt_path"
old_style_unit_exists="t"
fi
# If no user defined, then just copy, otherwise filter
if [[ -z $user ]]; then
loudCmd "cp $source_path $target_path"
@ -205,6 +230,11 @@ function systemInitInstall() {
sed -e "s/User=.*/User=${user}/" \
-e "s/Group=.*/Group=${user}/" $source_path > $target_path
fi
if [[ $old_style_unit_exists == "t" ]]; then
verbose "Maintaining compatibility with old systemd unit names"
# Alias to old Airtime names
loudCmd "ln -s $source_path $alt_path"
fi
chmod 0644 $target_path
chown root:root $target_path
verbose "Service ${service_name} installed into ${target_path}"
@ -213,17 +243,17 @@ function systemInitInstall() {
verbose "Service ${service_name} enabled and started"
elif $has_upstart_init; then
case "$service_name" in
airtime_analyzer)
source_path="${python_source_path}/${service_name}/install/upstart/${service_name}.conf"
libretime-analyzer)
source_path="${python_source_path}/airtime_analyzer/install/upstart/${service_name}.conf"
target_path="/etc/init/${service_name}.conf"
user=${user:-$web_user}
;;
airtime-celery)
source_path="${python_source_path}/${service_name}/install/upstart/${service_name}.conf"
libretime-celery)
source_path="${python_source_path}/airtime-celery/install/upstart/${service_name}.conf"
target_path="/etc/init/${service_name}.conf"
user=""
;;
airtime-liquidsoap|airtime-playout)
libretime-liquidsoap|libretime-playout)
source_path="${python_source_path}/pypo/install/upstart/${service_name}.conf.template"
target_path="/etc/init/${service_name}.conf"
user=${user:-$web_user}
@ -251,19 +281,19 @@ function systemInitInstall() {
loudCmd "initctl check-config $service_name"
elif $has_systemv_init; then
case "$service_name" in
airtime_analyzer)
source_path="${python_source_path}/${service_name}/install/sysvinit/${service_name}"
libretime-analyzer)
source_path="${python_source_path}/airtime_analyzer/install/sysvinit/${service_name}"
target_path="/etc/init.d/${service_name}"
user=${user:-$web_user}
;;
airtime-celery)
source_path="${python_source_path}/${service_name}/install/initd/${service_name}"
libretime-celery)
source_path="${python_source_path}/airtime-celery/install/sysvinit/${service_name}"
target_path="/etc/init.d/${service_name}"
source_config_path="${python_source_path}/${service_name}/install/conf/${service_name}"
target_config_path="/etc/default/${service_name}"
user=""
;;
airtime-liquidsoap|airtime-playout)
libretime-liquidsoap|libretime-playout)
source_path="${python_source_path}/pypo/install/sysvinit/${service_name}"
target_path="/etc/init.d/${service_name}"
user=${user:-$web_user}
@ -763,7 +793,6 @@ will be moved to /etc/airtime/airtime.conf.tmp"
rm -f /etc/init.d/airtime*
rm -f /etc/init/airtime*
rm -f /etc/default/airtime-celery
rm -f /etc/systemd/system/airtime*
if [ "$apache" = "t" ]; then
# If the user selects an "in-place" install or passes in a web root,
@ -957,8 +986,8 @@ verbose "\n * Installing pypo and liquidsoap..."
loudCmd "python3 ${AIRTIMEROOT}/python_apps/pypo/setup.py install --install-scripts=/usr/bin --no-init-script"
loudCmd "mkdir -p /var/log/airtime/{pypo,pypo-liquidsoap} /var/tmp/airtime/pypo/{cache,files,tmp} /var/tmp/airtime/show-recorder/"
loudCmd "chown -R ${web_user}:${web_user} /var/log/airtime/{pypo,pypo-liquidsoap} /var/tmp/airtime/pypo/{cache,files,tmp} /var/tmp/airtime/show-recorder/"
systemInitInstall airtime-liquidsoap $web_user
systemInitInstall airtime-playout $web_user
systemInitInstall libretime-liquidsoap $web_user
systemInitInstall libretime-playout $web_user
verbose "...Done"
verbose "\n * Installing airtime-celery..."
@ -971,15 +1000,15 @@ else
fi
# Add celery to the www-data group
loudCmd "usermod -G ${web_user} -a celery"
# CentOS installs celery in /usr/bin which differs from other distros. Make
# CentOS installs celery in /usr/bin which differs from other distros. Make
# available in /usr/local/bin as systemd requires an absolute path.
[[ ! -e /usr/local/bin/celery ]] && ln -s /usr/bin/celery /usr/local/bin/celery
systemInitInstall airtime-celery
systemInitInstall libretime-celery
verbose "...Done"
verbose "\n * Installing airtime_analyzer..."
loudCmd "python3 ${AIRTIMEROOT}/python_apps/airtime_analyzer/setup.py install --install-scripts=/usr/bin --no-init-script"
systemInitInstall airtime_analyzer $web_user
systemInitInstall libretime-analyzer $web_user
verbose "...Done"
verbose "\n * Setting permissions on /var/log/airtime..."

View File

@ -3,8 +3,8 @@ Description=LibreTime Media Analyzer Service
[Service]
ExecStart=/usr/bin/airtime_analyzer
User=airtime-analyzer
Group=airtime-analyzer
User=libretime-analyzer
Group=libretime-analyzer
Restart=always
[Install]

View File

@ -1,5 +1,5 @@
[Unit]
Description=Airtime Liquidsoap Service
Description=Libretime Liquidsoap Service
[Service]
ExecStart=/usr/bin/airtime-liquidsoap

View File

@ -1,5 +1,5 @@
[Unit]
Description=Airtime Playout Service
Description=Libretime Playout Service
After=network-online.target
[Service]

View File

@ -14,7 +14,3 @@ pushd python_apps/api_clients
pip3 install -e .
nosetests
popd
echo "Building docs..."
mkdocs build --clean -q > /dev/null
echo -n "done"