From 04135d8735a43333e4a91097ad994bc6040494a7 Mon Sep 17 00:00:00 2001
From: David Trattnig <david.trattnig@o94.at>
Date: Thu, 28 Jan 2021 12:02:21 +0100
Subject: [PATCH] Minimized required config options. #72

---
 config/sample-development.engine.ini    | 66 +++++++++----------------
 config/sample-docker.engine.ini         | 66 +++++++++----------------
 config/sample-production.engine.ini     | 63 +++++++++--------------
 config/supervisor/aura-engine-lqs.conf  | 13 -----
 config/supervisor/aura-engine.conf      |  4 +-
 config/systemd/aura-engine-core.service | 15 ------
 config/systemd/aura-engine-lqs.service  | 15 ------
 config/systemd/aura-engine.service      |  2 +-
 8 files changed, 69 insertions(+), 175 deletions(-)
 delete mode 100644 config/supervisor/aura-engine-lqs.conf
 delete mode 100644 config/systemd/aura-engine-core.service
 delete mode 100644 config/systemd/aura-engine-lqs.service

diff --git a/config/sample-development.engine.ini b/config/sample-development.engine.ini
index 572b1dfa..86ece251 100644
--- a/config/sample-development.engine.ini
+++ b/config/sample-development.engine.ini
@@ -5,21 +5,17 @@
 [general]
 # Path to the engine-core socket directory relative to the engine project root
 socket_dir="../engine-core/socket"
-
-[database]
-db_user="aura"
-db_name="aura_engine"
-db_pass="---SECRET--PASSWORD---"
-db_host="localhost"
-db_charset="utf8"
-
+# Directory where the log file resides
+log_dir="logs"
+# Possible values: debug, info, warning, error, critical
+log_level="info"
 
 [monitoring]
+# Mail server credentials for sending email notifications (Admin and Programme Coordination)
 mail_server="mail.your-radio.org"
 mail_server_port="587"
 mail_user="aura@subsquare.at"
 mail_pass="---SECRET--PASSWORD---"
-
 # Set to "true" if you want to notify programme-coordinators about about fallback situations, otherwise "false"
 mail_coordinator_enabled="true"
 # If you want to address multiple programme-coordinators separate their emails by space
@@ -40,22 +36,14 @@ heartbeat_port = 43334
 # Seconds how often the vitality of the Engine should be checked (0 = disabled)
 heartbeat_frequency = 1
 
-logdir="/home/username/code/aura/engine/logs"
-# Possible values: debug, info, warning, error, critical
-loglevel="info"
-
-
 [api]
-
 ## STEERING ##
-
 # The URL to get the health status 
 api_steering_status="http://localhost:8000/api/v1/"
 # The URL to get the Calendar via Steering
 api_steering_calendar="http://localhost:8000/api/v1/playout"
 
 ## TANK ##
-
 # The session name which is used to authenticate against Tank
 api_tank_session="engine"
 # The secret which is used to authenticate against Tank
@@ -66,7 +54,6 @@ api_tank_status="http://localhost:8040/healthz/"
 api_tank_playlist="http://localhost:8040/api/v1/playlists/${ID}"
 
 ## ENGINE-API ##
-
 # Engine ID (1 or 2)
 api_engine_number=1
 # Engine API availability check
@@ -78,11 +65,22 @@ api_engine_store_clock="http://localhost:8008/api/v1/clock"
 # Engine API endpoint to store health information
 api_engine_store_health="http://localhost:8008/api/v1/source/health/${ENGINE_NUMBER}"
 
-
-[scheduling]
-
+[scheduler]
+# Base path as seen by "engine-core", not accessed by "engine"; this is required to construct the absolute audio file path (check "Audio Store" in the docs)
+audio_source_folder="/var/audio/source"
+audio_source_extension=".flac"
+# Folder holding M3U Playlists to be scheduled in form of Engine Playlists
+audio_playlist_folder="/var/audio/playlist"
+# Offset in seconds how long it takes for Liquidsoap to actually execute a scheduler command; Crucial to keep things in sync
+engine_latency_offset=0.5
 # How often should the calendar be fetched in seconds. This determines the time of the last changes applied, before a specific show aired
 fetching_frequency=30
+# The schedule is fetched on every "fetching_frequency" cycle and stored in a local database
+db_user="aura"
+db_name="aura_engine"
+db_pass="---SECRET--PASSWORD---"
+db_host="localhost"
+db_charset="utf8"
 # The scheduling window defines when the entries of each timeslot are queued for play-out. The windows start at (timeslot.start - window_start) seconds
 # and ends at (timeslot.end - window.end) seconds. Its also worth noting, that timeslots can only be deleted before the start of the window.                
 scheduling_window_start=60
