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
```
This commit is contained in:
Lucas Bickel 2017-03-08 12:39:59 +01:00
parent c8b4d40eb2
commit c29285ae48
19 changed files with 448 additions and 201 deletions

View file

@ -31,18 +31,6 @@ def postinst():
# permissions for the defaults config file
os.chmod('/etc/init.d/airtime-celery', 0755)
os.chmod('/etc/default/airtime-celery', 0640)
# Make the airtime log directory group-writable
os.chmod('/var/log/airtime', 0775)
# Create the Celery user
call(['adduser', '--no-create-home', '--gecos', '', '--disabled-login', '--firstuid', '1', '--lastuid', '999', 'celery'])
# Add celery to the www-data group
call(['usermod', '-G', 'www-data', '-a', 'celery'])
print "Reloading initctl configuration"
call(['initctl', 'reload-configuration'])
print "Setting Celery to start on boot"
call(['update-rc.d', 'airtime-celery', 'defaults'])
print "Run \"sudo service airtime-celery restart\" now."
setup(name='airtime-celery',

View file

@ -0,0 +1,78 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: airtime_analyzer
# Required-Start: $local_fs $remote_fs $network $syslog $all
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Manage airtime_analyzer daemon
### END INIT INFO
USERID=www-data
GROUPID=www-data
NAME=airtime_analyzer
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
start () {
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
}
stop () {
# Send TERM after 5 seconds, wait at most 30 seconds.
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
rm -f $PIDFILE
}
case "${1:-''}" in
'start')
# start commands here
echo -n "Starting $NAME: "
start
echo "Done."
;;
'stop')
# stop commands here
echo -n "Stopping $NAME: "
stop
echo "Done."
;;
'restart')
# restart commands here
echo -n "Restarting $NAME: "
stop
start
echo "Done."
;;
'force-reload')
# reload commands here
echo -n "Reloading $NAME: "
stop
start
echo "Done."
;;
'status')
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*) # no parameter specified
echo "Usage: $SELF start|stop|restart|status"
exit 1
;;
esac

View file

@ -14,7 +14,8 @@ if '--no-init-script' in sys.argv:
data_files = []
sys.argv.remove('--no-init-script') # super hax
else:
data_files = [('/etc/init', ['install/upstart/airtime_analyzer.conf'])]
data_files = [('/etc/init', ['install/upstart/airtime_analyzer.conf']),
('/etc/init.d', ['install/sysvinit/airtime_analyzer'])]
print data_files
setup(name='airtime_analyzer',