feat(installer): rewrite install script

- remove unused root packages.ini
- write config to yaml file
- allow to set public_url during install
- force icecast start right after package install
- move config file in place at the end of installation

BREAKING CHANGE: The bash installer has been rewritten, the flags and
options changed, please run `./install --help` to get more details.
This commit is contained in:
jo 2022-05-23 17:16:02 +02:00 committed by Kyle Robbertze
parent aed6d2f294
commit ee98387264
13 changed files with 712 additions and 1245 deletions

15
Vagrantfile vendored
View File

@ -72,16 +72,15 @@ Vagrant.configure('2') do |config|
path: 'installer/vagrant/%s' % prepare_script path: 'installer/vagrant/%s' % prepare_script
$script = <<-SCRIPT $script = <<-SCRIPT
set -e
cd /vagrant cd /vagrant
./install \
--force \ bash install \
--listen-port 8080 \
--allow-restart \
--in-place \ --in-place \
--verbose \ http://192.168.10.100:8080
--postgres \
--apache \
--icecast \
--web-port=8080 \
#{install_args}
SCRIPT SCRIPT
config.vm.provision 'install', type: 'shell', inline: $script config.vm.provision 'install', type: 'shell', inline: $script

View File

@ -2,9 +2,9 @@
Description=LibreTime Media Analyzer Service Description=LibreTime Media Analyzer Service
[Service] [Service]
Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/analyzer.log Environment=LIBRETIME_LOG_FILEPATH=@@LOG_DIR@@/analyzer.log
Environment=LIBRETIME_CONFIG_FILEPATH=/etc/libretime/config.yml Environment=LIBRETIME_CONFIG_FILEPATH=@@CONFIG_FILEPATH@@
WorkingDirectory=/var/lib/libretime/analyzer WorkingDirectory=@@WORKING_DIR@@/analyzer
ExecStart=/usr/local/bin/libretime-analyzer ExecStart=/usr/local/bin/libretime-analyzer
User=libretime-analyzer User=libretime-analyzer

View File

@ -6,8 +6,8 @@ Type=notify
KillMode=mixed KillMode=mixed
PrivateTmp=true PrivateTmp=true
Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/api.log Environment=LIBRETIME_LOG_FILEPATH=@@LOG_DIR@@/api.log
Environment=LIBRETIME_CONFIG_FILEPATH=/etc/libretime/config.yml Environment=LIBRETIME_CONFIG_FILEPATH=@@CONFIG_FILEPATH@@
ExecStart=/usr/bin/gunicorn \ ExecStart=/usr/bin/gunicorn \
--workers 4 \ --workers 4 \

View File

@ -38,7 +38,7 @@ The configuration directory changed from `/etc/airtime` to `/etc/libretime`. Ple
sudo mv /etc/airtime /etc/libretime sudo mv /etc/airtime /etc/libretime
``` ```
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/). An example configuration file `installer/config.yml` is present in the sources.
### Apache and PHP configuration files ### Apache and PHP configuration files

1733
install

File diff suppressed because it is too large Load Diff

55
installer/config.yml Normal file
View File

@ -0,0 +1,55 @@
# See https://libretime.org/docs/admin-manual/setup/configuration/
general:
# The public url, this field is REQUIRED
public_url:
# The internal API authentication key, this field is REQUIRED
api_key:
# How many hours ahead Playout should cache scheduled media files, default is 1
cache_ahead_hours: 1
# Authentication adaptor to use for the legacy service, default is local
# Specify a class like LibreTime_Auth_Adaptor_FreeIpa to replace the built-in adaptor
auth: local
database:
# The hostname of the PostgreSQL server, default is localhost
host: localhost
# The port of the PostgreSQL server, default is 5432
port: 5432
# The name of the PostgreSQL database, default is libretime
name: libretime
# The username of the PostgreSQL user, default is libretime
user: libretime
# The password of the PostgreSQL user, default is libretime
password: libretime
rabbitmq:
# The hostname of the RabbitMQ server, default is localhost
host: localhost
# The port of the RabbitMQ server, default is 5672
port: 5672
# The virtual host of RabbitMQ server, default is /libretime
vhost: /libretime
# The username of the RabbitMQ user, default is libretime
user: libretime
# The password of the RabbitMQ user, default is libretime
password: libretime
playout:
# Liquidsoap connection host, default is localhost
liquidsoap_host: localhost
# Liquidsoap connection port, default is 1234
liquidsoap_port: 1234
# The format for recordings, allowed values ogg,mp3, default is ogg
record_file_format: ogg
# The bitrate for recordings, default is 256
record_bitrate: 256
# The samplerate for recordings, default is 256
record_samplerate: 44100
# The number of channels for recordings, default is 2
record_channels: 2
# The sample size for recordings, default is 16
record_sample_size: 16

