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 exit 1
fi fi
export INSTALL_PYPO=1
export INSTALL_MEDIA_MONITOR=1
export INSTALL_SHOW_RECORDER=1
set +e set +e
DEB=$(dpkg -s airtime 2> /dev/null | grep Status) DEB=$(dpkg -s airtime 2> /dev/null | grep Status)
set -e set -e

View File

@ -39,25 +39,12 @@ if [ ! -e /etc/airtime/airtime.conf ]; then
cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime
fi fi
if [ ! -e /etc/airtime/api_client.cfg ]; then echo "* Creating /etc/airtime"
cp $AIRTIMEROOT/python_apps/api_clients/api_client.cfg /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 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" echo "* Creating /etc/cron.d/airtime-crons"
HOUR=$(($RANDOM%24)) HOUR=$(($RANDOM%24))
@ -68,11 +55,20 @@ echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.
#. ${virtualenv_bin}activate #. ${virtualenv_bin}activate
echo "* Creating /usr/lib/airtime" 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 cp -R $AIRTIMEROOT/utils /usr/lib/airtime
echo "* Creating symbolic links in /usr/bin" echo "* Creating symbolic links in /usr/bin"

View File

@ -30,9 +30,15 @@ if [ "$DO_UPGRADE" -eq "0" ]; then
fi fi
set -e set -e
if [ "$INSTALL_PYPO" -eq "1" ]; then
python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py 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 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 python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py
fi
# Start monit if it is not running, or restart if it is. # 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 # 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 sleep 1
set +e set +e
monit monitor airtime-media-monitor if [ "$INSTALL_PYPO" -eq "1" ]; then
monit monitor airtime-liquidsoap
monit monitor airtime-playout 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 monit monitor airtime-show-recorder
fi
monit monitor rabbitmq-server monit monitor rabbitmq-server
set -e set -e

View File

@ -13,8 +13,13 @@ def copy_dir(src_dir, dest_dir):
#print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir) #print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
shutil.copytree(src_dir, dest_dir) shutil.copytree(src_dir, dest_dir)
PATH_INI_FILE = '/etc/airtime/api_client.cfg'
current_script_dir = get_current_script_dir() 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""" """load config file"""
try: try:
config = ConfigObj("%s/../api_client.cfg" % current_script_dir) config = ConfigObj("%s/../api_client.cfg" % current_script_dir)

View File

@ -27,6 +27,13 @@ def create_dir(path):
PATH_INI_FILE = '/etc/airtime/media-monitor.cfg' PATH_INI_FILE = '/etc/airtime/media-monitor.cfg'
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 # load config file
try: try:
config = ConfigObj(PATH_INI_FILE) config = ConfigObj(PATH_INI_FILE)
@ -34,10 +41,6 @@ except Exception, e:
print 'Error loading config file: ', e print 'Error loading config file: ', e
sys.exit(1) sys.exit(1)
try:
# Absolute path this script is in
current_script_dir = get_current_script_dir()
#copy monit files #copy monit files
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/')
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/')

View File

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

View File

@ -27,6 +27,13 @@ def create_dir(path):
PATH_INI_FILE = '/etc/airtime/pypo.cfg' PATH_INI_FILE = '/etc/airtime/pypo.cfg'
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 # load config file
try: try:
config = ConfigObj(PATH_INI_FILE) config = ConfigObj(PATH_INI_FILE)
@ -34,10 +41,6 @@ except Exception, e:
print 'Error loading config file: ', e print 'Error loading config file: ', e
sys.exit(1) sys.exit(1)
try:
# Absolute path this script is in
current_script_dir = get_current_script_dir()
#copy monit files #copy monit files
shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/') 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/') shutil.copy('%s/../monit-airtime-liquidsoap.cfg'%current_script_dir, '/etc/monit/conf.d/')

View File

@ -27,6 +27,13 @@ def create_dir(path):
PATH_INI_FILE = '/etc/airtime/recorder.cfg' PATH_INI_FILE = '/etc/airtime/recorder.cfg'
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 # load config file
try: try:
config = ConfigObj(PATH_INI_FILE) config = ConfigObj(PATH_INI_FILE)
@ -34,9 +41,6 @@ except Exception, e:
print 'Error loading config file: ', e print 'Error loading config file: ', e
sys.exit(1) sys.exit(1)
try:
# Absolute path this script is in
current_script_dir = get_current_script_dir()
#copy monit files #copy monit files
shutil.copy('%s/../monit-airtime-show-recorder.cfg'%current_script_dir, '/etc/monit/conf.d/') 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: try:
print "Waiting for show-recorder processes to stop...", 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) p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
sts = os.waitpid(p.pid, 0)[1] sts = os.waitpid(p.pid, 0)[1]
print "OK" print "OK"