Fixes to install & uninstall procedure

This commit is contained in:
Duncan Sommerville 2015-01-15 17:33:47 -05:00
parent 53b93d01ef
commit 4552089c19
5 changed files with 227 additions and 221 deletions

View file

@ -79,8 +79,11 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
} }
protected function _initUpgrade() { protected function _initUpgrade() {
Logging::info("Checking if upgrade is needed...");
if (AIRTIME_CODE_VERSION > Application_Model_Preference::GetAirtimeVersion()) { if (AIRTIME_CODE_VERSION > Application_Model_Preference::GetAirtimeVersion()) {
// This line is actually fairly important (incidentally) because it
// instantiates the logger singleton, which in turn decides the Airtime PHP error policy,
// otherwise we would trip up on the '#' characters in airtime.conf
Logging::info("Checking if upgrade is needed...");
$upgradeManager = new UpgradeManager(); $upgradeManager = new UpgradeManager();
$upgradeManager->runUpgrades(array(new AirtimeUpgrader252()), (__DIR__ . "/controllers")); $upgradeManager->runUpgrades(array(new AirtimeUpgrader252()), (__DIR__ . "/controllers"));
} }

View file

@ -10,7 +10,7 @@
<h3 class="form-title">Database Settings</h3> <h3 class="form-title">Database Settings</h3>
<span id="helpBlock" class="help-block help-message"></span> <span id="helpBlock" class="help-block help-message"></span>
<p> <p>
Enter your Airtime database settings here. Empty or non-existent database names will be created and populated Enter your Airtime database settings here. Empty or non-existent databases will be created and populated
if the given user has administrative permissions in postgres. if the given user has administrative permissions in postgres.
</p> </p>
<div class="form-group"> <div class="form-group">

View file

@ -1,42 +1,42 @@
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; A I R T I M E C O N F I G U R A T I O N # A I R T I M E C O N F I G U R A T I O N
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; #
; This is an example configuration for Airtime. If you just want to # This is an example configuration for Airtime. If you just want to
; get started with a basic Airtime setup, or don't know if you should # get started with a basic Airtime setup, or don't know if you should
; be reconfiguring any of the following values, just rename this file # be reconfiguring any of the following values, just rename this file
; to 'airtime.conf'. # to 'airtime.conf'.
; #
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; G E N E R A L S E T T I N G S # G E N E R A L S E T T I N G S
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; #
; These settings are used for Airtime's webserver configuration, and # These settings are used for Airtime's webserver configuration, and
; for general-purpose properties. # for general-purpose properties.
; #
; api_key: The API key for your Airtime installation. # api_key: The API key for your Airtime installation.
; The value is generated the first time you use Airtime. # The value is generated the first time you use Airtime.
; #
; web_server_user: The default webserver user. # web_server_user: The default webserver user.
; The default is www-data. # The default is www-data.
; #
; base_url: The host name for your webserver. # base_url: The host name for your webserver.
; The default is localhost. # The default is localhost.
; #
; base_port: The port for your webserver. # base_port: The port for your webserver.
; The default is 80. # The default is 80.
; #
; base_dir: The root directory for your Airtime installation # base_dir: The root directory for your Airtime installation
; on your webserver, relative to the base_url. # on your webserver, relative to the base_url.
; The default is /. # The default is /.
; #
; cache_ahead_hours: How many hours ahead of time the Airtime playout # 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. # The default is 1.
; #
[general] [general]
api_key = api_key =
web_server_user = www-data web_server_user = www-data
@ -44,99 +44,99 @@ base_url = localhost
base_port = 80 base_port = 80
base_dir = / base_dir = /
cache_ahead_hours = 1 cache_ahead_hours = 1
; #
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; D A T A B A S E # D A T A B A S E
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; #
; These settings are used to configure your database connection. # These settings are used to configure your database connection.
; #
; host: The hostname of the database server. # host: The hostname of the database server.
; On a default Airtime installation, set this to localhost. # On a default Airtime installation, set this to localhost.
; #
; dbname: The name of the Airtime database. # dbname: The name of the Airtime database.
; The default is airtime. # The default is airtime.
; #
; dbuser: The username for the Airtime database user. # dbuser: The username for the Airtime database user.
; The default is airtime. # The default is airtime.
; #
; dbpass: The password for the Airtime database user. # dbpass: The password for the Airtime database user.
; The default is airtime. # The default is airtime.
; #
[database] [database]
host = localhost host = localhost
dbname = airtime dbname = airtime
dbuser = airtime dbuser = airtime
dbpass = airtime dbpass = airtime
; #
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; R A B B I T M Q # R A B B I T M Q
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; #
; These settings are used to configure the RabbitMQ messaging # These settings are used to configure the RabbitMQ messaging
; configuration for your Airtime installation. # configuration for your Airtime installation.
; #
; host: The IP address for the RabbitMQ service. # host: The IP address for the RabbitMQ service.
; The default is 127.0.0.1. # The default is 127.0.0.1.
; #
; port: The port for the RabbitMQ service. # port: The port for the RabbitMQ service.
; The default is 5672. # The default is 5672.
; #
; user: The username for the RabbitMQ user. # user: The username for the RabbitMQ user.
; The default is airtime. # The default is airtime.
; #
; password: The password for the RabbitMQ user. # password: The password for the RabbitMQ user.
; The default is airtime. # The default is airtime.
; #
; vhost: The virtual host for the RabbitMQ service database. # vhost: The virtual host for the RabbitMQ service database.
; The default is /airtime. # The default is /airtime.
; #
[rabbitmq] [rabbitmq]
host = 127.0.0.1 host = 127.0.0.1
port = 5672 port = 5672
user = airtime user = airtime
password = airtime password = airtime
vhost = /airtime vhost = /airtime
; #
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; M E D I A M O N I T O R # M E D I A M O N I T O R
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; #
; check_filesystem_events: How long to queue up events performed on the # check_filesystem_events: How long to queue up events performed on the
; files themselves, in seconds # files themselves, in seconds
; The default is 5 # 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 # in seconds
; The default is 30 # The default is 30
; #
; touch_interval: # touch_interval:
; The default is 5 # The default is 5
; #
; chunking_number: # chunking_number:
; The default is 450 # The default is 450
; #
; request_max_wait: The maximum request wait time, in seconds # request_max_wait: The maximum request wait time, in seconds
; The default is 3.0 # The default is 3.0
; #
; rmq_event_wait: The RabbitMQ event wait time, in seconds # rmq_event_wait: The RabbitMQ event wait time, in seconds
; The default is 0.1 # The default is 0.1
; #
; logpath: The media monitor log file path # logpath: The media monitor log file path
; The default is '/var/log/airtime/media-monitor/media-monitor.log' # The default is '/var/log/airtime/media-monitor/media-monitor.log'
; #
; index_path: The media monitor index path # index_path: The media monitor index path
; The default is '/var/tmp/airtime/media-monitor/last_index' # The default is '/var/tmp/airtime/media-monitor/last_index'
; #
[media-monitor] [media-monitor]
check_filesystem_events = 5 check_filesystem_events = 5
check_airtime_events = 30 check_airtime_events = 30
@ -146,129 +146,129 @@ request_max_wait = 3.0
rmq_event_wait = 0.1 rmq_event_wait = 0.1
logpath = '/var/log/airtime/media-monitor/media-monitor.log' logpath = '/var/log/airtime/media-monitor/media-monitor.log'
index_path = '/var/tmp/airtime/media-monitor/last_index' index_path = '/var/tmp/airtime/media-monitor/last_index'
; #
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; P Y P O # P Y P O
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; #
; api_client: Set the type of client you are using. # api_client: Set the type of client you are using.
; Currently supported types: # Currently supported types:
; 1) 'obp' = Open Broadcast Platform # 1) 'obp' = Open Broadcast Platform
; 2) 'airtime' # 2) 'airtime'
; The default is 'airtime' # The default is 'airtime'
; #
; cache_dir: The directory for pypo cache files # cache_dir: The directory for pypo cache files
; The default is '/var/tmp/airtime/pypo/cache/' # The default is '/var/tmp/airtime/pypo/cache/'
; #
; file_dir: The directory for pypo media files # file_dir: The directory for pypo media files
; The default is '/var/tmp/airtime/pypo/files/' # The default is '/var/tmp/airtime/pypo/files/'
; #
; tmp_dir: The directory for pypo temp files # tmp_dir: The directory for pypo temp files
; The default is '/var/tmp/airtime/pypo/tmp/' # The default is '/var/tmp/airtime/pypo/tmp/'
; #
; cache_base_dir: The pypo base cache directory # cache_base_dir: The pypo base cache directory
; The default is '/var/tmp/airtime/pypo/' # The default is '/var/tmp/airtime/pypo/'
; #
; log_base_dir: The base directory for Airtime log files # log_base_dir: The base directory for Airtime log files
; The default is '/var/log/airtime' # The default is '/var/log/airtime'
; #
; pypo_log_dir: The directory for pypo log files # pypo_log_dir: The directory for pypo log files
; The default is '/var/log/airtime/pypo' # The default is '/var/log/airtime/pypo'
; #
; liquidsoap_log_dir: The directory for liquidsoap log files # liquidsoap_log_dir: The directory for liquidsoap log files
; The default is '/var/log/airtime/pypo-liquidsoap' # The default is '/var/log/airtime/pypo-liquidsoap'
; #
; ls_host: Liquidsoap connection host # ls_host: Liquidsoap connection host
; The default is '127.0.0.1' # The default is '127.0.0.1'
; #
; ls_port: Liquidsoap connection port # ls_port: Liquidsoap connection port
; The default is '1234' # The default is '1234'
; #
; poll_interval: Poll interval in seconds # poll_interval: Poll interval in seconds
; #
; This will rarely need to be changed because any schedule # This will rarely need to be changed because any schedule
; changes are automatically sent to pypo immediately # changes are automatically sent to pypo immediately
; This is how often the poll script downloads new schedules # This is how often the poll script downloads new schedules
; and files from the server in the event that no changes # and files from the server in the event that no changes
; are made to the schedule # are made to the schedule
; The default is 3600 # The default is 3600
; #
; push_interval: Push interval in seconds # push_interval: Push interval in seconds
; #
; This is how often the push script checks whether it has # This is how often the push script checks whether it has
; something new to push to liquidsoap # something new to push to liquidsoap
; The default is 1 # The default is 1
; #
; cue_style: Can be set to 'pre' or 'otf' # cue_style: Can be set to 'pre' or 'otf'
; 'pre' cues while playlist preparation # 'pre' cues while playlist preparation
; 'otf' (on the fly) cues while loading into ls # 'otf' (on the fly) cues while loading into ls
; (needs the post_processor patch) # (needs the post_processor patch)
; The default is 'pre' # The default is 'pre'
; #
; record_bitrate: The bitrate for recordings # record_bitrate: The bitrate for recordings
; The default is 256 # The default is 256
; #
; record_samplerate: The samplerate for recordings # record_samplerate: The samplerate for recordings
; The default is 44100 # The default is 44100
; #
; record_channels: The number of channels for recordings # record_channels: The number of channels for recordings
; The default is 2 # The default is 2
; #
; record_sample_size: The sample size for recordings # record_sample_size: The sample size for recordings
; The default is 16 # The default is 16
; #
; record_file_type: Can be either ogg|mp3, mp3 recording requires # record_file_type: Can be either ogg|mp3, mp3 recording requires
; installation of the package "lame" # installation of the package "lame"
; The default is ogg # The default is ogg
; #
; base_recorded_files: Base path to store recordered shows at # base_recorded_files: Base path to store recordered shows at
; The default is '/var/tmp/airtime/show-recorder/' # The default is '/var/tmp/airtime/show-recorder/'
; #
[pypo] [pypo]
api_client = 'airtime' api_client = 'airtime'
; ---------- Cache directories - !! Include trailing slash !! ---------- # ---------- Cache directories - !! Include trailing slash !! ----------
cache_dir = '/var/tmp/airtime/pypo/cache/' cache_dir = '/var/tmp/airtime/pypo/cache/'
file_dir = '/var/tmp/airtime/pypo/files/' file_dir = '/var/tmp/airtime/pypo/files/'
tmp_dir = '/var/tmp/airtime/pypo/tmp/' tmp_dir = '/var/tmp/airtime/pypo/tmp/'
; ------- Setup directories - !! Don't include trailing slash !! ------- # ------- Setup directories - !! Don't include trailing slash !! -------
cache_base_dir = '/var/tmp/airtime/pypo' cache_base_dir = '/var/tmp/airtime/pypo'
log_base_dir = '/var/log/airtime' log_base_dir = '/var/log/airtime'
pypo_log_dir = '/var/log/airtime/pypo' pypo_log_dir = '/var/log/airtime/pypo'
liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap' liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap'
; ------------------------ Liquidsoap Settings ------------------------- # ------------------------ Liquidsoap Settings -------------------------
ls_host = '127.0.0.1' ls_host = '127.0.0.1'
ls_port = '1234' ls_port = '1234'
; -------------------------- Pypo Preferences -------------------------- # -------------------------- Pypo Preferences --------------------------
poll_interval = 3600 poll_interval = 3600
push_interval = 1 push_interval = 1
cue_style = 'pre' cue_style = 'pre'
; ---------------------- Recorded Audio Settings ----------------------- # ---------------------- Recorded Audio Settings -----------------------
record_bitrate = 256 record_bitrate = 256
record_samplerate = 44100 record_samplerate = 44100
record_channels = 2 record_channels = 2
record_sample_size = 16 record_sample_size = 16
record_file_type = 'ogg' record_file_type = 'ogg'
base_recorded_files = '/var/tmp/airtime/show-recorder/' base_recorded_files = '/var/tmp/airtime/show-recorder/'
; #
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; S O U N D C L O U D # S O U N D C L O U D
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------
; #
; connection_retries: The number of times to retry the connection to # connection_retries: The number of times to retry the connection to
; Soundcloud. # Soundcloud.
; The default is 3. # The default is 3.
; #
; time_between_retries: The time between connection retries, in seconds. # time_between_retries: The time between connection retries, in seconds.
; The default is 60. # The default is 60.
; #
[soundcloud] [soundcloud]
connection_retries = 3 connection_retries = 3
time_between_retries = 60 time_between_retries = 60
; #
; ---------------------------------------------------------------------- # ----------------------------------------------------------------------