View File

@ -1,92 +0,0 @@
# See https://libretime.org/docs/setup/configuration
#
# ----------------------------------------------------------------------
# G E N E R A L S E T T I N G S
# ----------------------------------------------------------------------
[general]
# The public url, this field is REQUIRED
public_url =
# The internal API authentication key, this field is REQUIRED
api_key =
# How many hours ahead Playout should cache scheduled media files, default is 1
cache_ahead_hours = 1
# Authentication adaptor to use for the legacy service, default is local
# Specify a class like LibreTime_Auth_Adaptor_FreeIpa to replace the built-in adaptor
auth = local
# ----------------------------------------------------------------------
# D A T A B A S E
# ----------------------------------------------------------------------
[database]
# The hostname of the PostgreSQL server, default is localhost
host = localhost
# The port of the PostgreSQL server, default is 5432
port = 5432
# The name of the PostgreSQL database, default is libretime
name = airtime
# The username of the PostgreSQL user, default is libretime
user = airtime
# The password of the PostgreSQL user, default is libretime
password = airtime
# ----------------------------------------------------------------------
# RABBITMQ
# ----------------------------------------------------------------------
[rabbitmq]
# The hostname of the RabbitMQ server, default is localhost
host = localhost
# The port of the RabbitMQ server, default is 5672
port = 5672
# The virtual host of RabbitMQ server, default is /libretime
vhost = /airtime
# The username of the RabbitMQ user, default is libretime
user = airtime
# The password of the RabbitMQ user, default is libretime
password = airtime
# ----------------------------------------------------------------------
# PLAYOUT
# ----------------------------------------------------------------------
[playout]
# Liquidsoap connection host, default is localhost
liquidsoap_host = localhost
# Liquidsoap connection port, default is 1234
liquidsoap_port = 1234
# The format for recordings, allowed values ogg,mp3, default is ogg
record_file_format = ogg
# The bitrate for recordings, default is 256
record_bitrate = 256
# The samplerate for recordings, default is 256
record_samplerate = 44100
# The number of channels for recordings, default is 2
record_channels = 2
# The sample size for recordings, default is 16
record_sample_size = 16
# ----------------------------------------------------------------------
# L D A P
# ----------------------------------------------------------------------
[ldap]
# Hostname of LDAP server
hostname = ldap.example.org
# Complete DN of user used to bind to LDAP
binddn = 'uid=libretime,cn=sysaccounts,cn=etc,dc=int,dc=example,dc=org'
# Password for binddn user
password = hackme
# Domain part of username
account_domain = INT.EXAMPLE.ORG
# Base search DN
basedn = 'cn=users,cn=accounts,dc=int,dc=example,dc=org'
# Name of the uid field for searching. Usually uid, may be cn
filter_field = uid
# Map user types to LDAP groups. Assign user types based on the group of a given user
# Key format is groupmap_*
groupmap_superadmin = 'cn=superadmin,cn=groups,cn=accounts,dc=int,dc=example,dc=org'
groupmap_admin = 'cn=admin,cn=groups,cn=accounts,dc=int,dc=example,dc=org'
groupmap_program_manager = 'cn=program_manager,cn=groups,cn=accounts,dc=int,dc=example,dc=org'
groupmap_host = 'cn=host,cn=groups,cn=accounts,dc=int,dc=example,dc=org'
groupmap_guest = 'cn=guest,cn=groups,cn=accounts,dc=int,dc=example,dc=org'

