281 lines
13 KiB
Markdown
281 lines
13 KiB
Markdown
|
---
|
|||
|
title: Host Configuration
|
|||
|
layout: article
|
|||
|
category: install
|
|||
|
---
|
|||
|
|
|||
|
The streaming host configuration for LibreTime is shown in the file */etc/airtime/liquidsoap.cfg* which is automatically generated by the **Streams** page, found on the **System** menu of the LibreTime administration interface. For this reason, you would not normally edit the streaming configuration manually, as any changes are likely to be overwritten by the administration interface.
|
|||
|
|
|||
|
### Database and RabbitMQ hosts {#database}
|
|||
|
|
|||
|
Optionally, you may wish to edit the file */etc/airtime/airtime.conf* to set the PostgreSQL database host, and the username and password to connect to the database with:
|
|||
|
|
|||
|
sudo nano /etc/airtime/airtime.conf
|
|||
|
|
|||
|
You can also set options for RabbitMQ messaging, the LibreTime server and SoundCloud uploads in this file, although you should not normally need to adjust the defaults unless you are running a large LibreTime system distributed across multiple servers. To run the LibreTime server in demo mode, which changes the greeting on the login page and prevents user accounts from being created or modified, set the value of *demo* to 1.
|
|||
|
|
|||
|
[database]
|
|||
|
host = localhost
|
|||
|
dbname = airtime
|
|||
|
dbuser = airtime
|
|||
|
dbpass = airtime
|
|||
|
|
|||
|
[rabbitmq]
|
|||
|
host = 127.0.0.1
|
|||
|
port = 5672
|
|||
|
user = airtime
|
|||
|
password = XXXXXXXXXXXXXXXXXXXX
|
|||
|
vhost = /airtime
|
|||
|
|
|||
|
[general]
|
|||
|
api_key = XXXXXXXXXXXXXXXXXXXXX
|
|||
|
web_server_user = www-data
|
|||
|
airtime_dir = /usr/share/airtime
|
|||
|
base_url = libretime.example.com
|
|||
|
base_port = 80
|
|||
|
base_dir = /
|
|||
|
cache_ahead_hours = 1
|
|||
|
|
|||
|
[monit]
|
|||
|
monit_user = guest
|
|||
|
monit_password = airtime
|
|||
|
|
|||
|
[soundcloud]
|
|||
|
connection_retries = 3
|
|||
|
time_between_retries = 60
|
|||
|
|
|||
|
[demo]
|
|||
|
demo = 0
|
|||
|
|
|||
|
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 libretime-liquidsoap
|
|||
|
sudo systemctl restart libretime-playout
|
|||
|
sudo systemctl restart libretime-celery
|
|||
|
sudo systemctl restart libretime-analyzer
|
|||
|
|
|||
|
### Changing the default PostgreSQL passwords {#postgre}
|
|||
|
|
|||
|
Two of the most important passwords that should be changed *immediately* after installation
|
|||
|
are the passwords used by the PostgreSQL database.
|
|||
|
It is strongly recommended that you do this before exposing your server to the internet beyond your internal network.
|
|||
|
|
|||
|
1. Login to PostgreSQL with `sudo -u postgres psql`. The PostgreSQL shell - `postgres=#` - means that you have logged in successfully.
|
|||
|
2. Change the admin password with `ALTER USER postgres PASSWORD 'myPassword';`, where `myPassword` is the new password.
|
|||
|
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';`
|
|||
|
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
|
|||
|
in the config file, and restart all services mentioned in the previous section.
|
|||
|
|
|||
|
### Changing the default Icecast passwords {#icecast}
|
|||
|
|
|||
|
Random passwords are generated for Icecast during the installation. To look up and change the passwords, look in the file below.
|
|||
|
|
|||
|
`/etc/icecast2/icecast.xml`
|
|||
|
|
|||
|
Replace the admin and `changeme` field below with your own username and password.
|
|||
|
|
|||
|
```
|
|||
|
<authentication>
|
|||
|
<!-- Sources log in with username 'source' -->
|
|||
|
<source-password>changeme</source-password>
|
|||
|
<!-- Relays log in with username 'relay' -->
|
|||
|
<relay-password>changeme</relay-password>
|
|||
|
<!-- Admin logs in with the username given below -->
|
|||
|
<admin-user>admin</admin-user>
|
|||
|
<admin-password>changeme</admin-password>
|
|||
|
</authentication>
|
|||
|
```
|
|||
|
|
|||
|
Then, restart your icecast2 service.
|
|||
|
|
|||
|
```
|
|||
|
service icecast2 restart
|
|||
|
```
|
|||
|
|
|||
|
> Note: If you change the source password, you may need to manually configure Libretime to use the new password: go to **Settings** > **Streams**, set the streaming server to **Custom** and fill out the **Additional Options** below Stream 1.
|
|||
|
|
|||
|
### API client configuration {#api}
|
|||
|
|
|||
|
The LibreTime API enables many types of information about the broadcast schedule and configuration to be retrieved from the LibreTime server. Other than the live-info and week-info data fetched by website widgets (see the chapter *Exporting the schedule*), all API requests must be authenticated using the secret API key stored in the file */etc/airtime/api\_client.cfg* on the LibreTime server. This key is autogenerated during LibreTime installation and should be unique for each server.
|
|||
|
|
|||
|
If you intend to use the LibreTime API across a public network, for security reasons it is highly recommended that all API requests are sent over encrypted https: and that the web server is configured to accept requests to the api/ directory from specific host names or IP addresses only.
|
|||
|
|
|||
|
If you have changed the *base\_url*, *base\_port* or *base\_dir* setting in */etc/airtime/airtime.conf* from the defaults, you will probably also have to update the *Hostname* settings in the file */etc/airtime/api\_client.cfg* accordingly.**
|
|||
|
|
|||
|
bin_dir = /usr/lib/airtime/api_clients
|
|||
|
api_key = 'XXXXXXXXXXXXXXXXXXXX'
|
|||
|
api_base = api
|
|||
|
host = libretime.example.com
|
|||
|
base_port = 80
|
|||
|
base_dir = /
|
|||
|
|
|||
|
### Apache max file size configuration {#apache}
|
|||
|
|
|||
|
By default, the maximum upload file size is 500 MB, which may not be large enough for some stations, especially if they are uploading prerecorded shows. The setting for this is located in */etc/apache2/sites-available/airtime.config*. Search for and update the following in megabytes:
|
|||
|
|
|||
|
```
|
|||
|
; Maximum allowed size for uploaded files.
|
|||
|
upload_max_filesize = 40M
|
|||
|
|
|||
|
; Must be greater than or equal to upload_max_filesize
|
|||
|
post_max_size = 40M
|
|||
|
```
|
|||
|
|
|||
|
For quick reference, 1024 MB = 1 GB and 2048 MB = 2 GB, but most will be okay with rounding to the nearest thousand. After updating the config file, restart Apache by `sudo systemctl apache restart`.
|
|||
|
|
|||
|
|
|||
|
### Playout settings {#playout}
|
|||
|
|
|||
|
Settings for pypo, the playout 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 libretime-playout
|
|||
|
|
|||
|
for the changes to take effect.
|
|||
|
|
|||
|
############################################
|
|||
|
# pypo - configuration #
|
|||
|
############################################
|
|||
|
# Set the type of client you are using.
|
|||
|
# Currently supported types:
|
|||
|
# 1) "obp" = Open Broadcast Platform
|
|||
|
# 2) "airtime"
|
|||
|
#
|
|||
|
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 #
|
|||
|
# Do *not* 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
|
|||
|
|
|||
|
############################################
|
|||
|
# RabbitMQ settings #
|
|||
|
############################################
|
|||
|
rabbitmq_host = localhost
|
|||
|
rabbitmq_user = airtime
|
|||
|
rabbitmq_password = XXXXXXXXXXXXXXXXXXXX
|
|||
|
rabbitmq_vhost = /airtime
|
|||
|
|
|||
|
############################################
|
|||
|
# pypo preferences #
|
|||
|
############################################
|
|||
|
# 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.
|
|||
|
#
|
|||
|
poll_interval = 3600# in seconds.
|
|||
|
|
|||
|
# Push interval in seconds.
|
|||
|
#
|
|||
|
# This is how often the push script checks whether it has something new to
|
|||
|
# push to liquidsoap.
|
|||
|
#
|
|||
|
# It's hard to imagine a situation where this should be more than 1 second.
|
|||
|
#
|
|||
|
push_interval = 1# in seconds
|
|||
|
|
|||
|
# 'pre' or 'otf'. 'pre' cues while playlist preparation
|
|||
|
# while 'otf' (on the fly) cues while loading into ls
|
|||
|
# (needs the post_processor patch)
|
|||
|
cue_style = pre
|
|||
|
|
|||
|
---
|
|||
|
|
|||
|
## Setting the server time
|
|||
|
|
|||
|
Accurate time keeping on your server is vital for LibreTime performance. You can confirm that the date and time of your server are set correctly with the **date** command:
|
|||
|
|
|||
|
date
|
|||
|
|
|||
|
The server should respond with the date, time, time zone and year in a format similar to the following example:
|
|||
|
|
|||
|
Tue Jul 2 15:08:57 BST 2013
|
|||
|
|
|||
|
If the time on your server is wrong, it is recommended that you take LibreTime off-air until the problem is fixed.
|
|||
|
|
|||
|
### Configuring NTP
|
|||
|
|
|||
|
Although it is possible to set the date and time of the server manually, this is not recommended because the server clock can drift over time, compromising the accuracy of your broadcast schedule. If your LibreTime server is permanently connected to the Internet, you can synchronize your server to a time server with the **ntp** ** program. If **ntp** is not yet installed, you can enter the following command on Debian or Ubuntu:
|
|||
|
|
|||
|
sudo apt-get install ntp
|
|||
|
|
|||
|
Optionally, open the **ntp** configuration file in the **nano** editor to add further time server names:
|
|||
|
|
|||
|
sudo nano /etc/ntp.conf
|
|||
|
|
|||
|
On Ubuntu GNU/Linux, the default time server is *ntp.ubuntu.com*, but there are many other time servers available on the public Internet, including the group of servers listed at <http://www.pool.ntp.org/> for each country. Using a variety of NTP servers located closely to your LibreTime server should produce the most accurate results. For example, for a server in the United Kingdom you could use the following list:
|
|||
|
|
|||
|
# You do need to talk to an NTP server or two (or three).
|
|||
|
server ntp.ubuntu.com
|
|||
|
server 0.uk.pool.ntp.org
|
|||
|
server 1.uk.pool.ntp.org
|
|||
|
server 2.uk.pool.ntp.org
|
|||
|
server 3.uk.pool.ntp.org
|
|||
|
|
|||
|
Enter the server names you require, press **Ctrl+O** to write out the */etc/ntp.conf* file, then **Ctrl+X** to exit **nano**. Restart the **ntp** service with:
|
|||
|
|
|||
|
sudo invoke-rc.d ntp restart
|
|||
|
|
|||
|
The server should respond:
|
|||
|
|
|||
|
* Stopping NTP server ntpd [ OK ]
|
|||
|
* Starting NTP server ntpd [ OK ]
|
|||
|
|
|||
|
Then use the **ntpq -p** command to confirm that **ntp** is working. This command should produce output similar to the following:
|
|||
|
|
|||
|
ntpq -p
|
|||
|
remote refid st t when poll reach delay offset jitter
|
|||
|
==================================================================
|
|||
|
europium. 193.79.237.14 2 u 28 64 3 39.571 12.600 3.590
|
|||
|
norb.v4.c 46.227.200.72 3 u 28 64 3 47.856 -6.908 10.028
|
|||
|
82.113.15 193.62.22.82 2 u 29 64 3 11.458 -0.513 2.629
|
|||
|
ntppub.le 158.43.192.66 2 u 91 64 2 122.781 44.864 0.001
|
|||
|
dns0.rmpl 195.66.241.3 2 u 27 64 3 22.171 1.464 4.242
|
|||
|
|
|||
|
### Adjusting the server time zone
|
|||
|
|
|||
|
The data centre which hosts your LibreTime server could be located anywhere in the world. Some servers are set to *Coordinated Universal Time* or UTC (similar to *Greenwich Mean Time* or GMT), regardless of their location. LibreTime uses UTC time in its database for scheduling purposes, independent of the server time zone.
|
|||
|
|
|||
|
If the server time zone is not appropriate for integration with your station's other systems, on a Debian or Ubuntu server you can reconfigure the **tzdata** (time zone data) package with the command:
|
|||
|
|
|||
|
sudo dpkg-reconfigure tzdata
|
|||
|
|
|||
|
This command opens a menu in which you can select the continent that you require, by pressing the Enter key.
|
|||
|
|
|||
|

|
|||
|
|
|||
|
The next step is to select your nearest city, again by pressing the Enter key. The appropriate time zone is selected according to the information that you have entered.
|
|||
|
|
|||
|

|
|||
|
|
|||
|
The console output from the **dpkg-reconfigure tzdata** command will confirm the new setting:
|
|||
|
|
|||
|
Current default time zone: 'Europe/London'
|
|||
|
Local time is now: Tue Jul 2 15:18:01 BST 2013.
|
|||
|
Universal Time is now: Tue Jul 2 14:18:01 UTC 2013.
|