More work on switching pypo to use setuptools, added lxc-bootstrap script for ease of testing across distros

This commit is contained in:
Duncan Sommerville 2014-12-19 09:47:54 -05:00
parent 4749ef111c
commit 6bc3a1cfba
3 changed files with 84 additions and 11 deletions

View File

@ -311,19 +311,29 @@ if [ "$icecast" = "t" ]; then
set -e
fi
# Do we want to prompt the user here?
loud "\n-----------------------------------------------------"
loud " * Installing Airtime Services * "
loud "-----------------------------------------------------"
verbose "\n * Installing liquidsoap, python, and virtualenv..."
loudCmd "apt-get -y --force-yes install liquidsoap python python-virtualenv"
verbose "...Done"
# DS, 19/12/14 -- I don't really like this script... should we rewrite it,
# or maybe see if we can get rid of virtualenv entirely?
verbose "\n * Activating Airtime virtualenv..."
loudCmd "$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh"
. /usr/lib/airtime/airtime_virtualenv/bin/activate
verbose "...Done"
verbose "\n * Creating /usr/lib/airtime..."
mkdir -p /usr/lib/airtime
verbose "...Done"
verbose "\n * Creating /usr/lib/airtime..."
verbose "\n * Creating /run/airtime..."
mkdir -p /run/airtime
chmod 755 /run/airtime
chown -R ${web_user}:${web_user} /run/airtime
@ -342,6 +352,16 @@ 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
verbose "...Done"
verbose "\n * Copying pypo files..."
mkdir -p /usr/lib/airtime/pypo
cp -R ${AIRTIMEROOT}/python_apps/pypo/pypo /usr/lib/airtime/pypo/bin/
verbose "...Done"
verbose "\n * Installing pypo..."
python ${AIRTIMEROOT}/python_apps/pypo/setup.py install
verbose "...Done"
verbose "\n * Creating init files..."
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, \
@ -349,12 +369,6 @@ echo "${web_user} ALL = (root) NOPASSWD: /sbin/start 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..."
mkdir -p /usr/lib/airtime/pypo
cp -R ${AIRTIMEROOT}/python_apps/pypo/pypo /usr/lib/airtime/pypo/bin/
verbose "...Done"
verbose "\n * Creating init files..."
sed -e "s/WEB_USER/${web_user}/g" /usr/lib/airtime/pypo/bin/airtime-playout-init-d > /etc/init.d/airtime-playout
touch /etc/sudoers.d/airtime-playout_${web_user}
echo "${web_user} ALL = (root) NOPASSWD: /sbin/start airtime-playout, \
@ -374,8 +388,8 @@ verbose "...Done"
chmod 755 /etc/init.d/airtime-*
initctl reload-configuration
verbose "\n * Copying pypo files..."
python ${AIRTIMEROOT}/python_apps/pypo/setup.py install
# Deactivate virtualenv
deactivate
if [ ! -d /var/log/airtime ]; then
loud "\n-----------------------------------------------------"

59
installer/lxc-bootstrap Executable file
View File

@ -0,0 +1,59 @@
#!/bin/bash -e
#-e Causes bash script to exit if any of the installers
#return with a non-zero return value.
if [[ $EUID -ne 0 ]]; then
echo "Please run as root user."
exit 1
fi
dist=$1
release=$2
name=airtime-install
set +e
echo -e "\n * Stopping ${name}..."
lxc-stop -n airtime-install
echo "...Done"
echo -e "\n * Destroying ${name}..."
lxc-destroy -n airtime-install
echo "...Done"
set -e
echo -e "\n * Creating ${name} with dist ${dist} and release ${release}..."
lxc-create -t download -n ${name} -- --dist ${dist} --release ${release} --arch amd64
echo "...Done"
echo -e "\n * Starting ${name}..."
lxc-start -n ${name} -d
echo "...Done"
echo -e "\n * Running apt update..."
lxc-attach -n ${name} -e -- apt-get update
echo "...Done"
echo -e "\n * Installing git..."
lxc-attach -n ${name} -e -- apt-get -y --force-yes install git
echo "...Done"
echo -e "\n * Cloning Airtime..."
lxc-attach -n ${name} -- git clone https://github.com/sourcefabric/Airtime.git /usr/share/Airtime
echo "...Done"
echo -e "\n * Checking out installer branch..."
lxc-attach -n ${name} -- git -C /usr/share/Airtime checkout 2.5.x-installer-monitless
echo "...Done"
echo -e "\n * Running installer..."
lxc-attach -n ${name} -e -- /usr/share/Airtime/installer/install -ifapdIv
echo "...Done"
IP=$(lxc-info -i -n ${name} -H)
echo -e "\n * Opening ${name} in your browser..."
if hash xdg-open 2>/dev/null; then
xdg-open "http://${IP}/"
elif hash gnome-open 2>/dev/null; then
gnome-open "http://${IP}/"
fi
echo "...Done"

View File

@ -16,7 +16,7 @@ else:
print data_files
setup(name='airtime-playout',
version='0.1',
version='1.0',
description='Airtime Playout Engine',
url='http://github.com/sourcefabric/Airtime',
author='sourcefabric',
@ -43,7 +43,7 @@ setup(name='airtime-playout',
zip_safe=False,
data_files=data_files)
# Reload the initctl config so that "service start airtime_analyzer" works
# Reload the initctl config so that playout services works
if data_files:
print "Reloading initctl configuration"
call(['initctl', 'reload-configuration'])