SAAS-83: Add ability to install Airtime components separately

-fixed
This commit is contained in:
Martin Konecny 2011-11-24 17:31:26 -05:00
parent f75d216bae
commit 15a27526f9
9 changed files with 80 additions and 52 deletions

View File

@ -7,6 +7,10 @@ if [ `whoami` != 'root' ]; then
exit 1
fi
export INSTALL_PYPO=1
export INSTALL_MEDIA_MONITOR=1
export INSTALL_SHOW_RECORDER=1
set +e
DEB=$(dpkg -s airtime 2> /dev/null | grep Status)
set -e

View File

@ -39,25 +39,12 @@ if [ ! -e /etc/airtime/airtime.conf ]; then
cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime
fi
if [ ! -e /etc/airtime/api_client.cfg ]; then
cp $AIRTIMEROOT/python_apps/api_clients/api_client.cfg /etc/airtime
echo "* Creating /etc/airtime"
mkdir -p /etc/monit/conf.d/
if [ ! -e /etc/monit/conf.d/monit-airtime-generic.cfg ]; then
cp $AIRTIMEROOT/python_apps/monit/monit-airtime-generic.cfg /etc/monit/conf.d/
fi
if [ ! -e /etc/airtime/recorder.cfg ]; then
cp $AIRTIMEROOT/python_apps/show-recorder/recorder.cfg /etc/airtime
fi
if [ ! -e /etc/airtime/media-monitor.cfg ]; then
cp $AIRTIMEROOT/python_apps/media-monitor/media-monitor.cfg /etc/airtime
fi
if [ ! -e /etc/airtime/pypo.cfg ]; then
cp $AIRTIMEROOT/python_apps/pypo/pypo.cfg /etc/airtime
fi
if [ ! -e /etc/airtime/liquidsoap.cfg ]; then
cp $AIRTIMEROOT/python_apps/pypo/liquidsoap_scripts/liquidsoap.cfg /etc/airtime
fi
echo "* Creating /etc/cron.d/airtime-crons"
HOUR=$(($RANDOM%24))
@ -68,11 +55,20 @@ echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.
#. ${virtualenv_bin}activate
echo "* Creating /usr/lib/airtime"
python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py
python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-copy-files.py
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-copy-files.py
if [ "$INSTALL_PYPO" -eq "1" -o "$INSTALL_MEDIA_MONITOR" -eq "1" -o "$INSTALL_SHOW_RECORDER" -eq "1" ]; then
python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py
fi
if [ "$INSTALL_PYPO" -eq "1" ]; then
python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py
fi
if [ "$INSTALL_MEDIA_MONITOR" -eq "1" ]; then
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-copy-files.py
fi
if [ "$INSTALL_SHOW_RECORDER" -eq "1" ]; then
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-copy-files.py
fi
cp -R $AIRTIMEROOT/utils /usr/lib/airtime
echo "* Creating symbolic links in /usr/bin"

View File

@ -30,9 +30,15 @@ if [ "$DO_UPGRADE" -eq "0" ]; then
fi
set -e
python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-initialize.py
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py
if [ "$INSTALL_PYPO" -eq "1" ]; then
python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py
fi
if [ "$INSTALL_MEDIA_MONITOR" -eq "1" ]; then
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-initialize.py
fi
if [ "$INSTALL_SHOW_RECORDER" -eq "1" ]; then
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py
fi
# Start monit if it is not running, or restart if it is.
# Need to ensure monit is running before Airtime daemons are run. This is
@ -45,9 +51,16 @@ python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py
sleep 1
set +e
monit monitor airtime-media-monitor
monit monitor airtime-liquidsoap
monit monitor airtime-playout
monit monitor airtime-show-recorder
if [ "$INSTALL_PYPO" -eq "1" ]; then
monit monitor airtime-playout
monit monitor airtime-liquidsoap
fi
if [ "$INSTALL_MEDIA_MONITOR" -eq "1" ]; then
monit monitor airtime-media-monitor
fi
if [ "$INSTALL_SHOW_RECORDER" -eq "1" ]; then
monit monitor airtime-show-recorder
fi
monit monitor rabbitmq-server
set -e

View File

@ -12,8 +12,13 @@ def copy_dir(src_dir, dest_dir):
if not (os.path.exists(dest_dir)):
#print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
shutil.copytree(src_dir, dest_dir)
PATH_INI_FILE = '/etc/airtime/api_client.cfg'
current_script_dir = get_current_script_dir()
if not os.path.exists(PATH_INI_FILE):
shutil.copy('%s/../api_client.cfg'%current_script_dir, PATH_INI_FILE)
"""load config file"""
try:

View File

@ -27,17 +27,20 @@ def create_dir(path):
PATH_INI_FILE = '/etc/airtime/media-monitor.cfg'
# load config file
try:
config = ConfigObj(PATH_INI_FILE)
except Exception, e:
print 'Error loading config file: ', e
sys.exit(1)
try:
# Absolute path this script is in
current_script_dir = get_current_script_dir()
if not os.path.exists(PATH_INI_FILE):
shutil.copy('%s/../media-monitor.cfg'%current_script_dir, PATH_INI_FILE)
# load config file
try:
config = ConfigObj(PATH_INI_FILE)
except Exception, e:
print 'Error loading config file: ', e
sys.exit(1)
#copy monit files
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')

View File

@ -8,7 +8,7 @@ if os.geteuid() != 0:
try:
print "Waiting for media-monitor processes to stop...",
if (os.path.exists('/etc/init.d/airtime-playout')):
if (os.path.exists('/etc/init.d/airtime-media-monitor')):
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
sts = os.waitpid(p.pid, 0)[1]
print "OK"

View File

@ -27,17 +27,20 @@ def create_dir(path):
PATH_INI_FILE = '/etc/airtime/pypo.cfg'
# load config file
try:
config = ConfigObj(PATH_INI_FILE)
except Exception, e:
print 'Error loading config file: ', e
sys.exit(1)
try:
try:
# Absolute path this script is in
current_script_dir = get_current_script_dir()
if not os.path.exists(PATH_INI_FILE):
shutil.copy('%s/../pypo.cfg'%current_script_dir, PATH_INI_FILE)
# load config file
try:
config = ConfigObj(PATH_INI_FILE)
except Exception, e:
print 'Error loading config file: ', e
sys.exit(1)
#copy monit files
shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/')
shutil.copy('%s/../monit-airtime-liquidsoap.cfg'%current_script_dir, '/etc/monit/conf.d/')

View File

@ -27,16 +27,20 @@ def create_dir(path):
PATH_INI_FILE = '/etc/airtime/recorder.cfg'
# load config file
try:
config = ConfigObj(PATH_INI_FILE)
except Exception, e:
print 'Error loading config file: ', e
sys.exit(1)
try:
# Absolute path this script is in
current_script_dir = get_current_script_dir()
if not os.path.exists(PATH_INI_FILE):
shutil.copy('%s/../recorder.cfg'%current_script_dir, PATH_INI_FILE)
# load config file
try:
config = ConfigObj(PATH_INI_FILE)
except Exception, e:
print 'Error loading config file: ', e
sys.exit(1)
#copy monit files
shutil.copy('%s/../monit-airtime-show-recorder.cfg'%current_script_dir, '/etc/monit/conf.d/')

View File

@ -8,7 +8,7 @@ if os.geteuid() != 0:
try:
print "Waiting for show-recorder processes to stop...",
if (os.path.exists('/etc/init.d/airtime-playout')):
if (os.path.exists('/etc/init.d/airtime-show-recorder')):
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
sts = os.waitpid(p.pid, 0)[1]
print "OK"