Skip to content

About Lahmacun's "Auto DJ" (Liquidsoap) configuration

gammaw edited this page Sep 1, 2019 · 4 revisions

Liquidsoap is an audio streaming service that is used by Azuracast. Out of the box, Azuracast hides Liquidsoap from the user and generates the necessary Liquidsoap configuration automatically. Azuracast offers an easy-to-use interface to configure playlists, scheduling, fading etc. and turns this configuration into the Liquidsoap language. This is enough for most use cases but it may turn out to be a burden in more advanced customization.

Azuracast offers a possibility to write a custom Liquidsoap configuration that is appended to the Liquidsoap configuration generated by Azuracast. The problem with this approach is that the custom configuration must assume the content of the Azuracast-generated part of the configuration. In our case, it was the live source that was used "too early" by Azuracast.

Therefore, pre-release 0.2 introduced a fully self-hosted Liquidsoap configuration. The trigger for this change was an issue with music not fading out before a live DJ session. As a result, Lahmacun implements full control over the Liquidsoap configuration. As Azuracast does not support such feature directly, we implemented this workaound.

The main parts of our implementation are the following:

  • The full Liquidsoap configuration is stored on the host machine (in liquidsoap_custom.liq). The necessary keys (Azuracast and Icecast) are stored in a separate file on the host machine. These keys need to be copy-pasted manually in liquidsoap_custom.liq.
  • Azuracast's docker-compose configuration is instructed to mount this file as the Liquidsoap configuration (in the docker-compose.override.yml, see at the end of the page). Note that we don't need to touch Azurcast's docker-compose configuration (docker-compose.yml).
  • As a one-time action, Azuracast needs to be shut down (docker-compose down) and launched again (docker-compose up -d). Note that the configuration can be edited (e.g., via SFTP) without shutting down Azuracast.

The most frequent use cases of Lahmacun (e.g., uploading new episodes of existing shows) are not affected by this change. The restart of the Liquidsoap service is required only in cases where the standard Azuracast installation also needs to be restarted.

The only workflow that has been affected by this change is the creation of new shows (i.e., playlists). The new worklow is as follows:

  1. Create a custom playlist in Azuracast.
  2. NEW Define new playlist in liquidsoap_custom.liq.
  3. Schedule new playlist in liquidsoap_custom.liq.
  4. Restart the Liquidsoap service.

Important note: before each update check changes of https://github.com/AzuraCast/AzuraCast/blob/master/src/Radio/Backend/Liquidsoap.php#L51-L713 if the custom Liquidsoap configuration needs to be updated (see https://github.com/AzuraCast/AzuraCast/issues/1789#issuecomment-520242974). This is because our custom configuration simply copies the configuration generated by Azuracast and comments out a line where the live source is used.

The docker-compose.override.yml file:

version: '2.2'

services:
  web:
    volumes:
      - ./liquidsoap_custom.liq:/var/azuracast/stations/lahmacun_radio/config/liquidsoap.liq:ro
  stations:
    volumes:
      - ./liquidsoap_custom.liq:/var/azuracast/stations/lahmacun_radio/config/liquidsoap.liq:ro