@@ -91,32 +89,12 @@ scheduling_window_end=60
 # contents which take longer to load (big files, bad connectivity to streams etc.). If the planned start time is in
 # the past the offset is ignored and the entry is played as soon as possible
 preload_offset=15
-
 # Sometimes it might take longer to get a stream connected. Here you can define a viable length.
 # But note, that this may affect the preloading time (see `preload_offset`), hence affecting the 
 # overall playout, it's delays and possible fallbacks
 input_stream_retry_delay=1
 input_stream_max_retries=10
 input_stream_buffer=3.0
-
-
-[fading]
-# Sets the time how long we have to fade in and out, when we select another mixer input values are in seconds
-fade_in_time="0.5"
-fade_out_time="2.5"
-
-# Liquidsoap execution delay in seconds; Crucial to keep things in sync
-lqs_delay_offset=0.5
-
-[user]
-# the user and group under which this software will run
-daemongroup="engineuser"
-daemonuser="engineuser"
-
-[socket]
-socket_dir="/home/username/code/aura/engine/src/liquidsoap"
-
-[audiosources]
-audio_source_folder="/var/audio/source"
-audio_source_extension=".flac"
-audio_playlist_folder="/var/audio/playlist"
+# How long we have to fade in and out, when we select another mixer input (seconds))
+fade_in_time="1.5"
+fade_out_time="1.5"
diff --git a/config/sample-docker.engine.ini b/config/sample-docker.engine.ini
index 51349fd3..efa0b88e 100644
--- a/config/sample-docker.engine.ini
+++ b/config/sample-docker.engine.ini
@@ -5,21 +5,17 @@
 [general]
 # Path to the engine-core socket directory relative to the engine project root
 socket_dir="../engine-core/socket"
-
-[database]
-db_user="aura"
-db_name="aura_engine"
-db_pass="---SECRET--PASSWORD---"
-db_host="127.0.0.1"
-db_charset="utf8"
-
+# Directory where the log file resides
+log_dir="logs"
+# Possible values: debug, info, warning, error, critical
+log_level="info"
 
 [monitoring]
+# Mail server credentials for sending email notifications (Admin and Programme Coordination)
 mail_server="mail.your-radio.org"
 mail_server_port="587"
 mail_user="aura@subsquare.at"
 mail_pass="---SECRET--PASSWORD---"
-
 # Set to "true" if you want to notify programme-coordinators about about fallback situations, otherwise "false"
 mail_coordinator_enabled="true"
 # If you want to address multiple programme-coordinators separate their emails by space
@@ -40,22 +36,14 @@ heartbeat_port = 43334
 # Seconds how often the vitality of the Engine should be checked (0 = disabled)
 heartbeat_frequency = 1
 
-logdir="/srv/logs"
-# Possible values: debug, info, warning, error, critical
-loglevel="info"
-
-
 [api]
-
 ## STEERING ##
-
 # The URL to get the health status 
 api_steering_status="http://127.0.0.1:8000/api/v1/"
 # The URL to get the Calendar via Steering
 api_steering_calendar="http://127.0.0.1:8000/api/v1/playout"
 
 ## TANK ##
-
 # The session name which is used to authenticate against Tank
 api_tank_session="engine"
 # The secret which is used to authenticate against Tank
@@ -66,7 +54,6 @@ api_tank_status="http://127.0.0.1:8040/healthz/"
 api_tank_playlist="http://127.0.0.1:8040/api/v1/playlists/${ID}"
 
 ## ENGINE-API ##
-
 # Engine ID (1 or 2)
 api_engine_number=1
 # Engine API availability check
@@ -78,11 +65,22 @@ api_engine_store_clock="http://127.0.0.1:8008/api/v1/clock"
 # Engine API endpoint to store health information
 api_engine_store_health="http://127.0.0.1:8008/api/v1/source/health/${ENGINE_NUMBER}"
 
-
-[scheduling]
-
+[scheduler]
+# Base path as seen by "engine-core", not accessed by "engine"; this is required to construct the absolute audio file path (check "Audio Store" in the docs)
+audio_source_folder="/var/audio/source"
+audio_source_extension=".flac"
+# Folder holding M3U Playlists to be scheduled in form of Engine Playlists
+audio_playlist_folder="/var/audio/playlist"
+# Offset in seconds how long it takes for Liquidsoap to actually execute a scheduler command; Crucial to keep things in sync
+engine_latency_offset=0.5
 # How often should the calendar be fetched in seconds. This determines the time of the last changes applied, before a specific show aired
 fetching_frequency=300
+# The schedule is fetched on every "fetching_frequency" cycle and stored in a local database
+db_user="aura"
+db_name="aura_engine"
+db_pass="---SECRET--PASSWORD---"
+db_host="localhost"
+db_charset="utf8"
 # The scheduling window defines when the entries of each timeslot are queued for play-out. The windows start at (timeslot.start - window_start) seconds
 # and ends at (timeslot.end - window.end) seconds. Its also worth noting, that timeslots can only be deleted before the start of the window.                
 scheduling_window_start=60