View file

@ -21,7 +21,7 @@ else:
('/etc/init', ['install/airtime-playout.conf.template']), ('/etc/init', ['install/airtime-playout.conf.template']),
('/etc/init', ['install/airtime-liquidsoap.conf.template']), ('/etc/init', ['install/airtime-liquidsoap.conf.template']),
('/var/log/airtime/pypo', []), ('/var/log/airtime/pypo', []),
('/var/log/airtime/pypo/liquidsoap', []), ('/var/log/airtime/pypo-liquidsoap', []),
('/var/tmp/airtime/pypo', []), ('/var/tmp/airtime/pypo', []),
('/var/tmp/airtime/pypo/cache', []), ('/var/tmp/airtime/pypo/cache', []),
('/var/tmp/airtime/pypo/files', []), ('/var/tmp/airtime/pypo/files', []),

View file

@ -31,8 +31,13 @@ EOF
} }
removeRabbitmqAirtimeSettings() { removeRabbitmqAirtimeSettings() {
if [ -f /etc/airtime/airtime.conf ]; then
RMQ_VHOST=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^vhost/ ) print $2}' /etc/airtime/airtime.conf) RMQ_VHOST=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^vhost/ ) print $2}' /etc/airtime/airtime.conf)
RMQ_USER=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^user/ ) print $2}' /etc/airtime/airtime.conf) RMQ_USER=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^user/ ) print $2}' /etc/airtime/airtime.conf)
else
RMQ_VHOST=/airtime
RMQ_USER=airtime
fi
rabbitmqctl delete_vhost ${RMQ_VHOST} rabbitmqctl delete_vhost ${RMQ_VHOST}
rabbitmqctl delete_user ${RMQ_USER} rabbitmqctl delete_user ${RMQ_USER}
@ -82,15 +87,13 @@ else
fi fi
echo -e "\nUninstalling Airtime..." echo -e "\nUninstalling Airtime..."
if [ -f /etc/airtime/airtime.conf ]; then
removeRabbitmqAirtimeSettings removeRabbitmqAirtimeSettings
fi
for i in ${FILES[*]}; do for i in ${FILES[*]}; do
rm -rf $i rm -rf $i
done done
echo -e "\Do you want to drop your current Airtime database? (Y/n): \c" echo -e "\nDo you want to drop your current Airtime database? (Y/n): \c"
read IN read IN
if [[ "$IN" = "y" || "$IN" = "Y" ]]; then if [[ "$IN" = "y" || "$IN" = "Y" ]]; then
echo -e "\nDropping Airtime database..." echo -e "\nDropping Airtime database..."