From 8ec6eb0140af90081ab62e2c68ae2a46c091cc91 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Tue, 16 Dec 2014 15:02:53 -0500 Subject: [PATCH] More work on monitless installer --- airtime_mvc/build/airtime.example.conf | 144 ++++++++++++++++++++++--- installer/install | 51 ++++++--- 2 files changed, 164 insertions(+), 31 deletions(-) diff --git a/airtime_mvc/build/airtime.example.conf b/airtime_mvc/build/airtime.example.conf index cb1a71930..5ca59909c 100644 --- a/airtime_mvc/build/airtime.example.conf +++ b/airtime_mvc/build/airtime.example.conf @@ -34,7 +34,7 @@ # The default is /. # # cache_ahead_hours: How many hours ahead of time the Airtime playout -# engine (PYPO) should cache scheduled media files. +# engine (pypo) should cache scheduled media files. # The default is 1. # [general] @@ -128,31 +128,33 @@ monit_password = airtime # M E D I A M O N I T O R # ---------------------------------------------------------------------- # -# api_client: ??? -# -# bin_dir: Directory containing media monitor binaries -# -# log_dir: Directory containing media monitor log files -# # check_filesystem_events: How long to queue up events performed on the -# files themselves +# files themselves, in seconds +# The default is 5 # -# check_airtime_events: How long to queue metadata input from airtime +# check_airtime_events: How long to queue metadata input from airtime, +# in seconds +# The default is 30 # -# touch_interval +# touch_interval: +# The default is 5 # -# chunking_number +# chunking_number: +# The default is 450 # -# request_max_wait +# request_max_wait: The maximum request wait time, in seconds +# The default is 3.0 # -# rmq_event_wait +# rmq_event_wait: The RabbitMQ event wait time, in seconds +# The default is 0.1 # -# logpath +# logpath: The media monitor log file path +# The default is '/var/log/airtime/media-monitor/media-monitor.log' # -# index_path +# index_path: The media monitor index path +# The default is '/var/tmp/airtime/media-monitor/last_index' # [media-monitor] -api_client = "airtime" check_filesystem_events = 5 check_airtime_events = 30 touch_interval = 5 @@ -165,6 +167,116 @@ index_path = '/var/tmp/airtime/media-monitor/last_index' # ---------------------------------------------------------------------- +# ---------------------------------------------------------------------- +# P Y P O +# ---------------------------------------------------------------------- +# +# api_client: Set the type of client you are using. +# Currently supported types: +# 1) 'obp' = Open Broadcast Platform +# 2) 'airtime' +# The default is 'airtime' +# +# cache_dir: The directory for pypo cache files +# The default is '/var/tmp/airtime/pypo/cache/' +# +# file_dir: The directory for pypo media files +# The default is '/var/tmp/airtime/pypo/files/' +# +# tmp_dir: The directory for pypo temp files +# The default is '/var/tmp/airtime/pypo/tmp/' +# +# cache_base_dir: The pypo base cache directory +# The default is '/var/tmp/airtime/pypo/' +# +# bin_dir: The directory containing pypo binaries +# The default is '/usr/lib/airtime/pypo' +# +# log_base_dir: The base directory for Airtime log files +# The default is '/var/log/airtime' +# +# pypo_log_dir: The directory for pypo log files +# The default is '/var/log/airtime/pypo' +# +# liquidsoap_log_dir: The directory for liquidsoap log files +# The default is '/var/log/airtime/pypo-liquidsoap' +# +# ls_host: Liquidsoap connection host +# The default is '127.0.0.1' +# +# ls_port: Liquidsoap connection port +# The default is '1234' +# +# poll_interval: Poll interval in seconds +# +# This will rarely need to be changed because any schedule +# changes are automatically sent to pypo immediately +# This is how often the poll script downloads new schedules +# and files from the server in the event that no changes +# are made to the schedule +# The default is 3600 +# +# push_interval: Push interval in seconds +# +# This is how often the push script checks whether it has +# something new to push to liquidsoap +# The default is 1 +# +# cue_style: Can be set to 'pre' or 'otf' +# 'pre' cues while playlist preparation +# 'otf' (on the fly) cues while loading into ls +# (needs the post_processor patch) +# The default is 'pre' +# +# record_bitrate: The bitrate for recordings +# The default is 256 +# +# record_samplerate: The samplerate for recordings +# The default is 44100 +# +# record_channels: The number of channels for recordings +# The default is 2 +# +# record_sample_size: The sample size for recordings +# The default is 16 +# +# record_file_type: Can be either ogg|mp3, mp3 recording requires +# installation of the package "lame" +# The default is ogg +# +# base_recorded_files: Base path to store recordered shows at +# The default is '/var/tmp/airtime/show-recorder/' +# +[pypo] +api_client = 'airtime' +# ---------- Cache directories - !! Include trailing slash !! ---------- +cache_dir = '/var/tmp/airtime/pypo/cache/' +file_dir = '/var/tmp/airtime/pypo/files/' +tmp_dir = '/var/tmp/airtime/pypo/tmp/' +# ------- Setup directories - !! Don't include trailing slash !! ------- +cache_base_dir = '/var/tmp/airtime/pypo' +bin_dir = '/usr/lib/airtime/pypo' +log_base_dir = '/var/log/airtime' +pypo_log_dir = '/var/log/airtime/pypo' +liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap' +# ------------------------ Liquidsoap Settings ------------------------- +ls_host = '127.0.0.1' +ls_port = '1234' +# -------------------------- Pypo Preferences -------------------------- +poll_interval = 3600 +push_interval = 1 +cue_style = 'pre' +# ---------------------- Recorded Audio Settings ----------------------- +record_bitrate = 256 +record_samplerate = 44100 +record_channels = 2 +record_sample_size = 16 +record_file_type = 'ogg' +base_recorded_files = '/var/tmp/airtime/show-recorder/' +# +# ---------------------------------------------------------------------- + + # ---------------------------------------------------------------------- # S O U N D C L O U D # ---------------------------------------------------------------------- diff --git a/installer/install b/installer/install index c2db7eae5..603890abf 100755 --- a/installer/install +++ b/installer/install @@ -314,6 +314,7 @@ if [ "$icecast" = "t" ]; then set -e fi + loud "\n-----------------------------------------------------" loud " * Installing Python Apps * " loud "-----------------------------------------------------" @@ -324,10 +325,6 @@ loudCmd "$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh" verbose "\n * Installing liquidsoap..." loudCmd "apt-get -y --force-yes install liquidsoap" -# ------------ Activate virtualenv ------------ -virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" -. ${virtualenv_bin}activate - verbose "\n * Installing API client..." cp -R ${AIRTIMEROOT}/python_apps/api_clients /usr/lib/airtime/api_clients @@ -335,7 +332,7 @@ verbose "\n * Copying media-monitor files..." 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 -sed -e "s@WEB_USER@${web_user}@g" /usr/lib/airtime/media-monitor/airtime-media-monitor-init-d > /etc/init.d/airtime-media-monitor +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, \ /sbin/stop airtime-media-monitor, \ @@ -343,19 +340,23 @@ echo "${web_user} ALL = (root) NOPASSWD: /sbin/start airtime-media-monitor, \ /sbin/status airtime-media-monitor" > /etc/sudoers.d/airtime-media-monitor_${web_user} verbose "\n * Copying pypo files..." -python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py +cp -R ${AIRTIMEROOT}/python_apps/pypo /usr/lib/airtime/pypo/bin/ -verbose "\n * Initializing media monitor..." -python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-initialize.py +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, \ + /sbin/stop airtime-playout, \ + /sbin/restart airtime-playout, \ + /sbin/status airtime-playout" > /etc/sudoers.d/airtime-playout_${web_user} -verbose "\n * Initializing pypo..." -python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py +sed -e "s/WEB_USER/${web_user}/g" /usr/lib/airtime/pypo/bin/airtime-liquidsoap-init-d > /etc/init.d/airtime-liquidsoap +touch /etc/sudoers.d/airtime-liquidsoap_${web_user} +echo "${web_user} ALL = (root) NOPASSWD: /sbin/start airtime-liquidsoap, \ + /sbin/stop airtime-liquidsoap, \ + /sbin/restart airtime-liquidsoap, \ + /sbin/status airtime-liquidsoap" > /etc/sudoers.d/airtime-liquidsoap_${web_user} -loudCmd "service airtime-media-monitor restart 2>/dev/null" -loudCmd "service airtime-playout restart 2>/dev/null" - -deactivate -# ------------ Deactivate virtualenv ------------ +# Do we need to run the init scripts for media-monitor and pypo here? if [ ! -d /var/log/airtime ]; then loud "\n-----------------------------------------------------" @@ -365,9 +366,29 @@ if [ ! -d /var/log/airtime ]; then verbose "\n * Creating /var/log/airtime..." mkdir -p /var/log/airtime mkdir -p /var/log/airtime/media-monitor + mkdir -p /var/log/airtime/pypo + mkdir -p /var/log/airtime/pypo-liquidsoap + + verbose "\n * Creating /var/tmp/airtime..." + mkdir -p /var/tmp/airtime/media-monitor + mkdir -p /var/tmp/airtime/pypo/cache/ + mkdir -p /var/tmp/airtime/pypo/files/ + mkdir -p /var/tmp/airtime/pypo/tmp/ + mkdir -p /var/tmp/airtime/show-recorder/ + + 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 + chmod 755 /usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh + chown -R ${web_user}:${web_user} /var/tmp/airtime/ + chown -R ${web_user}:${web_user} /usr/lib/airtime/ + + verbose "\n * Copying logrotate files..." cp ${AIRTIMEROOT}/airtime_mvc/build/airtime-php.logrotate /etc/logrotate.d/airtime-php + cp /usr/lib/airtime/pypo/bin/liquidsoap_scripts/airtime-liquidsoap.logrotate /etc/logrotate.d/airtime-liquidsoap fi loud "\n-----------------------------------------------------"