Initial work on monitless installation
This commit is contained in:
parent
ecb43c2587
commit
4dfd49d12c
|
@ -1,2 +1,3 @@
|
||||||
.*
|
.*
|
||||||
*.pyc
|
*.pyc
|
||||||
|
*~
|
||||||
|
|
7
README
7
README
|
@ -42,15 +42,18 @@ For an interactive installation, run:
|
||||||
|
|
||||||
The installer will then prompt you about how you want to set up your Airtime installation.
|
The installer will then prompt you about how you want to set up your Airtime installation.
|
||||||
|
|
||||||
For a simple full installation (setting up apache and postgres configurations and users for you), run
|
For a simple full installation (do this if you're installing Airtime from scratch and don't have any of your own
|
||||||
|
configuration set up), run
|
||||||
|
|
||||||
sudo ./install -fap
|
sudo ./install -fiapd
|
||||||
|
|
||||||
What this means:
|
What this means:
|
||||||
|
|
||||||
-f - force; non-interactive (no prompts)
|
-f - force; non-interactive (no prompts)
|
||||||
|
-i - install the default Icecast 2 setup for Airtime
|
||||||
-a - install the default apache setup for Airtime
|
-a - install the default apache setup for Airtime
|
||||||
-p - create a default Airtime postgres user
|
-p - create a default Airtime postgres user
|
||||||
|
-d - install binary dependencies needed for Airtime
|
||||||
|
|
||||||
This will install all components necessary for Airtime, and set up /usr/share/airtime as your
|
This will install all components necessary for Airtime, and set up /usr/share/airtime as your
|
||||||
web root (where apache looks for your Airtime files).
|
web root (where apache looks for your Airtime files).
|
||||||
|
|
|
@ -109,7 +109,7 @@ $result = $r && $database;
|
||||||
?>">
|
?>">
|
||||||
Make sure you aren't missing any of the Postgres dependencies in the table above.
|
Make sure you aren't missing any of the Postgres dependencies in the table above.
|
||||||
If your dependencies check out, make sure your database configuration settings in
|
If your dependencies check out, make sure your database configuration settings in
|
||||||
<code>airtime.conf</code> are correct and the Airtime database was installed correctly.
|
<code>/etc/airtime.conf</code> are correct and the Airtime database was installed correctly.
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -143,8 +143,14 @@ $result = $r && $database;
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
global $extensions;
|
global $extensions;
|
||||||
|
$first = true;
|
||||||
foreach ($extensions as $ext) {
|
foreach ($extensions as $ext) {
|
||||||
echo $ext . " | ";
|
if (!$first) {
|
||||||
|
echo " | ";
|
||||||
|
} else {
|
||||||
|
$first = false;
|
||||||
|
}
|
||||||
|
echo $ext;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form action="#" role="form" id="finishSettingsForm">
|
<form action="#" role="form" id="finishSettingsForm">
|
||||||
<h3 class="form-title">Media Settings</h3>
|
<h3 class="form-title">Setup Complete!</h3>
|
||||||
<span id="helpBlock" class="help-block help-message"></span>
|
<span id="helpBlock" class="help-block help-message"></span>
|
||||||
<p>
|
<p>
|
||||||
Looks like you're almost done! Click "Done!" to bring up the Airtime configuration checklist; if
|
Looks like you're almost done! Click "Done!" to bring up the Airtime configuration checklist; if
|
||||||
|
|
|
@ -10,6 +10,44 @@
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# G E N E R A L S E T T I N G S
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# These settings are used for Airtime's webserver configuration, and
|
||||||
|
# for general-purpose properties.
|
||||||
|
#
|
||||||
|
# api_key: The API key for your Airtime installation.
|
||||||
|
# The value is generated the first time you use Airtime.
|
||||||
|
#
|
||||||
|
# web_server_user: The default webserver user.
|
||||||
|
# The default is www-data.
|
||||||
|
#
|
||||||
|
# base_url: The host name for your webserver.
|
||||||
|
# The default is localhost.
|
||||||
|
#
|
||||||
|
# base_port: The port for your webserver.
|
||||||
|
# The default is 80.
|
||||||
|
#
|
||||||
|
# base_dir: The root directory for your Airtime installation
|
||||||
|
# on your webserver, relative to the base_url.
|
||||||
|
# The default is /.
|
||||||
|
#
|
||||||
|
# cache_ahead_hours: How many hours ahead of time the Airtime playout
|
||||||
|
# engine (PYPO) should cache scheduled media files.
|
||||||
|
# The default is 1.
|
||||||
|
#
|
||||||
|
[general]
|
||||||
|
api_key =
|
||||||
|
web_server_user = www-data
|
||||||
|
base_url = localhost
|
||||||
|
base_port = 80
|
||||||
|
base_dir = /
|
||||||
|
cache_ahead_hours = 1
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# D A T A B A S E
|
# D A T A B A S E
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
@ -69,44 +107,6 @@ vhost = /airtime
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
|
||||||
# G E N E R A L S E T T I N G S
|
|
||||||
# ----------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# These settings are used for Airtime's webserver configuration, and
|
|
||||||
# for general-purpose properties.
|
|
||||||
#
|
|
||||||
# api_key: The API key for your Airtime installation.
|
|
||||||
# The value is generated the first time you use Airtime.
|
|
||||||
#
|
|
||||||
# web_server_user: The default webserver user.
|
|
||||||
# The default is www-data.
|
|
||||||
#
|
|
||||||
# base_url: The host name for your webserver.
|
|
||||||
# The default is localhost.
|
|
||||||
#
|
|
||||||
# base_port: The port for your webserver.
|
|
||||||
# The default is 80.
|
|
||||||
#
|
|
||||||
# base_dir: The root directory for your Airtime installation
|
|
||||||
# on your webserver, relative to the base_url.
|
|
||||||
# The default is /.
|
|
||||||
#
|
|
||||||
# cache_ahead_hours: How many hours ahead of time the Airtime playout
|
|
||||||
# engine (PYPO) should cache scheduled media files.
|
|
||||||
# The default is 1.
|
|
||||||
#
|
|
||||||
[general]
|
|
||||||
api_key =
|
|
||||||
web_server_user = www-data
|
|
||||||
base_url = localhost
|
|
||||||
base_port = 80
|
|
||||||
base_dir = /
|
|
||||||
cache_ahead_hours = 1
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# M O N I T
|
# M O N I T
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
@ -124,6 +124,47 @@ monit_password = airtime
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# M E D I A M O N I T O R
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# api_client: ???
|
||||||
|
#
|
||||||
|
# bin_dir: Directory containing media monitor binaries
|
||||||
|
#
|
||||||
|
# log_dir: Directory containing media monitor log files
|
||||||
|
#
|
||||||
|
# check_filesystem_events: How long to queue up events performed on the
|
||||||
|
# files themselves
|
||||||
|
#
|
||||||
|
# check_airtime_events: How long to queue metadata input from airtime
|
||||||
|
#
|
||||||
|
# touch_interval
|
||||||
|
#
|
||||||
|
# chunking_number
|
||||||
|
#
|
||||||
|
# request_max_wait
|
||||||
|
#
|
||||||
|
# rmq_event_wait
|
||||||
|
#
|
||||||
|
# logpath
|
||||||
|
#
|
||||||
|
# index_path
|
||||||
|
#
|
||||||
|
[media-monitor]
|
||||||
|
api_client = "airtime"
|
||||||
|
check_filesystem_events = 5
|
||||||
|
check_airtime_events = 30
|
||||||
|
touch_interval = 5
|
||||||
|
chunking_number = 450
|
||||||
|
request_max_wait = 3.0
|
||||||
|
rmq_event_wait = 0.1
|
||||||
|
logpath = '/var/log/airtime/media-monitor/media-monitor.log'
|
||||||
|
index_path = '/var/tmp/airtime/media-monitor/last_index'
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# S O U N D C L O U D
|
# S O U N D C L O U D
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
|
@ -18,12 +18,13 @@ body {
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 3em 0 0 0;
|
margin: 1em 0 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checklist {
|
.checklist {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
height: 50%;
|
height: 50%;
|
||||||
|
min-height: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.caption {
|
.caption {
|
||||||
|
@ -40,7 +41,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.check {
|
.check {
|
||||||
background: #dff0d8 url("css/images/accept.png") no-repeat center;
|
background: #dff0d8 url("../images/accept.png") no-repeat center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
|
|
|
@ -143,7 +143,7 @@ form .form-group {
|
||||||
* Button Styles
|
* Button Styles
|
||||||
*
|
*
|
||||||
* ############################################################################ */
|
* ############################################################################ */
|
||||||
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,11 +78,15 @@ function removeOverlay() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formSlide(dir) {
|
function formSlide(dir) {
|
||||||
var delta = (dir == "next") ? "-=100%" : "+=100%";
|
var delta = (dir == "next") ? "-=100%" : "+=100%",
|
||||||
$(".btn").attr("disabled", "disabled");
|
parent = $(this).parents("div.form-wrapper"),
|
||||||
$(".form-slider").animate({left: delta}, 500, function() {
|
toForm = (dir == "next") ? parent.next() : parent.prev();
|
||||||
$(".btn").removeAttr("disabled");
|
|
||||||
});
|
parent.find(".btn").attr("disabled", "disabled");
|
||||||
|
toForm.find(".btn").removeAttr("disabled");
|
||||||
|
toForm.find(":input :first").focus();
|
||||||
|
|
||||||
|
$(".form-slider").animate({left: delta}, 500);
|
||||||
var stepCount = $("#stepCount"),
|
var stepCount = $("#stepCount"),
|
||||||
steps = parseInt(stepCount.html());
|
steps = parseInt(stepCount.html());
|
||||||
stepCount.html((dir == "next") ? (steps + 1) : (steps - 1));
|
stepCount.html((dir == "next") ? (steps + 1) : (steps - 1));
|
||||||
|
@ -93,14 +97,14 @@ function formSlide(dir) {
|
||||||
* Fade out the previous setup step and fade in the next one
|
* Fade out the previous setup step and fade in the next one
|
||||||
*/
|
*/
|
||||||
function nextSlide() {
|
function nextSlide() {
|
||||||
formSlide("next");
|
formSlide.call($(this), "next");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fade out the current setup step and fade in the previous one
|
* Fade out the current setup step and fade in the previous one
|
||||||
*/
|
*/
|
||||||
function prevSlide() {
|
function prevSlide() {
|
||||||
formSlide("prev");
|
formSlide.call($(this), "prev");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,7 +122,7 @@ function submitForm(e, obj) {
|
||||||
var d = $(e.target).serializeArray();
|
var d = $(e.target).serializeArray();
|
||||||
addOverlay();
|
addOverlay();
|
||||||
// Append .promise().done() rather than using a
|
// Append .promise().done() rather than using a
|
||||||
// callback to avoid weird alert duplication
|
// callback to avoid call duplication
|
||||||
$("#overlay, #loadingImage").fadeIn(500).promise().done(function() {
|
$("#overlay, #loadingImage").fadeIn(500).promise().done(function() {
|
||||||
// Proxy function for passing the event to the cleanup function
|
// Proxy function for passing the event to the cleanup function
|
||||||
var cleanupProxy = function(data) {
|
var cleanupProxy = function(data) {
|
||||||
|
@ -131,6 +135,8 @@ function submitForm(e, obj) {
|
||||||
$(function() {
|
$(function() {
|
||||||
// Stop the user from dragging the slider
|
// Stop the user from dragging the slider
|
||||||
$(".form-slider").draggable('disable');
|
$(".form-slider").draggable('disable');
|
||||||
|
$(".btn").attr("disabled", "disabled");
|
||||||
|
$("form:first .btn").removeAttr("disabled");
|
||||||
|
|
||||||
window.onresize = function() {
|
window.onresize = function() {
|
||||||
var headerHeight = $(".header").outerHeight(),
|
var headerHeight = $(".header").outerHeight(),
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
* Wrapper class for finalizing and moving airtime.conf
|
* Wrapper class for finalizing and moving airtime.conf
|
||||||
*/
|
*/
|
||||||
class FinishSetup extends Setup {
|
class FinishSetup extends Setup {
|
||||||
|
|
||||||
|
const AIRTIME_CONF_PATH = "/etc/airtime/airtime.conf";
|
||||||
|
|
||||||
function __construct($settings) {
|
function __construct($settings) {
|
||||||
}
|
}
|
||||||
|
@ -17,7 +19,7 @@ class FinishSetup extends Setup {
|
||||||
$message = null;
|
$message = null;
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
if ($this->checkAirtimeConfigDirectory()) {
|
if (file_exists("/etc/airtime/")) {
|
||||||
if (!$this->moveAirtimeConfig()) {
|
if (!$this->moveAirtimeConfig()) {
|
||||||
$message = "Error moving airtime.conf or deleting /tmp/airtime.conf.temp!";
|
$message = "Error moving airtime.conf or deleting /tmp/airtime.conf.temp!";
|
||||||
$errors[] = "ERR";
|
$errors[] = "ERR";
|
||||||
|
@ -26,20 +28,31 @@ class FinishSetup extends Setup {
|
||||||
$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!";
|
$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!";
|
||||||
$errors[] = "ERR";
|
$errors[] = "ERR";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
// Write service configurations for pypo and media-monitor
|
||||||
|
$this->startServices();
|
||||||
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
"message" => $message,
|
"message" => $message,
|
||||||
"errors" => $errors,
|
"errors" => $errors,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkAirtimeConfigDirectory() {
|
/**
|
||||||
return file_exists("/etc/airtime/");
|
* Moves /tmp/airtime.conf.temp to /etc/airtime.conf and then removes it to complete setup
|
||||||
}
|
* @return boolean false if either of the copy or removal operations fail
|
||||||
|
*/
|
||||||
function moveAirtimeConfig() {
|
function moveAirtimeConfig() {
|
||||||
return copy(AIRTIME_CONF_TEMP_PATH, "/etc/airtime/airtime.conf")
|
return copy(AIRTIME_CONF_TEMP_PATH, self::AIRTIME_CONF_PATH)
|
||||||
&& unlink(AIRTIME_CONF_TEMP_PATH);
|
&& unlink(AIRTIME_CONF_TEMP_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function startServices() {
|
||||||
|
exec("service airtime-media-monitor start-with-monit");
|
||||||
|
exec("service airtime-playout start-with-monit");
|
||||||
|
exec("service airtime-liquidsoap start-with-monit");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -25,7 +25,7 @@ class AirtimeMediaMonitorBootstrap():
|
||||||
api_clients -- reference of api_clients to communicate with airtime-server
|
api_clients -- reference of api_clients to communicate with airtime-server
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
config = ConfigObj('/etc/airtime/media-monitor.cfg')
|
config = ConfigObj('/etc/airtime/airtime.conf')
|
||||||
self.api_client = apc.api_client_factory(config)
|
self.api_client = apc.api_client_factory(config)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -32,17 +32,17 @@ showhelp () {
|
||||||
If no directory or an empty string is given, this defaults to
|
If no directory or an empty string is given, this defaults to
|
||||||
an in-place installation, and will give the web user
|
an in-place installation, and will give the web user
|
||||||
permissions on the current Airtime root
|
permissions on the current Airtime root
|
||||||
-i, --in-place
|
-I, --in-place
|
||||||
Set the current Airtime root as the working directory for
|
Set the current Airtime root as the working directory for
|
||||||
Airtime
|
Airtime
|
||||||
Note that you will need to give your web user permissions on
|
Note that you will need to give your web user permissions on
|
||||||
these directories
|
these directories
|
||||||
-p, --postgres-init
|
-p, --postgres
|
||||||
Create a default postgres user named 'airtime' with password
|
Create a default postgres user named 'airtime' with password
|
||||||
'airtime'
|
'airtime'
|
||||||
-a, --apache
|
-a, --apache
|
||||||
Install apache and deploy a basic configuration for Airtime
|
Install apache and deploy a basic configuration for Airtime
|
||||||
-c, --icecast
|
-i, --icecast
|
||||||
Install Icecast 2 and deploy a basic configuration for Airtime"
|
Install Icecast 2 and deploy a basic configuration for Airtime"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ while :; do
|
||||||
--icecast)
|
--icecast)
|
||||||
icecast="t"
|
icecast="t"
|
||||||
;;
|
;;
|
||||||
--postgres-init)
|
--postgres)
|
||||||
postgres="t"
|
postgres="t"
|
||||||
;;
|
;;
|
||||||
--in-place)
|
--in-place)
|
||||||
|
@ -182,13 +182,13 @@ while :; do
|
||||||
a)
|
a)
|
||||||
apache="t"
|
apache="t"
|
||||||
;;
|
;;
|
||||||
c)
|
i)
|
||||||
icecast="t"
|
icecast="t"
|
||||||
;;
|
;;
|
||||||
p)
|
p)
|
||||||
postgres="t"
|
postgres="t"
|
||||||
;;
|
;;
|
||||||
i)
|
I)
|
||||||
in_place="t"
|
in_place="t"
|
||||||
;;
|
;;
|
||||||
w)
|
w)
|
||||||
|
@ -210,7 +210,7 @@ while :; do
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "$0: error - unrecognized option $1" >&2;
|
echo "$0: error - unrecognized option '${1:$i:1}'" >&2;
|
||||||
echo "Try 'install --help' for more information."
|
echo "Try 'install --help' for more information."
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
@ -237,18 +237,6 @@ echo "/ | \ || | \ | | | / Y \| \ "
|
||||||
echo "\____|__ /___||____|_ / |____| |___\____|__ /_______ / "
|
echo "\____|__ /___||____|_ / |____| |___\____|__ /_______ / "
|
||||||
echo -e " \/ \/ \/ \/ \n"
|
echo -e " \/ \/ \/ \/ \n"
|
||||||
|
|
||||||
# echo " ____ ______ ____ ____ __________ __ _________ ____ ____ "
|
|
||||||
# echo " / _ \\\\____ \_/ __ \ / \ / ___/ _ \| | \_ __ \_/ ___\/ __ \ "
|
|
||||||
# echo "( <_> ) |_> > ___/| | \ \___ ( <_> ) | /| | \/\ \__\ ___/ "
|
|
||||||
# echo " \____/| __/ \___ >___| / /____ >____/|____/ |__| \___ >___ > "
|
|
||||||
# echo " |__| \/ \/ \/ \/ \/ "
|
|
||||||
# echo " .___.__ __ __ .__ "
|
|
||||||
# echo "____________ __| _/|__| ____ _____ __ ___/ |_ ____ _____ _____ _/ |_|__| ____ ____ "
|
|
||||||
# echo "\_ __ \__ \ / __ | | |/ _ \ \__ \ | | \ __\/ _ \ / \\\\__ \\\\ __\ |/ _ \ / \ "
|
|
||||||
# echo " | | \// __ \_/ /_/ | | ( <_> ) / __ \| | /| | ( <_> ) Y Y \/ __ \| | | ( <_> ) | \ "
|
|
||||||
# echo " |__| (____ /\____ | |__|\____/ (____ /____/ |__| \____/|__|_| (____ /__| |__|\____/|___| / "
|
|
||||||
# echo -e " \/ \/ \/ \/ \/ \/ \n"
|
|
||||||
|
|
||||||
if [ "$apache" = "f" -a ${_i} -eq 1 ]; then
|
if [ "$apache" = "f" -a ${_i} -eq 1 ]; then
|
||||||
echo -e "Install default Airtime apache configuration? (Y/n): \c"
|
echo -e "Install default Airtime apache configuration? (Y/n): \c"
|
||||||
read IN
|
read IN
|
||||||
|
@ -304,6 +292,14 @@ if [ "$apache" = "t" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$icecast" = "f" -a ${_i} -eq 1 ]; then
|
||||||
|
echo -e "Install default Airtime Icecast configuration? (Y/n): \c"
|
||||||
|
read IN
|
||||||
|
if [ "$IN" = "y" -o "$IN" = "Y" ]; then
|
||||||
|
icecast="t"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$icecast" = "t" ]; then
|
if [ "$icecast" = "t" ]; then
|
||||||
loud "\n-----------------------------------------------------"
|
loud "\n-----------------------------------------------------"
|
||||||
loud " * Installing Icecast * "
|
loud " * Installing Icecast * "
|
||||||
|
@ -318,6 +314,49 @@ if [ "$icecast" = "t" ]; then
|
||||||
set -e
|
set -e
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
loud "\n-----------------------------------------------------"
|
||||||
|
loud " * Installing Python Apps * "
|
||||||
|
loud "-----------------------------------------------------"
|
||||||
|
|
||||||
|
verbose "\n * Installing virtualenv..."
|
||||||
|
loudCmd "$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh"
|
||||||
|
|
||||||
|
verbose "\n * Installing liquidsoap..."
|
||||||
|
loudCmd "apt-get -y --force-yes install liquidsoap"
|
||||||
|
|
||||||
|
# ------------ Activate virtualenv ------------
|
||||||
|
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||||
|
. ${virtualenv_bin}activate
|
||||||
|
|
||||||
|
verbose "\n * Installing API client..."
|
||||||
|
cp -R ${AIRTIMEROOT}/python_apps/api_clients /usr/lib/airtime/api_clients
|
||||||
|
|
||||||
|
verbose "\n * Copying media-monitor files..."
|
||||||
|
cp -R ${AIRTIMEROOT}/python_apps/media-monitor /usr/lib/airtime/media-monitor
|
||||||
|
cp -R ${AIRTIMEROOT}/python_apps/media-monitor2 /usr/lib/airtime/media-monitor/mm2
|
||||||
|
|
||||||
|
sed -e "s@WEB_USER@${web_user}@g" /usr/lib/airtime/media-monitor/airtime-media-monitor-init-d > /etc/init.d/airtime-media-monitor
|
||||||
|
touch /etc/sudoers.d/airtime-media-monitor_${web_user}
|
||||||
|
echo "${web_user} ALL = (root) NOPASSWD: /sbin/start airtime-media-monitor, \
|
||||||
|
/sbin/stop airtime-media-monitor, \
|
||||||
|
/sbin/restart airtime-media-monitor, \
|
||||||
|
/sbin/status airtime-media-monitor" > /etc/sudoers.d/airtime-media-monitor_${web_user}
|
||||||
|
|
||||||
|
verbose "\n * Copying pypo files..."
|
||||||
|
python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py
|
||||||
|
|
||||||
|
verbose "\n * Initializing media monitor..."
|
||||||
|
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-initialize.py
|
||||||
|
|
||||||
|
verbose "\n * Initializing pypo..."
|
||||||
|
python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py
|
||||||
|
|
||||||
|
loudCmd "service airtime-media-monitor restart 2>/dev/null"
|
||||||
|
loudCmd "service airtime-playout restart 2>/dev/null"
|
||||||
|
|
||||||
|
deactivate
|
||||||
|
# ------------ Deactivate virtualenv ------------
|
||||||
|
|
||||||
if [ ! -d /var/log/airtime ]; then
|
if [ ! -d /var/log/airtime ]; then
|
||||||
loud "\n-----------------------------------------------------"
|
loud "\n-----------------------------------------------------"
|
||||||
loud " * Installing Log Files * "
|
loud " * Installing Log Files * "
|
||||||
|
@ -325,9 +364,9 @@ if [ ! -d /var/log/airtime ]; then
|
||||||
|
|
||||||
verbose "\n * Creating /var/log/airtime..."
|
verbose "\n * Creating /var/log/airtime..."
|
||||||
mkdir -p /var/log/airtime
|
mkdir -p /var/log/airtime
|
||||||
chmod a+x /var/log/airtime
|
mkdir -p /var/log/airtime/media-monitor
|
||||||
chown ${web_user}:${web_user} /var/log/airtime/
|
chmod -R a+x /var/log/airtime
|
||||||
|
chown -R ${web_user}:${web_user} /var/log/airtime/
|
||||||
cp ${AIRTIMEROOT}/airtime_mvc/build/airtime-php.logrotate /etc/logrotate.d/airtime-php
|
cp ${AIRTIMEROOT}/airtime_mvc/build/airtime-php.logrotate /etc/logrotate.d/airtime-php
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -367,7 +406,9 @@ loudCmd "apt-get -y --force-yes install postgresql php5-pgsql"
|
||||||
setupAirtimePostgresUser() {
|
setupAirtimePostgresUser() {
|
||||||
# here-doc to execute this block as postgres user
|
# here-doc to execute this block as postgres user
|
||||||
su postgres <<'EOF'
|
su postgres <<'EOF'
|
||||||
|
set +e
|
||||||
psql -d postgres -tAc "CREATE USER airtime WITH ENCRYPTED PASSWORD 'airtime'; ALTER USER airtime CREATEDB;"
|
psql -d postgres -tAc "CREATE USER airtime WITH ENCRYPTED PASSWORD 'airtime'; ALTER USER airtime CREATEDB;"
|
||||||
|
set -e
|
||||||
# don't indent this!
|
# don't indent this!
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
@ -419,12 +460,20 @@ if [ ! -d "/etc/airtime" ]; then
|
||||||
|
|
||||||
verbose "\n * Creating /etc/airtime/ directory..."
|
verbose "\n * Creating /etc/airtime/ directory..."
|
||||||
mkdir /etc/airtime
|
mkdir /etc/airtime
|
||||||
chown -R ${web_user}:${web_user} /srv/airtime
|
|
||||||
chown -R ${web_user}:${web_user} /etc/airtime
|
chown -R ${web_user}:${web_user} /etc/airtime
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "/srv/airtime" ]; then
|
if [ ! -d "/srv/airtime" ]; then
|
||||||
mkdir -p /srv/airtime
|
mkdir -p /srv/airtime
|
||||||
|
chown -R ${web_user}:${web_user} /srv/airtime
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$install_dependencies" = "f" -a ${_i} -eq 1 ]; then
|
||||||
|
echo -e "Install external binary dependencies? (Y/n): \c"
|
||||||
|
read IN
|
||||||
|
if [ "$IN" = "y" -o "$IN" = "Y" ]; then
|
||||||
|
install_dependencies="t"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install_dependencies" = "t" ]; then
|
if [ "$install_dependencies" = "t" ]; then
|
||||||
|
@ -434,7 +483,7 @@ if [ "$install_dependencies" = "t" ]; then
|
||||||
|
|
||||||
verbose "\n * Reading requirements-${dist,,}-${code,,}.apt..."
|
verbose "\n * Reading requirements-${dist,,}-${code,,}.apt..."
|
||||||
|
|
||||||
loudCmd "apt-get -y --force-yes install $(grep -vE \"^\s*#\" \"bin/requirements-${dist,,}-${code,,}.apt\" | tr \"\n\" \" \")"
|
loudCmd "apt-get -y --force-yes install $(grep -vE '^\s*#' bin/requirements-${dist,,}-${code,,}.apt | tr '\n' ' ')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
verbose "\n * Restarting apache..."
|
verbose "\n * Restarting apache..."
|
||||||
|
|
|
@ -83,6 +83,8 @@ api_config['push_stream_stats'] = 'push-stream-stats/api_key/%%api_key%%/format/
|
||||||
api_config['update_stream_setting_table'] = 'update-stream-setting-table/api_key/%%api_key%%/format/json'
|
api_config['update_stream_setting_table'] = 'update-stream-setting-table/api_key/%%api_key%%/format/json'
|
||||||
api_config['get_files_without_silan_value'] = 'get-files-without-silan-value/api_key/%%api_key%%'
|
api_config['get_files_without_silan_value'] = 'get-files-without-silan-value/api_key/%%api_key%%'
|
||||||
api_config['update_cue_values_by_silan'] = 'update-cue-values-by-silan/api_key/%%api_key%%'
|
api_config['update_cue_values_by_silan'] = 'update-cue-values-by-silan/api_key/%%api_key%%'
|
||||||
|
api_config['api_base'] = 'api'
|
||||||
|
api_config['bin_dir'] = '/usr/lib/airtime/api_clients'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -203,7 +205,7 @@ class RequestProvider(object):
|
||||||
|
|
||||||
|
|
||||||
class AirtimeApiClient(object):
|
class AirtimeApiClient(object):
|
||||||
def __init__(self, logger=None,config_path='/etc/airtime/api_client.cfg'):
|
def __init__(self, logger=None,config_path='/etc/airtime/airtime.conf'):
|
||||||
if logger is None: self.logger = logging
|
if logger is None: self.logger = logging
|
||||||
else: self.logger = logger
|
else: self.logger = logger
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
# Short-Description: Manage airtime-media-monitor daemon
|
# Short-Description: Manage airtime-media-monitor daemon
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
USERID=root
|
USERID=WEB_USER
|
||||||
GROUPID=www-data
|
GROUPID=WEB_USER
|
||||||
NAME=Airtime\ Media\ Monitor
|
NAME=Airtime\ Media\ Monitor
|
||||||
|
|
||||||
DAEMON=/usr/lib/airtime/media-monitor/airtime-media-monitor
|
DAEMON=/usr/lib/airtime/media-monitor/airtime-media-monitor
|
||||||
|
|
|
@ -16,7 +16,7 @@ class AirtimeMediaConfig:
|
||||||
|
|
||||||
# loading config file
|
# loading config file
|
||||||
try:
|
try:
|
||||||
config = ConfigObj('/etc/airtime/media-monitor.cfg')
|
config = ConfigObj('/etc/airtime/airtime.conf')
|
||||||
self.cfg = config
|
self.cfg = config
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.info('Error loading config: ', e)
|
logger.info('Error loading config: ', e)
|
||||||
|
|
|
@ -44,17 +44,13 @@ try:
|
||||||
# load config file
|
# load config file
|
||||||
try:
|
try:
|
||||||
config = ConfigObj(PATH_INI_FILE)
|
config = ConfigObj(PATH_INI_FILE)
|
||||||
config['rabbitmq_user'] = os.environ['RABBITMQ_USER']
|
|
||||||
config['rabbitmq_password'] = os.environ['RABBITMQ_PASSWORD']
|
|
||||||
config['rabbitmq_vhost'] = os.environ['RABBITMQ_VHOST']
|
|
||||||
config.write()
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print 'Error loading config file: ', e
|
print 'Error loading config file: ', e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#copy monit files
|
#copy monit files
|
||||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True)
|
subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True, close_fds=True)
|
||||||
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
|
||||||
#create log dir
|
#create log dir
|
||||||
|
|
|
@ -4,8 +4,7 @@ import sys
|
||||||
import mm2.mm2 as mm2
|
import mm2.mm2 as mm2
|
||||||
from std_err_override import LogWriter
|
from std_err_override import LogWriter
|
||||||
|
|
||||||
global_cfg = '/etc/airtime/media-monitor.cfg'
|
global_cfg = '/etc/airtime/airtime.conf'
|
||||||
api_client_cfg = '/etc/airtime/api_client.cfg'
|
|
||||||
logging_cfg = '/usr/lib/airtime/media-monitor/logging.cfg'
|
logging_cfg = '/usr/lib/airtime/media-monitor/logging.cfg'
|
||||||
|
|
||||||
mm2.main( global_cfg, api_client_cfg, logging_cfg )
|
mm2.main( global_cfg, logging_cfg )
|
||||||
|
|
|
@ -97,9 +97,9 @@ class MM2(InstanceThread, Loggable):
|
||||||
|
|
||||||
manager.loop()
|
manager.loop()
|
||||||
|
|
||||||
def launch_instance(name, root, global_cfg, apc_cfg):
|
def launch_instance(name, root, global_cfg):
|
||||||
cfg = {
|
cfg = {
|
||||||
'api_client' : apc_cfg,
|
'api_client' : global_cfg,
|
||||||
'media_monitor' : global_cfg,
|
'media_monitor' : global_cfg,
|
||||||
}
|
}
|
||||||
ai = AirtimeInstance(name, root, cfg)
|
ai = AirtimeInstance(name, root, cfg)
|
||||||
|
|
|
@ -4,12 +4,12 @@ import os
|
||||||
from media.saas.launcher import setup_global, launch_instance, setup_logger
|
from media.saas.launcher import setup_global, launch_instance, setup_logger
|
||||||
from media.monitor.config import MMConfig
|
from media.monitor.config import MMConfig
|
||||||
|
|
||||||
def main(global_config, api_client_config, log_config):
|
def main(global_config, log_config):
|
||||||
""" function to run hosted install """
|
""" function to run hosted install """
|
||||||
mm_config = MMConfig(global_config)
|
mm_config = MMConfig(global_config)
|
||||||
log = setup_logger( log_config, mm_config['logpath'] )
|
log = setup_logger( log_config, mm_config['logpath'] )
|
||||||
setup_global(log)
|
setup_global(log)
|
||||||
launch_instance('hosted_install', '/', global_config, api_client_config)
|
launch_instance('hosted_install', '/', global_config)
|
||||||
|
|
||||||
__doc__ = """
|
__doc__ = """
|
||||||
Usage:
|
Usage:
|
||||||
|
|
|
@ -8,7 +8,7 @@ real_path1 = u'/home/rudi/throwaway/watch/unknown/unknown/ACDC_-_Back_In_Black-s
|
||||||
opath = u"/home/rudi/Airtime/python_apps/media-monitor2/tests/"
|
opath = u"/home/rudi/Airtime/python_apps/media-monitor2/tests/"
|
||||||
ppath = u"/home/rudi/Airtime/python_apps/media-monitor2/media/"
|
ppath = u"/home/rudi/Airtime/python_apps/media-monitor2/media/"
|
||||||
|
|
||||||
api_client_path = '/etc/airtime/api_client.cfg'
|
api_client_path = '/etc/airtime/airtime.conf'
|
||||||
# holdover from the time we had a special config for testing
|
# holdover from the time we had a special config for testing
|
||||||
sample_config = api_client_path
|
sample_config = api_client_path
|
||||||
real_config = api_client_path
|
real_config = api_client_path
|
||||||
|
|
|
@ -81,17 +81,13 @@ try:
|
||||||
# load config file
|
# load config file
|
||||||
try:
|
try:
|
||||||
config = ConfigObj(PATH_INI_FILE)
|
config = ConfigObj(PATH_INI_FILE)
|
||||||
config['rabbitmq_user'] = os.environ['RABBITMQ_USER']
|
|
||||||
config['rabbitmq_password'] = os.environ['RABBITMQ_PASSWORD']
|
|
||||||
config['rabbitmq_vhost'] = os.environ['RABBITMQ_VHOST']
|
|
||||||
config.write()
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print 'Error loading config file: ', e
|
print 'Error loading config file: ', e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#copy monit files
|
#copy monit files
|
||||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True)
|
subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True, close_fds=True)
|
||||||
|
|
||||||
monit_version = get_monit_version()
|
monit_version = get_monit_version()
|
||||||
if version_compare(monit_version, "5.3.0") >= 0:
|
if version_compare(monit_version, "5.3.0") >= 0:
|
||||||
|
|
|
@ -14,6 +14,6 @@ try:
|
||||||
tn.read_all()
|
tn.read_all()
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print('Error loading config file: %s', e)
|
print 'Error loading config file: %s' % e
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ if (os.geteuid() != 0):
|
||||||
|
|
||||||
# loading config file
|
# loading config file
|
||||||
try:
|
try:
|
||||||
config = ConfigObj('/etc/airtime/media-monitor.cfg')
|
config = ConfigObj('/etc/airtime/airtime.conf')
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print('Error loading config file: %s', e)
|
print('Error loading config file: %s', e)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -24,7 +24,7 @@ if os.geteuid() != 0:
|
||||||
|
|
||||||
# loading config file
|
# loading config file
|
||||||
try:
|
try:
|
||||||
config = ConfigObj('/etc/airtime/media-monitor.cfg')
|
config = ConfigObj('/etc/airtime/airtime.conf')
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print('Error loading config file: %s', e)
|
print('Error loading config file: %s', e)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
Loading…
Reference in New Issue