libretime/install

790 lines
25 KiB
Plaintext
Raw Normal View History

2014-11-26 16:35:54 +01:00
#!/bin/bash -e
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
2014-11-26 16:35:54 +01:00
#-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
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
AIRTIMEROOT=${SCRIPT_DIR}
2014-12-11 18:58:34 +01:00
2014-11-26 16:35:54 +01:00
showhelp () {
2014-12-11 18:58:34 +01:00
echo "Usage: sudo bash install [options]
2014-12-11 21:55:16 +01:00
-h, --help, -?
2014-12-11 18:58:34 +01:00
Display usage information
-V, --version
Display version information
-v, --verbose
More output
-q, --quiet, --silent
No output except errors
2014-12-11 22:42:05 +01:00
-f, --force
2014-12-11 21:55:16 +01:00
Turn off interactive prompts
--distribution=DISTRIBUTION
Linux distribution the installation is being run on
--release=RELEASE
Distribution release
-d, --ignore-dependencies
Don't install binary dependencies
2014-12-11 18:58:34 +01:00
-w, --web-user=WEB_USER
Set the apache web user. Defaults to www-data. Only change
this setting if you've changed the default apache web user
2014-12-15 15:54:15 +01:00
-r, --web-root=WEB_ROOT
2014-12-11 18:58:34 +01:00
Set the web root for Airtime files
This will copy the Airtime application files, but you will need
to give your web user access to the given directory if it is
not accessible
--web-port=WEB_PORT
Set what port the LibreTime interface should run on.
2014-12-16 18:24:41 +01:00
-I, --in-place
Set the current Airtime directory as the web root
Note that you will need to give your web user permission to
access this directory if it is not accessible
2014-12-16 18:24:41 +01:00
-p, --postgres
2014-12-11 21:55:16 +01:00
Create a default postgres user named 'airtime' with password
'airtime'
2014-12-11 18:58:34 +01:00
-a, --apache
2014-12-15 15:54:15 +01:00
Install apache and deploy a basic configuration for Airtime
2014-12-16 18:24:41 +01:00
-i, --icecast
2017-03-13 14:10:29 +01:00
Install Icecast 2 and deploy a basic configuration for Airtime
--selinux
Run restorecon on directories and files that need tagging to
allow the WEB_USER access."
2014-12-11 18:58:34 +01:00
exit 0
}
showversion () {
version=$(php -r 'require_once(__DIR__ . "/airtime_mvc/application/configs/constants.php"); echo AIRTIME_CODE_VERSION;')
echo "Airtime Version ${version}"
2014-11-26 16:35:54 +01:00
exit 0
}
2014-12-09 23:48:16 +01:00
web_user="www-data"
2014-12-15 15:54:15 +01:00
web_root=""
web_port="80"
2014-12-11 18:58:34 +01:00
in_place="f"
2014-12-15 15:54:15 +01:00
postgres="f"
apache="f"
icecast="f"
ignore_dependencies="f"
2017-03-13 14:10:29 +01:00
selinux="f"
2014-12-11 21:55:16 +01:00
# Interactive
_i=1
# Verbose
2014-12-11 18:58:34 +01:00
_v=0
2014-12-11 21:55:16 +01:00
# Quiet
2014-12-11 18:58:34 +01:00
_q=0
upgrade="f"
dist=""
code=""
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
apache_bin="apache2"
2014-12-11 18:58:34 +01:00
function verbose() {
if [[ ${_v} -eq 1 ]]; then
echo -e "$@"
fi
}
function loud() {
if [[ ${_q} -eq 0 ]]; then
echo -e "$@"
fi
}
2014-12-11 21:55:16 +01:00
# Evaluate commands silently if quiet
function loudCmd() {
if [[ ${_q} -eq 0 ]]; then
eval $@
else
eval $@ > /dev/null
fi
}
function checkCommandExists() {
set +e
command=$@
eval hash ${command} 2>/dev/null
commandFound=$?
if [[ ! ${commandFound} -eq 0 ]]; then
echo -e "Error: ${command} not found. Please ensure you have the corresponding dependency installed."
exit
fi
set -e
}
2014-12-09 23:48:16 +01:00
while :; do
2014-11-26 16:35:54 +01:00
case "$1" in
2014-12-15 15:54:15 +01:00
--help)
2014-12-09 23:48:16 +01:00
showhelp
;;
2014-12-15 15:54:15 +01:00
--version)
2014-12-11 18:58:34 +01:00
showversion
;;
2014-12-15 15:54:15 +01:00
--verbose)
2014-12-11 18:58:34 +01:00
_v=1
;;
2014-12-15 15:54:15 +01:00
--quiet|--silent)
2014-12-11 18:58:34 +01:00
_q=1
;;
2014-12-15 15:54:15 +01:00
--force)
2014-12-11 21:55:16 +01:00
_i=0
;;
--distribution)
if [ "$2" ]; then
dist=$2
shift 2
continue
else
echo 'ERROR: Must specify a non-empty "--distribution DISTRIBUTION" argument.' >&2
exit 1
fi
;;
--distribution=?*)
dist=${1#*=} # Delete everything up to "=" and assign the remainder.
;;
--distribution=)
echo 'ERROR: Must specify a non-empty "--distribution DISTRIBUTION" argument.' >&2
exit 1
;;
--release)
if [ "$2" ]; then
code=$2
shift 2
continue
else
echo 'ERROR: Must specify a non-empty "--release RELEASE" argument.' >&2
exit 1
fi
;;
--release=?*)
code=${1#*=} # Delete everything up to "=" and assign the remainder.
;;
--release=)
echo 'ERROR: Must specify a non-empty "--release RELEASE" argument.' >&2
exit 1
;;
--ignore-dependencies)
ignore_dependencies="t"
2014-12-15 15:54:15 +01:00
;;
--apache)
2014-12-09 23:48:16 +01:00
apache="t"
;;
2014-12-15 15:54:15 +01:00
--icecast)
icecast="t"
;;
2014-12-16 18:24:41 +01:00
--postgres)
2014-12-15 15:54:15 +01:00
postgres="t"
;;
--in-place)
2014-12-11 18:58:34 +01:00
in_place="t"
;;
2014-12-15 15:54:15 +01:00
--web-user)
2014-12-09 23:48:16 +01:00
if [ "$2" ]; then
web_user=$2
shift 2
continue
else
echo 'ERROR: Must specify a non-empty "--web-user WEB_USER" argument.' >&2
exit 1
fi
;;
--web-user=?*)
web_user=${1#*=} # Delete everything up to "=" and assign the remainder.
;;
--web-user=)
2014-12-11 18:58:34 +01:00
echo 'ERROR: Must specify a non-empty "--web-user=WEB_USER" argument.' >&2
exit 1
;;
2014-12-15 15:54:15 +01:00
--web-root)
2014-12-11 18:58:34 +01:00
if [ "$2" ]; then
2014-12-15 15:54:15 +01:00
web_root=$(readlink -f $2)
2014-12-11 18:58:34 +01:00
shift 2
continue
else
2014-12-15 15:54:15 +01:00
echo 'ERROR: Must specify a non-empty "--web-root WEB_ROOT" argument.' >&2
2014-12-11 18:58:34 +01:00
exit 1
fi
;;
2014-12-15 15:54:15 +01:00
--web-root=?*)
web_root=${1#*=} # Delete everything up to "=" and assign the remainder.
2014-12-11 18:58:34 +01:00
;;
2014-12-15 15:54:15 +01:00
--web-root=)
echo 'ERROR: Must specify a non-empty "--web-root=WEB_ROOT" argument.' >&2
2014-12-09 23:48:16 +01:00
exit 1
;;
--web-port)
echo 'ERROR: Please specify a port number.' >&2
exit 1
;;
--web-port=)
echo 'ERROR: Please specify a port number.' >&2
exit 1
;;
--web-port=?*)
web_port=${1#*=}
;;
2017-03-13 14:10:29 +01:00
--selinux)
selinux="t"
;;
2014-12-09 23:48:16 +01:00
--)
shift
break
;;
-?*)
2014-12-15 15:54:15 +01:00
for ((i = 1; i < ${#1}; i++)); do
case "${1:$i:1}" in
h|\?)
showhelp
;;
V)
showversion
;;
v)
_v=1
;;
q)
_q=1
;;
f)
_i=0
;;
d)
ignore_dependencies="t"
2014-12-15 15:54:15 +01:00
;;
a)
apache="t"
;;
2014-12-16 18:24:41 +01:00
i)
2014-12-15 15:54:15 +01:00
icecast="t"
;;
p)
postgres="t"
;;
2014-12-16 18:24:41 +01:00
I)
2014-12-15 15:54:15 +01:00
in_place="t"
;;
w)
if [ "$2" ]; then
web_user=$2
continue
else
echo 'ERROR: Must specify a non-empty "-w WEB_USER" argument.' >&2
exit 1
fi
;;
r)
if [ "$2" ]; then
web_root=$(readlink -f $2)
continue
else
echo 'ERROR: Must specify a non-empty "-d WEB_ROOT" argument.' >&2
exit 1
fi
;;
*)
2014-12-16 18:24:41 +01:00
echo "$0: error - unrecognized option '${1:$i:1}'" >&2;
2014-12-15 15:54:15 +01:00
echo "Try 'install --help' for more information."
exit 1
esac
done
2014-12-09 23:48:16 +01:00
;;
*)
break
2014-11-26 16:35:54 +01:00
esac
shift
done
2014-12-15 15:54:15 +01:00
if [ -z web_root -a ! -d web_root ]; then
echo "$web_root doesn't exist!"
2014-12-11 18:58:34 +01:00
exit 1
fi
echo -e "\n.____ ._____. ___________.__ "
echo "| | |__\_ |_________ ___\__ ___/|__| _____ ____ "
echo "| | | || __ \_ __ \_/ __ \| | | |/ \_/ __ \ "
echo "| |___| || \_\ \ | \/\ ___/| | | | Y Y \ ___/ "
echo "|_______ \__||___ /__| \___ >____| |__|__|_| /\___ >"
echo -e " \/ \/ \/ \/ \/\n"
2014-12-11 18:58:34 +01:00
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
if [ "$dist" = "centos" ]; then
apache_bin="httpd"
fi
2014-12-11 18:58:34 +01:00
if [ "$ignore_dependencies" = "f" ]; then
2015-03-11 22:10:34 +01:00
set +e
2015-03-11 19:54:38 +01:00
if [ -z "${dist}" ]; then
2015-03-11 22:10:34 +01:00
loudCmd "apt-get -y --force-yes install lsb-release"
2015-03-11 19:54:38 +01:00
dist=`lsb_release -ds | awk '{print tolower($1);}'`
code=`lsb_release -cs`
fi
loud "\n-----------------------------------------------------"
loud " * Installing External Dependencies * "
loud "-----------------------------------------------------"
verbose "\n * Reading requirements-${dist,,}-${code,,}.apt..."
loudCmd "apt-get update"
if [ -f ${SCRIPT_DIR}/installer/lib/requirements-${dist,,}-${code,,}.apt ]; then
loudCmd "DEBIAN_FRONTEND=noninteractive apt-get -y -m --force-yes install $(grep -vE '^\s*#' ${SCRIPT_DIR}/installer/lib/requirements-${dist,,}-${code,,}.apt | tr '\n' ' ')"
else
loudCmd "DEBIAN_FRONTEND=noninteractive apt-get -y -m --force-yes install $(grep -vE '^\s*#' ${SCRIPT_DIR}/installer/lib/requirements-ubuntu-trusty.apt | tr '\n' ' ')"
fi
if [ "$in_place" = "t" ]; then
loudCmd "DEBIAN_FRONTEND=noninteractive apt-get -y -m --force-yes install git"
fi
set -e
else
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
checkCommandExists "${apache_bin}"
checkCommandExists "rabbitmqctl"
checkCommandExists "psql"
if [ "$in_place" = "t" ]; then
checkCommandExists "git"
fi
fi
2015-07-01 06:24:11 +02:00
# Check if composer exists and install if it doesn't
set +e
2015-07-01 06:24:11 +02:00
eval hash "composer" 2>/dev/null
commandFound=$?
set -e
2015-07-01 06:24:11 +02:00
if [[ ! ${commandFound} -eq 0 ]]; then
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
curl -sS https://getcomposer.org/installer > get-composer.php
php ./get-composer.php --install-dir=/usr/local/bin --filename=composer
rm get-composer.php
PATH="${PATH}:/usr/local/bin"
2015-07-01 06:24:11 +02:00
fi
# Run composer (install PHP dependencies) and create a VERSION file
loudCmd "./build.sh"
if [ -f /etc/airtime/airtime.conf ]; then
OLD_CONF=$(grep "[media-monitor]" /etc/airtime/airtime.conf)
if [ -n "${OLD_CONF}" ]; then
upgrade="t"
set +e
verbose "Stopping airtime services..."
loudCmd "service airtime-playout stop"
loudCmd "service airtime-media-monitor stop"
loudCmd "service airtime_analyzer stop"
loudCmd "service airtime-liquidsoap stop"
verbose "...Done"
echo "Looks like you have an old version of Airtime. Your current /etc/airtime/airtime.conf \
will be moved to /etc/airtime/airtime.conf.tmp"
# If we don't remove the existing python files in /usr/lib and the
# /etc/init.d startup scripts, services won't work properly
if [ -d /usr/lib/airtime/ ]; then
rm -rf /usr/lib/airtime/
fi
rm /etc/init.d/airtime-*
if [ "$apache" = "t" ]; then
# If the user selects an "in-place" install or passes in a web root,
# we need to replace the old apache airtime.conf
rm /etc/apache2/sites-available/airtime.conf
fi
if [ -d /usr/share/airtime -a web_root = /usr/share/airtime ]; then
rm -rf /usr/share/airtime
fi
mv /etc/airtime/airtime.conf /etc/airtime/airtime.conf.tmp
set -e
fi
fi
2014-12-11 21:55:16 +01:00
if [ "$apache" = "f" -a ${_i} -eq 1 ]; then
echo -e "Install default Airtime apache configuration? (Y/n): \c"
read IN
2014-12-15 15:54:15 +01:00
if [ "$IN" = "y" -o "$IN" = "Y" ]; then
2014-12-11 21:55:16 +01:00
apache="t"
fi
fi
if [ "$in_place" = "t" ]; then
verbose "\n * Setting current Airtime directory as web root..."
web_root=${AIRTIMEROOT}/airtime_mvc/public
elif [ -n "$web_root" ]; then
verbose "\n * Creating Apache web root directory..."
cp -R ${AIRTIMEROOT}/airtime_mvc ${web_root}
cp -R ${AIRTIMEROOT}/vendor ${web_root}
web_root=${web_root}/airtime_mvc/public/
else
verbose "\n * Creating default Apache web root directory /usr/share/airtime/php..."
web_root="/usr/share/airtime/php"
mkdir -p ${web_root}
cp -R ${AIRTIMEROOT}/airtime_mvc ${web_root}
cp -R ${AIRTIMEROOT}/vendor ${web_root}
web_root=${web_root}/airtime_mvc/public/
fi
verbose "...Done"
2014-12-11 18:58:34 +01:00
if [ "$apache" = "t" ]; then
loud "\n-----------------------------------------------------"
loud " * Configuring Apache * "
2014-12-11 18:58:34 +01:00
loud "-----------------------------------------------------"
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
apache_sitedir="/etc/apache2/sites-available/"
if [ "$dist" = "centos" ]; then
apache_sitedir="/etc/httpd/conf.d/"
fi
2014-12-11 18:58:34 +01:00
set +e
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
$apache_bin -v | grep "2\.4" > /dev/null
apacheversion=$?
set -e
if [ "$apacheversion" != "1" ]; then
airtimeconfigfile="airtime.conf"
2015-03-25 17:03:01 +01:00
oldconfigfile="airtime-vhost.conf"
else
airtimeconfigfile="airtime"
2015-03-25 17:03:01 +01:00
oldconfigfile="airtime-vhost"
fi
# If we're upgrading (installing over an existing Airtime install) and we've been told to
# install apache, we should overwrite any existing configuration. If we don't do this, doing
# an in-place installation over an old Airtime install (which installs to /usr/share by default)
# will fail
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
if [ "$upgrade" = "t" -o ! -f ${apache_sitedir}${airtimeconfigfile} ]; then
2014-12-11 18:58:34 +01:00
verbose "\n * Creating Apache config for Airtime..."
listen_port=""
if [ "$web_port" != "80" ]; then
2017-03-10 12:17:16 +01:00
listen_port="Listen ${web_port}"
fi
2015-01-20 23:31:59 +01:00
apache_template_file=${SCRIPT_DIR}/installer/apache/airtime-vhost-2.4
if [ "$apacheversion" = "1" ]; then
# fall back to apache 1 config
apache_template_file=${SCRIPT_DIR}/installer/apache/airtime-vhost
2015-01-20 23:31:59 +01:00
fi
sed \
2017-03-10 12:17:16 +01:00
-e "s@WEB_PORT_LISTEN@${listen_port}@g" \
-e "s@WEB_PORT@${web_port}@g" \
-e "s@WEB_ROOT@${web_root}@g" \
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
${apache_template_file} > ${apache_sitedir}${airtimeconfigfile}
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
if [ "$dist" != "centos" ]; then
loudCmd "a2dissite 000-default"
fi
2015-03-25 17:03:01 +01:00
# If Airtime was previously installed with apt, the vhost file name is different,
# so we need to specifically disable it.
if [ -f "/etc/apache2/sites-available/${oldconfigfile}" ]; then
loudCmd "a2dissite airtime-vhost"
fi
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
if [ "$dist" != "centos" ]; then
loudCmd "a2ensite airtime"
fi
else
2014-12-11 18:58:34 +01:00
verbose "\nApache config for Airtime already exists, skipping"
fi
2014-12-11 18:58:34 +01:00
fi
2014-12-16 18:24:41 +01:00
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
2014-12-15 15:54:15 +01:00
if [ "$icecast" = "t" ]; then
loud "\n-----------------------------------------------------"
loud " * Configuring Icecast * "
2014-12-15 15:54:15 +01:00
loud "-----------------------------------------------------"
verbose "\n * Enabling Icecast 2..."
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
icecast_unit_name="icecast2"
if [ "$dist" != "centos" ]; then
sed -i 's/ENABLE=false/ENABLE=true/g' /etc/default/icecast2
else
icecast_unit_name="icecast"
fi
2014-12-15 15:54:15 +01:00
set +e
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
# restart in case icecast was already started (like is the case on debian)
loudCmd "service ${icecast_unit_name} restart"
2014-12-15 15:54:15 +01:00
set -e
verbose "...Done"
2014-12-15 15:54:15 +01:00
fi
2014-12-16 18:24:41 +01:00
loud "\n-----------------------------------------------------"
2014-12-16 22:26:58 +01:00
loud " * Installing Airtime Services * "
2014-12-16 18:24:41 +01:00
loud "-----------------------------------------------------"
verbose "\n * Installing necessary python services..."
loudCmd "pip install setuptools --upgrade"
verbose "...Done"
2014-12-16 18:24:41 +01:00
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
# Ubuntu trusty needs a workaround for python version SSL downloads
# This affects all python installs where python < 2.7.9
use_pyopenssl=""
if [ "$dist" != "debian" ] || [ "$code" = "wheezy" ]; then
use_pyopenssl="t"
fi
if [ "$use_pyopenssl" = "t" ]; then
verbose "\n * Installing pyOpenSSL and ca db for SNI support..."
loudCmd "pip install pyOpenSSL cryptography idna certifi --upgrade"
verbose "...Done"
fi
verbose "\n * Creating /run/airtime..."
2014-12-16 22:26:58 +01:00
mkdir -p /run/airtime
chmod 755 /run/airtime
chown -R ${web_user}:${web_user} /run/airtime
verbose "...Done"
verbose "\n * Installing log writer..."
loudCmd "python ${AIRTIMEROOT}/python_apps/std_err_override/setup.py install --install-scripts=/usr/bin"
2014-12-17 01:05:17 +01:00
verbose "...Done"
verbose "\n * Installing API client..."
loudCmd "python ${AIRTIMEROOT}/python_apps/api_clients/setup.py install --install-scripts=/usr/bin"
verbose "...Done"
verbose "\n * Installing pypo and liquidsoap..."
loudCmd "python ${AIRTIMEROOT}/python_apps/pypo/setup.py install --install-scripts=/usr/bin"
verbose "...Done"
verbose "\n * Installing airtime-celery..."
loudCmd "python ${AIRTIMEROOT}/python_apps/airtime-celery/setup.py install"
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
# Make the airtime log directory group-writable
loudCmd "chmod 775 /var/log/airtime"
# Create the Celery user
if [ "$dist" = "centos" ]; then
loudCmd "id celery || adduser --no-create-home -c 'LibreTime Celery' -r celery || true"
loudCmd "systemctl enable airtime-celery"
else
loudCmd "id celery || adduser --no-create-home --gecos 'LibreTime Celery' --disabled-login --firstuid 1 --lastuid 999 celery"
loudCmd "update-rc.d airtime-celery defaults"
fi
# Add celery to the www-data group
loudCmd "usermod -G ${web_user} -a celery"
if [ "$dist" = "ubuntu" ]; then
loudCmd "initctl reload-configuration"
fi
2014-12-16 21:45:35 +01:00
verbose "...Done"
2014-12-16 18:24:41 +01:00
verbose "\n * Installing airtime_analyzer..."
loudCmd "python ${AIRTIMEROOT}/python_apps/airtime_analyzer/setup.py install --install-scripts=/usr/bin"
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
if [ "$dist" = "ubuntu" ]; then
loudCmd "initctl reload-configuration"
fi
verbose "...Done"
for i in /etc/init/airtime*.template; do
chmod 644 $i
sed -i "s/WEB_USER/${web_user}/g" $i
mv $i ${i%.template}
done
2015-03-16 17:22:17 +01:00
set +e
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
if [ "$dist" = "ubuntu" ]; then
loudCmd "initctl reload-configuration"
fi
# airtime-celery only has an init.d startup script
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
if [ "$dist" = "centos" ]; then
loudCmd "systemctl enable airtime-celery"
else
loudCmd "update-rc.d airtime-celery defaults" # Start at bootup, on Debian
fi
# On Ubuntu, we already have the upstart configs, so this is redundant
# and causes multiple processes to spawn on startup
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
if [ "$dist" = "debian" ]; then
loudCmd "systemctl daemon-reload" #systemd hipsters
loudCmd "update-rc.d airtime-playout defaults" # Start at bootup, on Debian
loudCmd "update-rc.d airtime-liquidsoap defaults" # Start at bootup, on Debian
loudCmd "update-rc.d airtime_analyzer defaults" # Start at bootup, on Debian
fi
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
if [ "$dist" = "centos" ]; then
loudCmd "systemctl enable airtime-playout"
loudCmd "systemctl enable airtime-liquidsoap"
loudCmd "systemctl enable airtime_analyzer"
fi
2015-03-16 17:22:17 +01:00
set -e
2014-12-11 18:58:34 +01:00
if [ ! -d /var/log/airtime ]; then
loud "\n-----------------------------------------------------"
loud " * Installing Log Files * "
loud "-----------------------------------------------------"
2014-12-16 21:02:53 +01:00
verbose "\n * Creating /var/tmp/airtime..."
mkdir -p /var/tmp/airtime/show-recorder/
verbose "\n * Copying logrotate files..."
2014-12-11 18:58:34 +01:00
cp ${AIRTIMEROOT}/airtime_mvc/build/airtime-php.logrotate /etc/logrotate.d/airtime-php
cp ${AIRTIMEROOT}/python_apps/pypo/pypo/liquidsoap_scripts/airtime-liquidsoap.logrotate /etc/logrotate.d/airtime-liquidsoap
2014-11-26 16:35:54 +01:00
fi
verbose "\n * Setting permissions on /var/log/airtime..."
chmod -R a+x /var/log/airtime
chown -R ${web_user}:${web_user} /var/log/airtime/
verbose "\n * Setting permissions on /var/tmp/airtime..."
chmod -R a+x /var/tmp/airtime
chown -R ${web_user}:${web_user} /var/tmp/airtime/
2014-11-26 16:35:54 +01:00
# PHP Config File for Apache
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
libretime_phpini="/etc/php5/apache2/conf.d/airtime.ini"
if [ "$dist" = "centos" ]; then
libretime_phpini="/etc/php.d/airtime.ini"
fi
if [ ! -f "${libretime_phpini}" ]; then
verbose "\n * Creating LibreTime PHP config for Apache..."
cp ${SCRIPT_DIR}/installer/php/airtime.ini ${libretime_phpini}
2014-11-26 16:35:54 +01:00
else
2014-12-11 18:58:34 +01:00
verbose "\nAirtime PHP config for Apache already exists, skipping"
2014-11-26 16:35:54 +01:00
fi
# Enable Apache modules
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
if [ "$dist" != "centos" ]; then
loudCmd "a2enmod rewrite php5"
fi
2014-11-26 16:35:54 +01:00
2014-12-11 18:58:34 +01:00
loud "\n-----------------------------------------------------"
loud " * Configuring PostgreSQL * "
2014-12-11 18:58:34 +01:00
loud "-----------------------------------------------------"
2014-11-26 16:35:54 +01:00
2015-03-16 17:22:17 +01:00
# Ensure postgres is running - It isn't after you install the postgres package on Ubuntu 15.04
loudCmd "service postgresql start"
2014-12-11 21:55:16 +01:00
setupAirtimePostgresUser() {
2014-12-15 15:54:15 +01:00
# here-doc to execute this block as postgres user
2014-12-11 22:42:05 +01:00
su postgres <<'EOF'
2014-12-16 18:24:41 +01:00
set +e
2014-12-11 21:55:16 +01:00
psql -d postgres -tAc "CREATE USER airtime WITH ENCRYPTED PASSWORD 'airtime'; ALTER USER airtime CREATEDB;"
2014-12-16 18:24:41 +01:00
set -e
2014-12-15 15:54:15 +01:00
# don't indent this!
2014-12-11 22:42:05 +01:00
EOF
2014-12-11 21:55:16 +01:00
}
2014-12-15 15:54:15 +01:00
if [ "$postgres" = "t" ]; then
2014-12-11 21:55:16 +01:00
setupAirtimePostgresUser
elif [ ${_i} -eq 1 ]; then
echo -e "Create default airtime postgres user? (Y/n): \c"
read IN
if [ "$IN" = "y" -o "$IN" = "Y" ]; then
setupAirtimePostgresUser
fi
fi
2014-11-26 16:35:54 +01:00
2014-12-11 18:58:34 +01:00
loud "\n-----------------------------------------------------"
loud " * Configuring RabbitMQ * "
2014-12-11 18:58:34 +01:00
loud "-----------------------------------------------------"
2014-11-26 16:35:54 +01:00
RABBITMQ_VHOST=/airtime
RABBITMQ_USER=airtime
RABBITMQ_PASSWORD=airtime
EXCHANGES="airtime-pypo|pypo-fetch|airtime-media-monitor|media-monitor"
2014-11-26 16:35:54 +01:00
2014-12-12 01:16:18 +01:00
# Ignore errors in this check to avoid dying when vhost isn't found
set +e
rabbitmqctl list_vhosts | grep -w "^${RABBITMQ_VHOST}$" > /dev/null
RESULT="$?"
2014-12-12 01:16:18 +01:00
set -e
2014-11-26 16:35:54 +01:00
2014-12-12 01:16:18 +01:00
# Only run these if the vhost doesn't exist
2014-12-15 15:54:15 +01:00
if [ "$RESULT" != "0" ]; then
2014-12-11 18:58:34 +01:00
verbose "\n * Creating RabbitMQ user ${RABBITMQ_USER}..."
rabbitmqctl add_vhost ${RABBITMQ_VHOST}
rabbitmqctl add_user ${RABBITMQ_USER} ${RABBITMQ_PASSWORD}
2014-12-09 23:48:16 +01:00
else
2014-12-11 18:58:34 +01:00
verbose "\nRabbitMQ user already exists, skipping creation"
fi
2014-11-26 16:35:54 +01:00
2014-12-11 18:58:34 +01:00
verbose "\n * Setting RabbitMQ user permissions..."
#loudCmd "rabbitmqctl set_permissions -p ${RABBITMQ_VHOST} ${RABBITMQ_USER} \"$EXCHANGES\" \"$EXCHANGES\" \"$EXCHANGES\""
loudCmd "rabbitmqctl set_permissions -p ${RABBITMQ_VHOST} ${RABBITMQ_USER} .\* .\* .\*"
2014-12-09 23:48:16 +01:00
2014-12-11 18:58:34 +01:00
if [ ! -d "/etc/airtime" ]; then
loud "\n-----------------------------------------------------"
loud " * Installing Airtime * "
loud "-----------------------------------------------------"
verbose "\n * Creating /etc/airtime/ directory..."
mkdir /etc/airtime
# workaround for reintegrated airtime-saas dir, will get removed after we refactored config loading
ln -s /etc/airtime/ /etc/airtime/production
# put the default cloud_storage.conf using local file storage into directory
cp ${AIRTIMEROOT}/airtime_mvc/build/cloud_storage.conf /etc/airtime/cloud_storage.conf
2014-12-11 18:58:34 +01:00
fi
chown -R ${web_user}:${web_user} /etc/airtime
2014-12-09 23:48:16 +01:00
2014-12-15 15:54:15 +01:00
if [ ! -d "/srv/airtime" ]; then
mkdir -p /srv/airtime
2014-12-16 18:24:41 +01:00
fi
chown -R ${web_user}:${web_user} /srv/airtime
2014-12-16 18:24:41 +01:00
# We only generate the locales for Airtime if you're allowing us
# to install our dependencies, so that we won't automatically do this
# when this install script runs from our DEB package.
if [ "$ignore_dependencies" = "f" ]; then
2014-12-15 15:54:15 +01:00
loud "\n-----------------------------------------------------"
loud " * Installing Locales * "
2014-12-15 15:54:15 +01:00
loud "-----------------------------------------------------"
set +e
verbose "\n * Generating locales"
for i in `ls ${web_root}/../locale | grep ".._.."`; do
if [ "$dist" = "debian" ]; then
grep -qi "^$i" /etc/locale.gen
if [ $? -ne 0 ]; then
verbose "$i.UTF-8 UTF-8" >> /etc/locale.gen
fi
else
loudCmd "locale-gen \"$i.utf8\""
fi
done
set -e
if [ "$dist" = "debian" ]; then
loudCmd "/usr/sbin/locale-gen"
fi
2014-12-15 15:54:15 +01:00
fi
2017-03-13 14:10:29 +01:00
# If the user requested it we run restorecon on files that need
# tagging for selinux.
if [ "$selinux" = "t" ]; then
loud "\n-----------------------------------------------------"
loud " * Restoring SELinux Tags * "
loud "-----------------------------------------------------"
verbose "\n * Running restorecon..."
loudCmd "restorecon -Rv /etc/airtime /srv/airtime > /dev/null 2>&1"
verbose "...Done"
fi
verbose "\n * Reloading apache..."
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
if [ "$dist" != "centos" ]; then
loudCmd "service ${apache_bin} reload 2>/dev/null"
verbose "...Done"
IP=$(ifconfig eth0 2>/dev/null|awk '/inet addr:/ {print $2}'|sed 's/addr://')
else
verbose "systemctl restart ${apache_bin} 2>/dev/null"
loudCmd "systemctl restart ${apache_bin} 2>/dev/null"
verbose "...Done"
2014-12-09 23:48:16 +01:00
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
IP=$(ip -o -4 address show dev eth0 | grep -Po 'inet \K[\d.]+')
fi
2015-01-16 23:20:50 +01:00
2014-11-26 16:35:54 +01:00
echo -e "\n-----------------------------------------------------"
echo " * Basic Setup DONE! * "
echo " "
2015-01-16 23:20:50 +01:00
echo " To get started with Airtime, visit ${IP} "
echo " or, if you've set up your own web configuration, "
echo " the Airtime webroot on your webserver "
echo "-----------------------------------------------------"