Skip to content

Commit

Permalink
feat(docker-compose): create a surround radio example
Browse files Browse the repository at this point in the history
  • Loading branch information
uZer committed Oct 31, 2023
1 parent dd7b37d commit d25e2d7
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
example/audio/*
.*.sw*
.res/.$*
43 changes: 28 additions & 15 deletions .res/info.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
Useful URLs and exposed services with default configuration.

# Liquidsoap container (liquidsoap-myradio)
http://127.0.0.1:6001/metrics # Liquidsoap Prometheus Metrics
http://127.0.0.1:7000/livesource # Liquidsoap HTTP API
srt://127.0.0.1:10000 # Liquidsoap SRT input port voieA_caller1
srt://127.0.0.1:10001 # Liquidsoap SRT input port voieA_caller2
srt://127.0.0.1:10002 # Liquidsoap SRT input port voieB_caller1
srt://127.0.0.1:10003 # Liquidsoap SRT input port voieB_caller2
srt://127.0.0.1:10004 # Liquidsoap SRT input port override_caller1
srt://127.0.0.1:10005 # Liquidsoap SRT input port override_caller2
srt://127.0.0.1:10006 # Liquidsoap SRT input port sat_sat1
http://127.0.0.1:6001/metrics # Liquidsoap (myradio) Prometheus Metrics
http://127.0.0.1:7000/livesource # Liquidsoap (myradio) HTTP API
srt://127.0.0.1:10000 # Liquidsoap (myradio) SRT input port voieA_caller1
srt://127.0.0.1:10001 # Liquidsoap (myradio) SRT input port voieA_caller2
srt://127.0.0.1:10002 # Liquidsoap (myradio) SRT input port voieB_caller1
srt://127.0.0.1:10003 # Liquidsoap (myradio) SRT input port voieB_caller2
srt://127.0.0.1:10004 # Liquidsoap (myradio) SRT input port override_caller1
srt://127.0.0.1:10005 # Liquidsoap (myradio) SRT input port override_caller2
srt://127.0.0.1:10006 # Liquidsoap (myradio) SRT input port sat_sat1

# Liquidsoap container (liquidsoap-myradiosurround)
http://127.0.0.1:6011/metrics # Liquidsoap (myradiosurround) Prometheus Metrics
http://127.0.0.1:7010/livesource # Liquidsoap (myradiosurround) HTTP API
srt://127.0.0.1:10010 # Liquidsoap (myradiosurround) SRT input port voieA_caller1
srt://127.0.0.1:10011 # Liquidsoap (myradiosurround) SRT input port voieA_caller2
srt://127.0.0.1:10012 # Liquidsoap (myradiosurround) SRT input port voieB_caller1
srt://127.0.0.1:10013 # Liquidsoap (myradiosurround) SRT input port voieB_caller2
srt://127.0.0.1:10014 # Liquidsoap (myradiosurround) SRT input port override_caller1
srt://127.0.0.1:10015 # Liquidsoap (myradiosurround) SRT input port override_caller2
srt://127.0.0.1:10016 # Liquidsoap (myradiosurround) SRT input port sat_sat1

# Icecast2
http://127.0.0.1:8000 # Icecast status and mountpoints
http://127.0.0.1:8000/myradio-hifi.aac # Icecast mountpoint (AAC hifi)
http://127.0.0.1:8000/myradio-midfi.aac # Icecast mountpoint (AAC midfi)
http://127.0.0.1:8000/myradio-lofi.aac # Icecast mountpoint (AAC lofi)
http://127.0.0.1:8000/myradio-midfi.mp3 # Icecast mountpoint (MP3 midfi)
http://127.0.0.1:8000/myradio-lofi.mp3 # Icecast mountpoint (MP3 lofi)
http://127.0.0.1:8000 # Icecast status and mountpoints
http://127.0.0.1:8000/myradio-hifi.aac # Icecast mountpoint (AAC hifi)
http://127.0.0.1:8000/myradio-midfi.aac # Icecast mountpoint (AAC midfi)
http://127.0.0.1:8000/myradio-lofi.aac # Icecast mountpoint (AAC lofi)
http://127.0.0.1:8000/myradio-midfi.mp3 # Icecast mountpoint (MP3 midfi)
http://127.0.0.1:8000/myradio-lofi.mp3 # Icecast mountpoint (MP3 lofi)
http://127.0.0.1:8000/myradiosurround-hifi.aac # Icecast mountpoint (AAC hifi surround)

# NGINX (HLS, only AAC audio)
http://127.0.0.1:8080 # Browse HLS files
http://127.0.0.1:8080/myradio/myradio.m3u8 # HLS playlist
http://127.0.0.1:8080/myradio/myradio_hifi.m3u8 # HLS playlist (enforce hifi)
http://127.0.0.1:8080/myradio/myradio_midfi.m3u8 # HLS playlist (enforce midfi)
http://127.0.0.1:8080/myradio/myradio_lofi.m3u8 # HLS playlist (enforce lofi)
http://127.0.0.1:8080/myradiosurround/myradiosurround_hifi.m3u8 # HLS playlist (enforce lofi)

# Prometheus
http://127.0.0.1:9090 # Prometheus web interface
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test: ## Run test on the liquidsoap configuration

reload: ## Update containers if needed and restart liquidsoap
@docker compose up -d
@docker compose restart liquidsoap-test liquidsoap-myradio
@docker compose restart liquidsoap-test liquidsoap-myradio liquidsoap-myradiosurround
@docker compose ps
@docker compose logs -f

Expand Down
54 changes: 51 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,31 @@ services:
- data_hls:/tmp/
- data_liquidsoap:/state/

liquidsoap-myradiosurround:
command:
- /conf/myradiosurround.liq
- /scripts/00-live.liq
container_name: liquidsoap-myradiosurround
image: savonet/liquidsoap:rolling-release-v2.2.x
networks:
- default
restart: unless-stopped
ports:
- 6011:6011/tcp
- 7010:7010/tcp
- 10010:10010/tcp
- 10011:10011/tcp
- 10012:10012/tcp
- 10013:10013/tcp
- 10014:10014/tcp
- 10015:10015/tcp
- 10016:10016/tcp
volumes:
- ./example/liquidsoap/:/conf/:ro
- ./scripts/:/scripts/:ro
- data_hls:/tmp/
- data_liquidsoap:/state/

# Feed liquidsoap with an example SRT source (https://modular-station.com/)
source-voieA-caller1:
command:
Expand All @@ -56,7 +81,7 @@ services:
- "srt://liquidsoap-myradio:10000" # voieA_caller1
container_name: source-voieA-caller1
entrypoint: []
image: savonet/liquidsoap:v2.2.1
image: savonet/liquidsoap:rolling-release-v2.2.x
networks:
- default
restart: unless-stopped
Expand All @@ -77,7 +102,7 @@ services:
- "srt://liquidsoap-myradio:10002" # voieB_caller1
container_name: source-voieB-caller1
entrypoint: []
image: savonet/liquidsoap:v2.2.1
image: savonet/liquidsoap:rolling-release-v2.2.x
networks:
- default
restart: unless-stopped
Expand All @@ -98,11 +123,34 @@ services:
- "srt://liquidsoap-myradio:10004" # override_caller1
container_name: source-override-caller1
entrypoint: []
image: savonet/liquidsoap:v2.2.1
image: savonet/liquidsoap:rolling-release-v2.2.x
networks:
- default
restart: unless-stopped

# Feed liquidsoap with an example SRT source (https://modular-station.com/)
source-surround:
command:
- /usr/bin/ffmpeg
- -hide_banner
- -re
- -i
- /audio/CHANNEL_ORDER_TEST_MUSIC_MULTI_5.1_-23LUFS.wav
- -vn
- -f
- wav
- -codec:a
- pcm_s24le
- "srt://liquidsoap-myradiosurround:10010" # voieA_caller1
container_name: source-surround
entrypoint: []
image: savonet/liquidsoap:rolling-release-v2.2.x
networks:
- default
restart: unless-stopped
volumes:
- ./example/audio/:/audio/:ro

# Streaming services: icecast
icecast:
container_name: icecast
Expand Down
13 changes: 10 additions & 3 deletions example/liquidsoap/myradio.liq
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,25 @@ input_list = [
{name="sat_sat1", is_autofallback=true, port=10006},
]

formats_picker = fun (formats) -> formats.surround
formats_picker = fun (formats) -> formats.stereo

aac_encoder = "aac"

hls_formats = ["hifi"]
hls_formats = [
"lofi", "midfi", "hifi"
]
enable_upload_hls_segments = false
hls_segments_http_post_target = "http://segmentforwarder"

enable_hls_segments_todo_files = false

icecast_formats = [
("aac", ["hifi"])
("aac", [
"lofi", "midfi", "hifi"
]),
("mp3", [
"lofi", "midfi"
])
]

prometheus_server_port = 6001
Expand Down
38 changes: 38 additions & 0 deletions example/liquidsoap/myradiosurround.liq
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
radio_name = "myradiosurround"
hls_segments_http_post_origin = "hostname"

hls_state_path = "/state/#{radio_name}.hlsstate"
livesource_state_path = "/state/#{radio_name}.livesourcestate"

hls_segments_directory = "/tmp/#{radio_name}"

input_list = [
{name="voieA_caller1", is_autofallback=true, port=10010},
{name="voieA_caller2", is_autofallback=true, port=10011},
{name="voieB_caller1", is_autofallback=true, port=10012},
{name="voieB_caller2", is_autofallback=true, port=10013},
{name="override_caller1", is_autofallback=false, port=10014},
{name="override_caller2", is_autofallback=false, port=10015},
{name="sat_sat1", is_autofallback=true, port=10016},
]

formats_picker = fun (formats) -> formats.surround

aac_encoder = "aac"

hls_formats = ["hifi"]
enable_upload_hls_segments = false
hls_segments_http_post_target = "http://segmentforwarder"

enable_hls_segments_todo_files = false

icecast_formats = [
("aac", ["hifi"])
]

prometheus_server_port = 6011
harbor_http_port = 7010
icecast_host = "icecast"
icecast_port = 8000
icecast_password = "secret"
liquidsoap_log_level = 3
5 changes: 4 additions & 1 deletion example/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ scrape_configs:
- job_name: 'liquidsoap'
scrape_interval: 5s
static_configs:
- targets: ['liquidsoap-myradio:6001']
- targets: [
'liquidsoap-myradio:6001',
'liquidsoap-myradiosurround:6001',
]

- job_name: 'prometheus'
scrape_interval: 10s
Expand Down

0 comments on commit d25e2d7

Please sign in to comment.