@@ -91,32 +89,12 @@ scheduling_window_end=60
 # contents which take longer to load (big files, bad connectivity to streams etc.). If the planned start time is in
 # the past the offset is ignored and the entry is played as soon as possible
 preload_offset=15
-
 # Sometimes it might take longer to get a stream connected. Here you can define a viable length.
 # But note, that this may affect the preloading time (see `preload_offset`), hence affecting the 
 # overall playout, it's delays and possible fallbacks
 input_stream_retry_delay=1
 input_stream_max_retries=10
 input_stream_buffer=3.0
-
-
-[fading]
-# Sets the time how long we have to fade in and out, when we select another mixer input values are in seconds
-fade_in_time="0.5"
-fade_out_time="2.5"
-
-# Liquidsoap execution delay in seconds; Crucial to keep things in sync
-lqs_delay_offset=0.5
-
-[user]
-# the user and group under which this software will run
-daemongroup="engineuser"
-daemonuser="engineuser"
-
-[socket]
-socket_dir="/srv/src/liquidsoap"
-
-[audiosources]
-audio_source_folder="/var/audio/source"
-audio_source_extension=".flac"
-audio_playlist_folder="/var/audio/playlist"
+# How long we have to fade in and out, when we select another mixer input (seconds))
+fade_in_time="1.5"
+fade_out_time="1.5"
diff --git a/config/sample-production.engine.ini b/config/sample-production.engine.ini
index fd163e46..81171f20 100644
--- a/config/sample-production.engine.ini
+++ b/config/sample-production.engine.ini
@@ -5,21 +5,17 @@
 [general]
 # Path to the engine-core socket directory relative to the engine project root
 socket_dir="../engine-core/socket"
-
-[database]
-db_user="aura"
-db_name="aura_engine"
-db_pass="---SECRET--PASSWORD---"
-db_host="localhost"
-db_charset="utf8"
-
+# Directory where the log file resides
+log_dir="logs"
+# Possible values: debug, info, warning, error, critical
+log_level="info"
 
 [monitoring]
+# Mail server credentials for sending email notifications (Admin and Programme Coordination)
 mail_server="mail.your-radio.org"
 mail_server_port="587"
 mail_user="aura@subsquare.at"
 mail_pass="---SECRET--PASSWORD---"
-
 # Set to "true" if you want to notify programme-coordinators about about fallback situations, otherwise "false"
 mail_coordinator_enabled="true"
 # If you want to address multiple programme-coordinators separate their emails by space
@@ -40,22 +36,14 @@ heartbeat_port = 43334
 # Seconds how often the vitality of the Engine should be checked (0 = disabled)
 heartbeat_frequency = 1
 
-logdir="/opt/aura/engine/logs"
-# Possible values: debug, info, warning, error, critical
-loglevel="info"
-
-
 [api]
-
 ## STEERING ##
-
 # The URL to get the health status 
 api_steering_status="http://aura.local:8000/api/v1/"
 # The URL to get the Calendar via Steering
 api_steering_calendar="http://aura.local:8000/api/v1/playout"
 
 ## TANK ##
-
 # The session name which is used to authenticate against Tank
 api_tank_session="engine"
 # The secret which is used to authenticate against Tank
@@ -66,7 +54,6 @@ api_tank_status="http://aura.local:8040/healthz/"
 api_tank_playlist="http://aura.local:8040/api/v1/playlists/${ID}"
 
 ## ENGINE-API ##
-
 # Engine ID (1 or 2)
 api_engine_number=1
 # Engine API availability check
@@ -78,11 +65,22 @@ api_engine_store_clock="http://localhost:8008/api/v1/clock"
 # Engine API endpoint to store health information
 api_engine_store_health="http://localhost:8008/api/v1/source/health/${ENGINE_NUMBER}"
 
-
-[scheduling]
-
+[scheduler]
+# Base path as seen by "engine-core", not accessed by "engine"; this is required to construct the absolute audio file path (check "Audio Store" in the docs)
+audio_source_folder="/var/audio/source"
+audio_source_extension=".flac"
+# Folder holding M3U Playlists to be scheduled in form of Engine Playlists
+audio_playlist_folder="/var/audio/playlist"
+# Offset in seconds how long it takes for Liquidsoap to actually execute a scheduler command; Crucial to keep things in sync
+engine_latency_offset=0.5
 # How often should the calendar be fetched in seconds. This determines the time of the last changes applied, before a specific show aired
 fetching_frequency=300