View File

@ -1,5 +1,5 @@
/var/log/libretime/legacy.log { @@LOG_DIR@@/legacy.log {
su www-data www-data su @@USER@@ @@USER@@
compress compress
rotate 10 rotate 10
size 1000k size 1000k

View File

@ -1,15 +0,0 @@
# This file contains a list of package dependencies.
[common]
icecast2 = buster, bullseye, bionic, focal
postgresql = buster, bullseye, bionic, focal
postgresql-client = buster, bullseye, bionic, focal
rabbitmq-server = buster, bullseye, bionic, focal
curl = buster, bullseye, bionic, focal
[composer]
unzip = buster, bullseye, bionic, focal
[installer]
lsb-release = buster, bullseye, bionic, focal
xmlstarlet = buster, bullseye, bionic, focal

View File

@ -1,5 +1,5 @@
/var/log/libretime/liquidsoap.log { @@LOG_DIR@@/liquidsoap.log {
su www-data www-data su @@USER@@ @@USER@@
compress compress
rotate 10 rotate 10
size 1000k size 1000k

View File

@ -1,10 +1,10 @@
[Unit] [Unit]
Description=Libretime Liquidsoap Service Description=LibreTime Liquidsoap Service
[Service] [Service]
Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/liquidsoap.log Environment=LIBRETIME_LOG_FILEPATH=@@LOG_DIR@@/liquidsoap.log
Environment=LIBRETIME_CONFIG_FILEPATH=/etc/libretime/config.yml Environment=LIBRETIME_CONFIG_FILEPATH=@@CONFIG_FILEPATH@@
WorkingDirectory=/var/lib/libretime/playout WorkingDirectory=@@WORKING_DIR@@/playout
ExecStart=/usr/local/bin/libretime-liquidsoap ExecStart=/usr/local/bin/libretime-liquidsoap
User=libretime-playout User=libretime-playout

View File

@ -1,15 +1,14 @@
[Unit] [Unit]
Description=Libretime Playout Service Description=LibreTime Playout Service
After=network-online.target
[Service] [Service]
Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/playout.log Environment=LIBRETIME_LOG_FILEPATH=@@LOG_DIR@@/playout.log
Environment=LIBRETIME_CONFIG_FILEPATH=/etc/libretime/config.yml Environment=LIBRETIME_CONFIG_FILEPATH=@@CONFIG_FILEPATH@@
WorkingDirectory=/var/lib/libretime/playout WorkingDirectory=@@WORKING_DIR@@/playout
ExecStart=/usr/local/bin/libretime-playout ExecStart=/usr/local/bin/libretime-playout
User=libretime-pypo User=libretime-playout
Group=libretime-pypo Group=libretime-playout
Restart=always Restart=always
[Install] [Install]

View File

@ -2,9 +2,9 @@
Description=LibreTime Worker Service Description=LibreTime Worker Service
[Service] [Service]
Environment=LIBRETIME_LOG_FILEPATH=/var/log/libretime/worker.log Environment=LIBRETIME_LOG_FILEPATH=@@LOG_DIR@@/worker.log
Environment=LIBRETIME_CONFIG_FILEPATH=/etc/libretime/config.yml Environment=LIBRETIME_CONFIG_FILEPATH=@@CONFIG_FILEPATH@@
WorkingDirectory=/var/lib/libretime/worker WorkingDirectory=@@WORKING_DIR@@/worker
ExecStart=/usr/bin/sh -c 'celery worker \ ExecStart=/usr/bin/sh -c 'celery worker \
--app=libretime_worker.tasks:worker \ --app=libretime_worker.tasks:worker \