@equinox I've commited a first version of separated Systemd unit files: 4ce41551. As per your suggestion they are meant to be triggered using Socket Activation.
As soon you have time, could you please have a look if that goes in the desired direction? I'm still not convinced if and how this could work at all. Note, the startup process looks like this:
Start Engine Core (aura-engine-core.service)
Wait until Core has finished all initializations
Start Engine Liquidsoap (aura-engine-lqs.service)
Liquidsoap creates the socketfile in /opt/aura/engine/modules/liquidsoap/engine.sock
Engine Core connects to that socket
So the service 3.) should be triggered right after 2.) finished
Nonetheless, there is a working unit file which loads both combined: aura-engine.service
The systemd service units look ok. But you also need to change some parts in your liquidsoap code to actually use the socket file descripter provided by systemd. Here is an example how this is done with python: https://gist.github.com/kylemanna/d193aaa6b33a89f649524ad27ce47c4b
I've made a few adaptations to the unit files related to your example project. But I don't see an option to create the Socket using a file descriptor in Liquidsoap.
I also removed the dependency in the engine-core unit file: "Requires=aura-engine-lqs.socket". Compare step 2.) and 3.) above.
Let's discuss details on the desired approach, because I believe we are moving around the actual problem here. Please note, that Engine Core (Python) require's to start Liquidsoap after all initialization are complete. Systemd doesn't seem provide the option to start another Unit after a certain event has happened inside the Python code.
@jackie suggested to implement a 2nd sync socket, which is independent from the Liquidsoap socket, to be able to react on the timed events.
For now I'm moving this ticket to the backlog, as the main functionality is currently working. At some later point I will try to refactor the overall startup logic involving Redis. Without Redis there should be a more transparent start of both engine services possible.
Since we got rid of Redis (#39 (closed)) we are not bound to the correct and timed order of starting the Engine components anymore (Hooray!). Liquidsoap can be started anytime now, same for Engine Core. If Core is starting up and cannot establish a connection to Liquidsoap, it is retrying to do so every 2 seconds.
A beautiful side-effect of the current implementation is Liquidsoap broadcasting its (already scheduled or station-fallback-triggered) programme unaffected by any possible Engine Core crashes. If Engine Core gets restarted, they are connecting again and do play as if nothing has happened.
Hence I replaced the "Socket Activation" with a simple Requires=aura-engine-lqs.service in the aura-engine Unit.