feat: change config filename to config.yml

BREAKING: The configuration file name changed from `airtime.conf` to
`config.yml`. Please rename your configuration file accordingly.
This commit is contained in:
jo 2022-06-06 17:09:25 +02:00 committed by Kyle Robbertze
parent e4439390fe
commit 604ff20239
23 changed files with 40 additions and 34 deletions

View File

@ -3,7 +3,7 @@ Description=LibreTime Media Analyzer Service
[Service] [Service]
Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/analyzer.log Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/analyzer.log
Environment=LIBRETIME_CONFIG_FILEPATH=/etc/airtime/airtime.conf Environment=LIBRETIME_CONFIG_FILEPATH=/etc/airtime/config.yml
WorkingDirectory=/var/lib/libretime/analyzer WorkingDirectory=/var/lib/libretime/analyzer
ExecStart=/usr/local/bin/libretime-analyzer ExecStart=/usr/local/bin/libretime-analyzer

View File

@ -19,7 +19,7 @@ post_file() {
file_path="${stripped_file_path}" file_path="${stripped_file_path}"
# filename="${file_path##*/}" # filename="${file_path##*/}"
airtime_conf_path=/etc/airtime/airtime.conf airtime_conf_path=/etc/airtime/config.yml
#instance_path will look like 1/1384, for example #instance_path will look like 1/1384, for example
http_path=$(grep base_url ${airtime_conf_path} | awk '{print $3;}') http_path=$(grep base_url ${airtime_conf_path} | awk '{print $3;}')

View File

@ -125,7 +125,7 @@ class AirtimeApiClient:
UPLOAD_RETRIES = 3 UPLOAD_RETRIES = 3
UPLOAD_WAIT = 60 UPLOAD_WAIT = 60
def __init__(self, logger=None, config_path="/etc/airtime/airtime.conf"): def __init__(self, logger=None, config_path="/etc/airtime/config.yml"):
self.logger = logger or logging self.logger = logger or logging
config = Config(filepath=config_path) config = Config(filepath=config_path)

View File

@ -37,7 +37,7 @@ api_endpoints["file_download_url"] = "files/{id}/download/"
class AirtimeApiClient: class AirtimeApiClient:
API_BASE = "/api/v2" API_BASE = "/api/v2"
def __init__(self, logger=None, config_path="/etc/airtime/airtime.conf"): def __init__(self, logger=None, config_path="/etc/airtime/config.yml"):
self.logger = logger or logging self.logger = logger or logging
config = Config(filepath=config_path) config = Config(filepath=config_path)

View File

@ -7,7 +7,7 @@ from libretime_api_client.version2 import AirtimeApiClient
@pytest.fixture() @pytest.fixture()
def config_filepath(tmp_path: Path): def config_filepath(tmp_path: Path):
filepath = tmp_path / "airtime.conf" filepath = tmp_path / "config.yml"
filepath.write_text( filepath.write_text(
""" """
general: general:

View File

@ -7,7 +7,7 @@ KillMode=mixed
PrivateTmp=true PrivateTmp=true
Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/api.log Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/api.log
Environment=LIBRETIME_CONFIG_FILEPATH=/etc/airtime/airtime.conf Environment=LIBRETIME_CONFIG_FILEPATH=/etc/airtime/config.yml
ExecStart=/usr/bin/gunicorn \ ExecStart=/usr/bin/gunicorn \
--workers 4 \ --workers 4 \

View File

@ -7,7 +7,7 @@ import sys
def main(): def main():
"""Run administrative tasks.""" """Run administrative tasks."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "libretime_api.settings.prod") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "libretime_api.settings.prod")
os.environ.setdefault("LIBRETIME_CONFIG_FILEPATH", "/etc/airtime/airtime.conf") os.environ.setdefault("LIBRETIME_CONFIG_FILEPATH", "/etc/airtime/config.yml")
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError as exc: except ImportError as exc:

View File

@ -58,7 +58,7 @@ a [system account](https://www.freeipa.org/page/HowTo/LDAP#System_Accounts) that
set up beforehand. set up beforehand.
You can configure everything pertaining to how LibreTime accesses LDAP in You can configure everything pertaining to how LibreTime accesses LDAP in
`/etc/airtime/airtime.conf`. The default file has the following values you need to change. `/etc/airtime/config.yml`. The default file has the following values you need to change.
```yml ```yml
# #
@ -99,7 +99,7 @@ ldap:
### Enable FreeIPA authentication ### Enable FreeIPA authentication
After everything is set up properly you can enable FreeIPA auth in `airtime.conf`: After everything is set up properly you can enable FreeIPA auth in `config.yml`:
```yml ```yml
general: general:

View File

@ -28,7 +28,7 @@ It is strongly recommended that you do this before exposing your server to the i
Make sure to include the semicolon at the end! A response of `ALTER ROLE` means that the command ran successfully. Make sure to include the semicolon at the end! A response of `ALTER ROLE` means that the command ran successfully.
3. Change the password for the _airtime_ user with `ALTER USER airtime WITH PASSWORD 'new_password';` 3. Change the password for the _airtime_ user with `ALTER USER airtime WITH PASSWORD 'new_password';`
A response of `ALTER ROLE` means that the command ran successfully. A response of `ALTER ROLE` means that the command ran successfully.
4. If all is successful, logout of PostgreSQL with `\q`, go back to `/etc/airtime/airtime.conf` to edit the password 4. If all is successful, logout of PostgreSQL with `\q`, go back to `/etc/airtime/config.yml` to edit the password
in the config file, and restart all services mentioned in the previous section. in the config file, and restart all services mentioned in the previous section.
## Icecast ## Icecast
@ -61,4 +61,4 @@ To change the default password for RabbitMQ, run the following command
sudo rabbitmqctl change_password airtime newpassword sudo rabbitmqctl change_password airtime newpassword
``` ```
and then update the `/etc/airtime/airtime.conf` file with the new password. and then update the `/etc/airtime/config.yml` file with the new password.

View File

@ -3,7 +3,7 @@ title: Configuration
sidebar_position: 20 sidebar_position: 20
--- ---
To configure LibreTime, you need to edit the `/etc/airtime/airtime.conf` file. This page describe the available options to configure your installation. To configure LibreTime, you need to edit the `/etc/airtime/config.yml` file. This page describe the available options to configure your installation.
## General ## General

View File

@ -49,7 +49,7 @@ On a common setup, to access LibreTime specific logs you should search for the f
For some LibreTime services, you can set a higher log level using the `LIBRETIME_LOG_LEVEL` environment variable, or by running the service by hand and using a command line flag: For some LibreTime services, you can set a higher log level using the `LIBRETIME_LOG_LEVEL` environment variable, or by running the service by hand and using a command line flag:
```bash ```bash
sudo -u www-data libretime-analyzer --config /etc/airtime/airtime.conf --log-level debug sudo -u www-data libretime-analyzer --config /etc/airtime/config.yml --log-level debug
``` ```
The `/var/log/apache2/libretime.error.log` file contains logs from the web server. The `/var/log/apache2/libretime.error.log` file contains logs from the web server.

View File

@ -26,6 +26,12 @@ Please run this **before the upgrade procedure**!
::: :::
The configuration file name changed from `airtime.conf` to `config.yml`. Please rename your configuration file using the following command:
```bash
sudo mv /etc/airtime/airtime.conf /etc/airtime/config.yml
```
The configuration file format changed to `yml`. Please rewrite your [configuration file](../admin-manual/setup/configuration.md) using the [yaml format](https://yaml.org/). The configuration file format changed to `yml`. Please rewrite your [configuration file](../admin-manual/setup/configuration.md) using the [yaml format](https://yaml.org/).
### Apache and PHP configuration files ### Apache and PHP configuration files

View File

@ -13,7 +13,7 @@ resources.modules[] = ""
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/" resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.modules[] = "" resources.modules[] = ""
resources.view[] = resources.view[] =
; These are no longer needed. They are specified in /etc/airtime/airtime.conf: ; These are no longer needed. They are specified in /etc/airtime/config.yml:
;resources.db.adapter = "Pdo_Pgsql" ;resources.db.adapter = "Pdo_Pgsql"
;resources.db.params.charset = "utf8" ;resources.db.params.charset = "utf8"
;resources.db.params.host = "localhost" ;resources.db.params.host = "localhost"

View File

@ -22,7 +22,7 @@ define('LIBRETIME_LOG_FILEPATH', getenv('LIBRETIME_LOG_FILEPATH') ?: LIBRETIME_L
define('LIBRETIME_CONFIG_DIR', getenv('LIBRETIME_CONFIG_DIR') ?: '/etc/airtime'); define('LIBRETIME_CONFIG_DIR', getenv('LIBRETIME_CONFIG_DIR') ?: '/etc/airtime');
define('LIBRETIME_CONF_DIR', LIBRETIME_CONFIG_DIR); // Deprecated define('LIBRETIME_CONF_DIR', LIBRETIME_CONFIG_DIR); // Deprecated
define('LIBRETIME_CONFIG_FILEPATH', getenv('LIBRETIME_CONFIG_FILEPATH') ?: LIBRETIME_CONFIG_DIR . '/airtime.conf'); define('LIBRETIME_CONFIG_FILEPATH', getenv('LIBRETIME_CONFIG_FILEPATH') ?: LIBRETIME_CONFIG_DIR . '/config.yml');
// Installer // Installer
define('INSTALLER_CONFIG_FILEPATH', LIBRETIME_CONFIG_DIR . '/airtime.temp.conf'); define('INSTALLER_CONFIG_FILEPATH', LIBRETIME_CONFIG_DIR . '/airtime.temp.conf');

View File

@ -64,7 +64,7 @@
?>"> ?>">
Make sure you aren't missing any of the Postgres dependencies in the table above. Make sure you aren't missing any of the Postgres dependencies in the table above.
If your dependencies check out, make sure your database configuration settings in If your dependencies check out, make sure your database configuration settings in
<code>/etc/airtime.conf</code> are correct and the LibreTime database was installed correctly. <code>/etc/airtime/config.yml</code> are correct and the LibreTime database was installed correctly.
<?php <?php
} }
?> ?>
@ -81,7 +81,7 @@
<?php <?php
} else { } else {
?>"> ?>">
Make sure RabbitMQ is installed correctly, and that your settings in /etc/airtime/airtime.conf Make sure RabbitMQ is installed correctly, and that your settings in /etc/airtime/config.yml
are correct. Try using <code>sudo rabbitmqctl list_users</code> and <code>sudo rabbitmqctl list_vhosts</code> are correct. Try using <code>sudo rabbitmqctl list_users</code> and <code>sudo rabbitmqctl list_vhosts</code>
to see if the airtime user (or your custom RabbitMQ user) exists, then checking that to see if the airtime user (or your custom RabbitMQ user) exists, then checking that
<code>sudo rabbitmqctl list_exchanges</code> contains entries for airtime-analyzer, airtime-pypo, <code>sudo rabbitmqctl list_exchanges</code> contains entries for airtime-analyzer, airtime-pypo,

View File

@ -55,8 +55,8 @@ class MediaSetup extends Setup
/* /*
* If we're upgrading from an old Airtime instance (pre-2.5.2) we rename their old * If we're upgrading from an old Airtime instance (pre-2.5.2) we rename their old
* airtime.conf to airtime.conf.tmp during the setup process. Now that we're done, * config.yml to config.yml.tmp during the setup process. Now that we're done,
* we can rename it to airtime.conf.bak to avoid confusion. * we can rename it to config.yml.bak to avoid confusion.
*/ */
$fileName = LIBRETIME_CONFIG_FILEPATH; $fileName = LIBRETIME_CONFIG_FILEPATH;
$tmpFile = $fileName . '.tmp'; $tmpFile = $fileName . '.tmp';
@ -65,7 +65,7 @@ class MediaSetup extends Setup
rename($tmpFile, $bakFile); rename($tmpFile, $bakFile);
} }
} else { } else {
self::$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!"; self::$message = "Failed to move config.yml; /etc/airtime doesn't exist!";
self::$errors[] = 'ERR'; self::$errors[] = 'ERR';
} }
@ -76,7 +76,7 @@ class MediaSetup extends Setup
} }
/** /**
* Moves /tmp/airtime.temp.conf to /etc/airtime.conf and then removes it to complete setup. * Moves /tmp/airtime.temp.conf to /etc/airtime/config.yml and then removes it to complete setup.
* *
* @return bool false if either of the copy or removal operations fail * @return bool false if either of the copy or removal operations fail
*/ */

View File

@ -10,10 +10,10 @@
*/ */
class RabbitMQSetup extends Setup class RabbitMQSetup extends Setup
{ {
// airtime.conf section header // config.yml section header
protected static $_section = '[rabbitmq]'; protected static $_section = '[rabbitmq]';
// Array of key->value pairs for airtime.conf // Array of key->value pairs for config.yml
protected static $_properties; protected static $_properties;
// Constant form field names for passing errors back to the front-end // Constant form field names for passing errors back to the front-end

View File

@ -14,7 +14,7 @@ abstract class Setup
protected static $_section; protected static $_section;
/** /**
* Array of key->value pairs for airtime.conf. * Array of key->value pairs for config.yml.
* *
* @var array * @var array
*/ */
@ -51,7 +51,7 @@ abstract class Setup
} }
if (substr(trim($line), 0, 1) == '#') { if (substr(trim($line), 0, 1) == '#') {
/* Workaround to strip comments from airtime.conf. /* Workaround to strip comments from config.yml.
* We need to do this because python's ConfigObj and PHP * We need to do this because python's ConfigObj and PHP
* have different (and equally strict) rules about comment * have different (and equally strict) rules about comment
* characters in configuration files. * characters in configuration files.
@ -123,8 +123,8 @@ require_once 'general-setup.php';
require_once 'media-setup.php'; require_once 'media-setup.php';
// If airtime.conf exists, we shouldn't be here // If config.yml exists, we shouldn't be here
if (!file_exists('/etc/airtime/airtime.conf')) { if (!file_exists('/etc/airtime/config.yml')) {
if (isset($_GET['obj']) && $objType = $_GET['obj']) { if (isset($_GET['obj']) && $objType = $_GET['obj']) {
$obj = new $objType($_POST); $obj = new $objType($_POST);
if ($obj instanceof Setup) { if ($obj instanceof Setup) {

View File

@ -48,8 +48,8 @@ class AirtimeInstall
} catch (PropelException $e) { } catch (PropelException $e) {
return null; return null;
} }
if (file_exists('/etc/airtime/airtime.conf')) { if (file_exists('/etc/airtime/config.yml')) {
$values = parse_ini_file('/etc/airtime/airtime.conf', true); $values = parse_ini_file('/etc/airtime/config.yml', true);
} else { } else {
return null; return null;
} }

View File

@ -3,7 +3,7 @@ Description=Libretime Liquidsoap Service
[Service] [Service]
Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/liquidsoap.log Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/liquidsoap.log
Environment=LIBRETIME_CONFIG_FILEPATH=/etc/airtime/airtime.conf Environment=LIBRETIME_CONFIG_FILEPATH=/etc/airtime/config.yml
WorkingDirectory=/var/lib/libretime/playout WorkingDirectory=/var/lib/libretime/playout
ExecStart=/usr/local/bin/libretime-liquidsoap ExecStart=/usr/local/bin/libretime-liquidsoap

View File

@ -4,7 +4,7 @@ After=network-online.target
[Service] [Service]
Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/playout.log Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/playout.log
Environment=LIBRETIME_CONFIG_FILEPATH=/etc/airtime/airtime.conf Environment=LIBRETIME_CONFIG_FILEPATH=/etc/airtime/config.yml
WorkingDirectory=/var/lib/libretime/playout WorkingDirectory=/var/lib/libretime/playout
ExecStart=/usr/local/bin/libretime-playout ExecStart=/usr/local/bin/libretime-playout

View File

@ -15,7 +15,7 @@ Each instance of airtime-celery has its own worker, and multiple instances can b
To debug, you can run celery directly from the command line: To debug, you can run celery directly from the command line:
```sh ```sh
RMQ_CONFIG_FILE=${LIBRETIME_CONF_DIR}/airtime.conf celery -A libretime_worker.tasks worker --loglevel=info RMQ_CONFIG_FILE=${LIBRETIME_CONF_DIR}/config.yml celery -A libretime_worker.tasks worker --loglevel=info
``` ```
This worker can be run alongside the service without issue. This worker can be run alongside the service without issue.
@ -46,6 +46,6 @@ If you run into issues getting Celery to accept tasks from Airtime:
1. Make sure Celery is running ($ sudo service airtime-celery status). 1. Make sure Celery is running ($ sudo service airtime-celery status).
2. Check the log file (/var/log/airtime/airtime-celery[-DEV_ENV].log) to make sure Celery started correctly. 2. Check the log file (/var/log/airtime/airtime-celery[-DEV_ENV].log) to make sure Celery started correctly.
3. Check your $LIBRETIME_CONF_DIR/airtime.conf rabbitmq settings. Make sure the settings here align with $LIBRETIME_CONF_DIR/$ENVIRONMENT/rabbitmq.ini. 3. Check your $LIBRETIME_CONF_DIR/config.yml rabbitmq settings. Make sure the settings here align with $LIBRETIME_CONF_DIR/$ENVIRONMENT/rabbitmq.ini.
4. Check RabbitMQ to make sure the celeryresults and task queues were created in the correct vhost. 4. Check RabbitMQ to make sure the celeryresults and task queues were created in the correct vhost.
5. Make sure the RabbitMQ user (the default is airtime) has permissions on all vhosts being used. 5. Make sure the RabbitMQ user (the default is airtime) has permissions on all vhosts being used.

View File

@ -3,7 +3,7 @@ Description=LibreTime Worker Service
[Service] [Service]
Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/worker.log Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/worker.log
Environment=LIBRETIME_CONFIG_FILEPATH=/etc/airtime/airtime.conf Environment=LIBRETIME_CONFIG_FILEPATH=/etc/airtime/config.yml
WorkingDirectory=/var/lib/libretime/worker WorkingDirectory=/var/lib/libretime/worker
ExecStart=/usr/bin/sh -c 'celery worker \ ExecStart=/usr/bin/sh -c 'celery worker \