From ac2f4dff3a2854e1c7e33924e56c85e2bd1a0d0c Mon Sep 17 00:00:00 2001
From: David Trattnig <david.trattnig@o94.at>
Date: Wed, 9 Sep 2020 19:22:47 +0200
Subject: [PATCH] Extended docs. #21

---
 docs/developer-guide.md         | 24 ++++++++--------
 docs/installation-production.md | 49 +++++++++++++++++++++++----------
 2 files changed, 46 insertions(+), 27 deletions(-)

diff --git a/docs/developer-guide.md b/docs/developer-guide.md
index 6dae0345..02766ae0 100644
--- a/docs/developer-guide.md
+++ b/docs/developer-guide.md
@@ -6,10 +6,10 @@ This page gives insights on extending Aura Engine internals or through the API.
 
 - [Aura Engine Development Guide](#aura-engine-development-guide)
     - [AURA Componentes](#aura-componentes)
-        - [Engine Components](#engine-components)
+    - [Engine Components](#engine-components)
     - [API](#api)
+    - [Engine Startup Phases](#engine-startup-phases)
     - [More infos for debugging](#more-infos-for-debugging)
-        - [Default ports used by Engine](#default-ports-used-by-engine)
         - [Debugging Liquidsoap](#debugging-liquidsoap)
         - [Tips on configuring the audo interface](#tips-on-configuring-the-audo-interface)
     - [Read more](#read-more)
@@ -43,7 +43,7 @@ There's a convenience script to start all of the three main dependencies (Steeri
     ~/code/aura/meta$ ./run.sh aura local
 ```
 
-### Engine Components
+## Engine Components
 
 
 **engine-core.py**: It is the server which is connected to the external programme source (e.g. aura steering and tank), to liquidsoap and is listening for redis pubsub messages. This precious little server is telling liquidsoap what to play and when.
@@ -56,19 +56,17 @@ You can find the AURA API definition here: https://gitlab.servus.at/autoradio/me
 
 OpenAPI definition for Engine API: https://app.swaggerhub.com/apis/AURA-Engine/engine-api/
 
+## Engine Startup Phases
 
-## More infos for debugging
-
-### Default ports used by Engine
-
-Aura Engine requires a number of ports for internal and external communication.
+When you start Engine the following is happening:
 
-Those are the default port numbers:
-
-* `1234` ... Liquidsoap Telnet Server
-* `8008` ... Exposes the Engine API
-* `5000` ... Svelte development mode; dynamically uses some other port if occupied
+1. Python `engine-core.py`: Initializes `modules/core/engine.py` (The virtual mixer; class for remote-controlling Liquidsoap), Scheduler and the Redis Server
+2. Python `engine-core.py`: Start Liquidsoap.
+3. Liquidsoap: When Liquidsoap finished its startup, it creates a socket file as configured in `socketdir` of `engine.ini`.
+4. Python `modules/core/liquidsoap/client.py`: Connects to that socket file.
+5. Python `modules/schedulung/scheduler.py`: Continously loads schedules from the API endpoints, stores them in the local database and starts the playout as per the schedules.
 
+## More infos for debugging
 
 ### Debugging Liquidsoap
 
diff --git a/docs/installation-production.md b/docs/installation-production.md
index 4afb67fa..673700a3 100644
--- a/docs/installation-production.md
+++ b/docs/installation-production.md
@@ -224,7 +224,38 @@ For this you can utilize either [Systemd](https://systemd.io/) or [Supervisor](h
 
 ### Running with Systemd
 
--- TO BE ADDED --
+Copy the unit file `/opt/aura/engine/configuration/systemd/aura-engine.service` to `/etc/systemd/system/`.
+
+This unit file starts engine-core and engine-liquidsoap within one command. Here Liquidsoap is started as
+as subprocess.
+
+```shell
+sudo systemctl daemon-reload
+```
+
+**Start**
+
+```shell
+sudo systemctl start aura-engine
+```
+
+**Stop**
+
+```shell
+sudo systemctl start aura-engine
+```
+
+**Restart**
+
+```shell
+sudo systemctl restart aura-engine
+```
+
+**Status**
+
+```shell
+sudo systemctl status aura-engine
+```
 
 ### Running with Supervisor
 
@@ -290,13 +321,6 @@ to pickup the correct `supervisord.conf`.
     supervisorctl restart <service-name>
 ```
 
-**Start the API service with Supervisor**
-
-```shell
-    sudo supervisorctl update
-    sudo supervisorctl restart engine-api
-```
-
 In case you want to reload whole supervisor service
 
 ```shell
@@ -311,13 +335,10 @@ All Engine logs for production can be found under:
     `/var/log/aura`
 ```
 
-This includes individual logs from Engine Core, Liquidsoap and the API.
-But also `stdout` outputs from supervisor services are written there.
+and
 
-Additionally you'll finde Supervisor specific logs under:
-
-```
-    `/var/log/supervisor`
+```shell
+    `/opt/aura/engine/logs`
 ```
 
 ## Read more
-- 
GitLab