From a52e9051550b157c16edf10dea4414a836857796 Mon Sep 17 00:00:00 2001 From: robbt Date: Mon, 11 May 2020 10:13:35 -0400 Subject: [PATCH 01/11] Added form - need to add CORS to db code --- .../airtime-setup/forms/general-settings.php | 18 ++++++++++++++++++ .../build/airtime-setup/setup-config.php | 2 +- airtime_mvc/public/setup/general-setup.php | 5 +++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/build/airtime-setup/forms/general-settings.php b/airtime_mvc/build/airtime-setup/forms/general-settings.php index f15e06d5a..d3729f6a5 100644 --- a/airtime_mvc/build/airtime-setup/forms/general-settings.php +++ b/airtime_mvc/build/airtime-setup/forms/general-settings.php @@ -19,6 +19,20 @@ +

The CORS URL can be setup during install if you are accessing your LibreTime instance behind a Proxy. + This is common with docker setups. If you have a reverse proxy setup enter the URL below, otherwise you + can safely ignore this. +

+
+ CORS URL
+
+
+
+ + +
+
@@ -27,6 +41,10 @@ \ No newline at end of file + diff --git a/airtime_mvc/build/airtime-setup/load.php b/airtime_mvc/build/airtime-setup/load.php index fb8ee7213..31d20e0d6 100644 --- a/airtime_mvc/build/airtime-setup/load.php +++ b/airtime_mvc/build/airtime-setup/load.php @@ -45,7 +45,7 @@ function checkDatabaseDependencies() { /** * Check that all external services are configured correctly and return an associative * array with the results - * + * * @return array associative array of external service check results */ function checkExternalServices() { @@ -88,7 +88,7 @@ function configureDatabase() { /** * Check that we can connect to RabbitMQ - * + * * @return true if the RabbitMQ connection can be established */ function checkRMQConnection() { @@ -109,7 +109,7 @@ function checkRMQConnection() { /** * Check if airtime-analyzer is currently running - * + * * @return boolean true if airtime-analyzer is running */ function checkAnalyzerService() { @@ -122,7 +122,7 @@ function checkAnalyzerService() { /** * Check if airtime-playout is currently running - * + * * @return boolean true if airtime-playout is running */ function checkPlayoutService() { @@ -135,7 +135,7 @@ function checkPlayoutService() { /** * Check if airtime-liquidsoap is currently running - * + * * @return boolean true if airtime-liquidsoap is running */ function checkLiquidsoapService() { @@ -148,7 +148,7 @@ function checkLiquidsoapService() { /** * Check if airtime-celery is currently running - * + * * @return boolean true if airtime-celery is running */ function checkCeleryService() { diff --git a/airtime_mvc/locale/ru_RU/LC_MESSAGES/airtime.po b/airtime_mvc/locale/ru_RU/LC_MESSAGES/airtime.po index 4b1d5180c..a75e333e6 100644 --- a/airtime_mvc/locale/ru_RU/LC_MESSAGES/airtime.po +++ b/airtime_mvc/locale/ru_RU/LC_MESSAGES/airtime.po @@ -5211,24 +5211,24 @@ msgid "LibreTime Celery Task service" msgstr "Служба Celery Task LibreTime" #: airtime_mvc\application\views\scripts\systemstatus\index.phtml:104 -msgid "Check that the airtime_analyzer service is installed correctly in " -msgstr "Проверьте, что служба airtime_analyzer правильно установлена в " +msgid "Check that the libretime-analyzer service is installed correctly in " +msgstr "Проверьте, что служба libretime-analyzer правильно установлена в " #: airtime_mvc\application\views\scripts\systemstatus\index.phtml:124 -msgid "Check that the airtime-playout service is installed correctly in " -msgstr "Проверьте, что служба airtime-playout правильно установлена в " +msgid "Check that the libretime-playout service is installed correctly in " +msgstr "Проверьте, что служба libretime-playout правильно установлена в " #: airtime_mvc\application\views\scripts\systemstatus\index.phtml:144 -msgid "Check that the airtime-liquidsoap service is installed correctly in " -msgstr "Проверьте, что служба airtime-liquidsoap правильно установлена в " +msgid "Check that the libretime-liquidsoap service is installed correctly in " +msgstr "Проверьте, что служба libretime-liquidsoap правильно установлена в " #: airtime_mvc\application\views\scripts\systemstatus\index.phtml:164 -msgid "Check that the airtime-celery service is installed correctly in " -msgstr "Проверьте, что служба airtime-celery правильно установлена в " +msgid "Check that the libretime-celery service is installed correctly in " +msgstr "Проверьте, что служба libretime-celery правильно установлена в " #: airtime_mvc\application\views\scripts\systemstatus\index.phtml:158 -msgid " If not, try
sudo service airtime-celery restart" -msgstr " Если нет - попробуйте запустить
sudo service airtime-celery restart" +msgid " If not, try
sudo service libretime-celery restart" +msgstr " Если нет - попробуйте запустить
sudo service libretime-celery restart" #: airtime_mvc\application\views\scripts\systemstatus\index.phtml:164 msgid " and ensure that it's running with " diff --git a/docs/manual/host-configuration/index.md b/docs/manual/host-configuration/index.md index abf6cd19c..edf6b7887 100644 --- a/docs/manual/host-configuration/index.md +++ b/docs/manual/host-configuration/index.md @@ -48,10 +48,10 @@ You can also set options for RabbitMQ messaging, the LibreTime server and SoundC Save and close the file with **Ctrl+O** and **Ctrl+X**. In order to update the configuration used by the various components of LibreTime, run the following commands - sudo systemctl restart airtime-liquidsoap - sudo systemctl restart airtime-playout - sudo systemctl restart airtime-celery - sudo systemctl restart airtime_analyzer + sudo systemctl restart libretime-liquidsoap + sudo systemctl restart libretime-playout + sudo systemctl restart libretime-celery + sudo systemctl restart libretime-analyzer Changing the default PostgreSQL passwords ---------------------------------------- @@ -101,7 +101,7 @@ Playout and recorder settings Settings for pypo, the playout and recording engine used by LibreTime, are found in the file */etc/airtime/airtime.conf*. After making changes to this file, you will have to issue the command: - sudo systemctl restart airtime-playout + sudo systemctl restart libretime-playout for the changes to take effect. diff --git a/docs/manual/troubleshooting/index.md b/docs/manual/troubleshooting/index.md index da7a45ceb..6284bcf8e 100644 --- a/docs/manual/troubleshooting/index.md +++ b/docs/manual/troubleshooting/index.md @@ -2,16 +2,16 @@ If your Airtime server is not working as expected, individual components of the system can be started, stopped, restarted or checked in the server console using the **systemctl** command: - sudo systemctl start|stop|restart|status airtime-liquidsoap - sudo systemctl start|stop|restart|status airtime-playout - sudo systemctl start|stop|restart|status airtime-celery - sudo systemctl start|stop|restart|status airtime_analyzer + sudo systemctl start|stop|restart|status libretime-liquidsoap + sudo systemctl start|stop|restart|status libretime-playout + sudo systemctl start|stop|restart|status libretime-celery + sudo systemctl start|stop|restart|status libretime-analyzer sudo systemctl start|stop|restart|status apache2 sudo systemctl start|stop|restart|status rabbitmq-server For example, to restart the Airtime playout engine, you could enter the command: - sudo systemctl restart airtime-analyzer + sudo systemctl restart libretime-playout Log files --------- diff --git a/install b/install index bbbe94860..68d650fdc 100755 --- a/install +++ b/install @@ -180,14 +180,29 @@ function systemInitInstall() { local source_base_path="" local source_path="" local target_path="" + local alt_path="" local source_config_path="" local target_config_path="" local python_source_path="${SCRIPT_DIR-$PWD}/python_apps" verbose "\n * Installing service $service_name ..." if $has_systemd_init; then - # TODO: move .service files under python_apps/.../install/systemd - source_path="${SCRIPT_DIR-$PWD}/installer/systemd/${service_name}.service" - target_path="/etc/systemd/system/${service_name}.service" + case "$service_name" in + libretime-analyzer) + source_path="${python_source_path}/airtime_analyzer/install/systemd/${service_name}.service" + target_path="/etc/systemd/system/${service_name}.service" + alt_path=$(echo $target_path | sed 's/libretime-/airtime_/') + ;; + libretime-celery) + source_path="${python_source_path}/airtime-celery/install/systemd/${service_name}.service" + target_path="/etc/systemd/system/${service_name}.service" + alt_path=$(echo $target_path | sed 's/libretime-/airtime-/') + ;; + libretime-liquidsoap|libretime-playout) + source_path="${python_source_path}/pypo/install/systemd/${service_name}.service" + target_path="/etc/systemd/system/${service_name}.service" + alt_path=$(echo $target_path | sed 's/libretime-/airtime-/') + ;; + esac if [[ ! -e $source_path ]]; then echo "$0:${FUNCNAME}(): ERROR: service \"$service_name\" with source path \"$source_path\" does not exist!" >&2 exit 1 @@ -198,6 +213,16 @@ function systemInitInstall() { loudCmd "systemctl disable ${service_name}.service" loudCmd "systemctl stop ${service_name}.service" fi + local old_style_unit_exists="f" + # Migrate old style airtime unit exist if it exists + if [[ -e $alt_path && ! -L $alt_path ]]; then + local old_service=$(echo $service_name | sed 's/libretime/airtime/') + verbose "Old service $old_service already exists - migrating." + loudCmd "systemctl disable ${old_service}.service" + loudCmd "systemctl stop ${old_service}.service" + loudCmd "rm $alt_path" + old_style_unit_exists="t" + fi # If no user defined, then just copy, otherwise filter if [[ -z $user ]]; then loudCmd "cp $source_path $target_path" @@ -205,6 +230,11 @@ function systemInitInstall() { sed -e "s/User=.*/User=${user}/" \ -e "s/Group=.*/Group=${user}/" $source_path > $target_path fi + if [[ $old_style_unit_exists == "t" ]]; then + verbose "Maintaining compatibility with old systemd unit names" + # Alias to old Airtime names + loudCmd "ln -s $source_path $alt_path" + fi chmod 0644 $target_path chown root:root $target_path verbose "Service ${service_name} installed into ${target_path}" @@ -213,17 +243,17 @@ function systemInitInstall() { verbose "Service ${service_name} enabled and started" elif $has_upstart_init; then case "$service_name" in - airtime_analyzer) - source_path="${python_source_path}/${service_name}/install/upstart/${service_name}.conf" + libretime-analyzer) + source_path="${python_source_path}/airtime_analyzer/install/upstart/${service_name}.conf" target_path="/etc/init/${service_name}.conf" user=${user:-$web_user} ;; - airtime-celery) - source_path="${python_source_path}/${service_name}/install/upstart/${service_name}.conf" + libretime-celery) + source_path="${python_source_path}/airtime-celery/install/upstart/${service_name}.conf" target_path="/etc/init/${service_name}.conf" user="" ;; - airtime-liquidsoap|airtime-playout) + libretime-liquidsoap|libretime-playout) source_path="${python_source_path}/pypo/install/upstart/${service_name}.conf.template" target_path="/etc/init/${service_name}.conf" user=${user:-$web_user} @@ -251,19 +281,19 @@ function systemInitInstall() { loudCmd "initctl check-config $service_name" elif $has_systemv_init; then case "$service_name" in - airtime_analyzer) - source_path="${python_source_path}/${service_name}/install/sysvinit/${service_name}" + libretime-analyzer) + source_path="${python_source_path}/airtime_analyzer/install/sysvinit/${service_name}" target_path="/etc/init.d/${service_name}" user=${user:-$web_user} ;; - airtime-celery) - source_path="${python_source_path}/${service_name}/install/initd/${service_name}" + libretime-celery) + source_path="${python_source_path}/airtime-celery/install/sysvinit/${service_name}" target_path="/etc/init.d/${service_name}" source_config_path="${python_source_path}/${service_name}/install/conf/${service_name}" target_config_path="/etc/default/${service_name}" user="" ;; - airtime-liquidsoap|airtime-playout) + libretime-liquidsoap|libretime-playout) source_path="${python_source_path}/pypo/install/sysvinit/${service_name}" target_path="/etc/init.d/${service_name}" user=${user:-$web_user} @@ -957,8 +987,8 @@ verbose "\n * Installing pypo and liquidsoap..." loudCmd "python3 ${AIRTIMEROOT}/python_apps/pypo/setup.py install --install-scripts=/usr/bin --no-init-script" loudCmd "mkdir -p /var/log/airtime/{pypo,pypo-liquidsoap} /var/tmp/airtime/pypo/{cache,files,tmp} /var/tmp/airtime/show-recorder/" loudCmd "chown -R ${web_user}:${web_user} /var/log/airtime/{pypo,pypo-liquidsoap} /var/tmp/airtime/pypo/{cache,files,tmp} /var/tmp/airtime/show-recorder/" -systemInitInstall airtime-liquidsoap $web_user -systemInitInstall airtime-playout $web_user +systemInitInstall libretime-liquidsoap $web_user +systemInitInstall libretime-playout $web_user verbose "...Done" verbose "\n * Installing airtime-celery..." @@ -971,15 +1001,15 @@ else fi # Add celery to the www-data group loudCmd "usermod -G ${web_user} -a celery" -# CentOS installs celery in /usr/bin which differs from other distros. Make +# CentOS installs celery in /usr/bin which differs from other distros. Make # available in /usr/local/bin as systemd requires an absolute path. [[ ! -e /usr/local/bin/celery ]] && ln -s /usr/bin/celery /usr/local/bin/celery -systemInitInstall airtime-celery +systemInitInstall libretime-celery verbose "...Done" verbose "\n * Installing airtime_analyzer..." loudCmd "python3 ${AIRTIMEROOT}/python_apps/airtime_analyzer/setup.py install --install-scripts=/usr/bin --no-init-script" -systemInitInstall airtime_analyzer $web_user +systemInitInstall libretime-analyzer $web_user verbose "...Done" verbose "\n * Setting permissions on /var/log/airtime..." diff --git a/python_apps/airtime-celery/install/initd/airtime-celery b/python_apps/airtime-celery/install/initd/libretime-celery similarity index 100% rename from python_apps/airtime-celery/install/initd/airtime-celery rename to python_apps/airtime-celery/install/initd/libretime-celery diff --git a/installer/systemd/airtime-celery.service b/python_apps/airtime-celery/install/systemd/libretime-celery.service similarity index 100% rename from installer/systemd/airtime-celery.service rename to python_apps/airtime-celery/install/systemd/libretime-celery.service diff --git a/python_apps/airtime-celery/install/upstart/airtime-celery.conf b/python_apps/airtime-celery/install/upstart/libretime-celery.conf similarity index 100% rename from python_apps/airtime-celery/install/upstart/airtime-celery.conf rename to python_apps/airtime-celery/install/upstart/libretime-celery.conf diff --git a/installer/systemd/airtime_analyzer.service b/python_apps/airtime_analyzer/install/systemd/libretime-analyzer.service similarity index 75% rename from installer/systemd/airtime_analyzer.service rename to python_apps/airtime_analyzer/install/systemd/libretime-analyzer.service index 4a0231907..c8983ff48 100644 --- a/installer/systemd/airtime_analyzer.service +++ b/python_apps/airtime_analyzer/install/systemd/libretime-analyzer.service @@ -3,8 +3,8 @@ Description=LibreTime Media Analyzer Service [Service] ExecStart=/usr/bin/airtime_analyzer -User=airtime-analyzer -Group=airtime-analyzer +User=libretime-analyzer +Group=libretime-analyzer Restart=always [Install] diff --git a/python_apps/airtime_analyzer/install/sysvinit/airtime_analyzer b/python_apps/airtime_analyzer/install/sysvinit/libretime-analyzer similarity index 100% rename from python_apps/airtime_analyzer/install/sysvinit/airtime_analyzer rename to python_apps/airtime_analyzer/install/sysvinit/libretime-analyzer diff --git a/python_apps/airtime_analyzer/install/upstart/airtime_analyzer.conf b/python_apps/airtime_analyzer/install/upstart/libretime-analyzer.conf similarity index 100% rename from python_apps/airtime_analyzer/install/upstart/airtime_analyzer.conf rename to python_apps/airtime_analyzer/install/upstart/libretime-analyzer.conf diff --git a/installer/systemd/airtime-liquidsoap.service b/python_apps/pypo/install/systemd/libretime-liquidsoap.service similarity index 79% rename from installer/systemd/airtime-liquidsoap.service rename to python_apps/pypo/install/systemd/libretime-liquidsoap.service index 0c0db348a..2d7a1abb9 100644 --- a/installer/systemd/airtime-liquidsoap.service +++ b/python_apps/pypo/install/systemd/libretime-liquidsoap.service @@ -1,5 +1,5 @@ [Unit] -Description=Airtime Liquidsoap Service +Description=Libretime Liquidsoap Service [Service] ExecStart=/usr/bin/airtime-liquidsoap diff --git a/installer/systemd/airtime-playout.service b/python_apps/pypo/install/systemd/libretime-playout.service similarity index 82% rename from installer/systemd/airtime-playout.service rename to python_apps/pypo/install/systemd/libretime-playout.service index ad2eafda8..bd86973a9 100644 --- a/installer/systemd/airtime-playout.service +++ b/python_apps/pypo/install/systemd/libretime-playout.service @@ -1,5 +1,5 @@ [Unit] -Description=Airtime Playout Service +Description=Libretime Playout Service After=network-online.target [Service] diff --git a/python_apps/pypo/install/sysvinit/airtime-liquidsoap b/python_apps/pypo/install/sysvinit/libretime-liquidsoap similarity index 100% rename from python_apps/pypo/install/sysvinit/airtime-liquidsoap rename to python_apps/pypo/install/sysvinit/libretime-liquidsoap diff --git a/python_apps/pypo/install/sysvinit/airtime-playout b/python_apps/pypo/install/sysvinit/libretime-playout similarity index 100% rename from python_apps/pypo/install/sysvinit/airtime-playout rename to python_apps/pypo/install/sysvinit/libretime-playout From 2dd4a6df5173d09430ea16d593d45dd9dad9f1e2 Mon Sep 17 00:00:00 2001 From: Kyle Robbertze Date: Fri, 15 May 2020 18:32:47 +0200 Subject: [PATCH 11/11] systemd units handled on their own --- install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install b/install index 68d650fdc..ae2b8a870 100755 --- a/install +++ b/install @@ -216,7 +216,7 @@ function systemInitInstall() { local old_style_unit_exists="f" # Migrate old style airtime unit exist if it exists if [[ -e $alt_path && ! -L $alt_path ]]; then - local old_service=$(echo $service_name | sed 's/libretime/airtime/') + local old_service=$(echo $service_name | sed 's/libretime/airtime/' | sed 's/-analyzer/_analyzer/') verbose "Old service $old_service already exists - migrating." loudCmd "systemctl disable ${old_service}.service" loudCmd "systemctl stop ${old_service}.service" @@ -793,7 +793,6 @@ will be moved to /etc/airtime/airtime.conf.tmp" rm -f /etc/init.d/airtime* rm -f /etc/init/airtime* rm -f /etc/default/airtime-celery - rm -f /etc/systemd/system/airtime* if [ "$apache" = "t" ]; then # If the user selects an "in-place" install or passes in a web root,