+# The schedule is fetched on every "fetching_frequency" cycle and stored in a local database
+db_user="aura"
+db_name="aura_engine"
+db_pass="---SECRET--PASSWORD---"
+db_host="localhost"
+db_charset="utf8"
 # The scheduling window defines when the entries of each timeslot are queued for play-out. The windows start at (timeslot.start - window_start) seconds
 # and ends at (timeslot.end - window.end) seconds. Its also worth noting, that timeslots can only be deleted before the start of the window.                
 scheduling_window_start=60
@@ -91,29 +89,12 @@ scheduling_window_end=60
 # contents which take longer to load (big files, bad connectivity to streams etc.). If the planned start time is in
 # the past the offset is ignored and the entry is played as soon as possible
 preload_offset=15
-
 # Sometimes it might take longer to get a stream connected. Here you can define a viable length.
 # But note, that this may affect the preloading time (see `preload_offset`), hence affecting the 
 # overall playout, it's delays and possible fallbacks
 input_stream_retry_delay=1
 input_stream_max_retries=10
 input_stream_buffer=3.0
-
-
-[fading]
-# Sets the time how long we have to fade in and out, when we select another mixer input values are in seconds
-fade_in_time="0.5"
-fade_out_time="2.5"
-
-# Liquidsoap execution delay in seconds; Crucial to keep things in sync
-lqs_delay_offset=0.5
-
-[user]
-# the user and group under which this software will run
-daemongroup="engineuser"
-daemonuser="engineuser"
-
-[audiosources]
-audio_source_folder="/var/audio/source"
-audio_source_extension=".flac"
-audio_playlist_folder="/var/audio/playlist"
+# How long we have to fade in and out, when we select another mixer input (seconds))
+fade_in_time="1.5"
+fade_out_time="1.5"
diff --git a/config/supervisor/aura-engine-lqs.conf b/config/supervisor/aura-engine-lqs.conf
deleted file mode 100644
index c01563de..00000000
--- a/config/supervisor/aura-engine-lqs.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-[program:aura-engine]
-user = engineuser
-directory = /opt/aura/engine
-command = /opt/aura/engine/run.sh lqs
-
-priority = 999
-autostart = true
-autorestart = true
-stopsignal = TERM
-
-redirect_stderr = true
-stdout_logfile = /opt/aura/engine/logs/engine-core-stdout.log
-stderr_logfile = /opt/aura/engine/logs/engine-core-error.log
\ No newline at end of file
diff --git a/config/supervisor/aura-engine.conf b/config/supervisor/aura-engine.conf
index ee776c9d..df4e33c6 100644
--- a/config/supervisor/aura-engine.conf
+++ b/config/supervisor/aura-engine.conf
@@ -9,5 +9,5 @@ autorestart = true
 stopsignal = TERM
 
 redirect_stderr = true
-stdout_logfile = /opt/aura/engine/logs/engine-core-stdout.log
-stderr_logfile = /opt/aura/engine/logs/engine-core-error.log
\ No newline at end of file
+stdout_logfile = /opt/aura/engine/logs/engine-stdout.log
+stderr_logfile = /opt/aura/engine/logs/engine-error.log
\ No newline at end of file
diff --git a/config/systemd/aura-engine-core.service b/config/systemd/aura-engine-core.service
deleted file mode 100644
index cd383869..00000000
--- a/config/systemd/aura-engine-core.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=Aura Engine - Playout Server (Core)
-After=network.target
-Documentation=https://gitlab.servus.at/aura/engine
-
-[Service]
-Type=simple
-User=engineuser
-WorkingDirectory=/opt/aura/engine
-ExecStart=/opt/aura/engine/run.sh core
-Restart=always
-
-[Install]
-WantedBy=multi-user.target
-Alias=aura-engine-core.service
\ No newline at end of file
diff --git a/config/systemd/aura-engine-lqs.service b/config/systemd/aura-engine-lqs.service
deleted file mode 100644
index 3d63f910..00000000
--- a/config/systemd/aura-engine-lqs.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=Aura Engine - Playout Server (Liquidsoap)
-Documentation=https://gitlab.servus.at/aura/engine
-After=network.target
-
-[Service]
-Type=simple
-User=engineuser
-WorkingDirectory=/opt/aura/engine
-ExecStart=/opt/aura/engine/engine/run.sh lqs
-Restart=always
-
-[Install]
-WantedBy=default.target
-Alias=aura-engine-lqs.service
diff --git a/config/systemd/aura-engine.service b/config/systemd/aura-engine.service
index df43987a..004b652a 100644
--- a/config/systemd/aura-engine.service
+++ b/config/systemd/aura-engine.service
@@ -2,7 +2,7 @@
 Description=Aura Engine - Playout Server
 Documentation=https://gitlab.servus.at/aura/engine
 After=network.target
-Requires=aura-engine-lqs.service
+Requires=aura-engine-core.service
 
 [Service]
 Type=simple
-- 
GitLab